From 8ed7100f2b914a3e4aab34224cb79ef4c9f1115f Mon Sep 17 00:00:00 2001 From: Stevie Ped Date: Fri, 29 Sep 2023 23:55:04 +0930 Subject: [PATCH] Added respectLevels to plotProfileHeatmap --- R/fitAssayDiff.R | 2 +- R/plotProfileHeatmap.R | 7 +++++-- man/fitAssayDiff-methods.Rd | 2 +- man/plotProfileHeatmap-methods.Rd | 5 +++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/R/fitAssayDiff.R b/R/fitAssayDiff.R index dc289821..b7d45c89 100644 --- a/R/fitAssayDiff.R +++ b/R/fitAssayDiff.R @@ -43,7 +43,7 @@ #' integrating multiple ChIP targets due to the increase in false-negatives when #' using a range-based H0, and when requiring more accurate identification of #' truly unchanged sites, as opposed to those which simply fail to achieve -#' significance using a range-based H0. +#' significance using a range-based H0 where arbitrary cutoff values are used. #' #' @param x a SummarizedExperiment object #' @param assay The assay to use for analysis diff --git a/R/plotProfileHeatmap.R b/R/plotProfileHeatmap.R index b517221e..0db96ab9 100644 --- a/R/plotProfileHeatmap.R +++ b/R/plotProfileHeatmap.R @@ -43,6 +43,9 @@ #' Represents the fraction of the plotting area taken up by the summary panel. #' @param summaryLabelSide Side to place y-axis for the summary plot in the top #' panel +#' @param respectLevels logical(1) If FALSE, facets along the y-axis will be +#' arranged in descending order of signal, otherwise any original factor levels +#' will be retained #' @param ... Passed to \link[ggplot2]{facet_grid} internally. Can be utilised #' for switching panel strips or passing a labeller function #' @@ -140,7 +143,7 @@ setMethod( facetX = NULL, facetY = NULL, colour = facetY, linetype = NULL, summariseBy = c("mean", "median", "min", "max", "none"), xLab = xValue, yLab = NULL, fillLab = fillValue, relHeight = 0.3, - summaryLabelSide = "left", ... + summaryLabelSide = "left", respectLevels = FALSE, ... ) { ## Check the profile data.frames for identical dims & required cols @@ -171,7 +174,7 @@ setMethod( tbl <- arrange(tbl, desc(!!sym(fillValue))) ## Ensure the ranges are shown with the strongest signal at the top tbl$range <- fct_rev(fct_inorder(tbl$range)) - if (!is.null(facetY)) + if (!is.null(facetY) & !respectLevels) tbl[[facetY]] <- fct_inorder(as.character(tbl[[facetY]])) ## Pass to the private function diff --git a/man/fitAssayDiff-methods.Rd b/man/fitAssayDiff-methods.Rd index 818da19b..218c9889 100644 --- a/man/fitAssayDiff-methods.Rd +++ b/man/fitAssayDiff-methods.Rd @@ -84,7 +84,7 @@ These are not used for FDR-adjusted p-values but can be helpful when integrating multiple ChIP targets due to the increase in false-negatives when using a range-based H0, and when requiring more accurate identification of truly unchanged sites, as opposed to those which simply fail to achieve -significance using a range-based H0. +significance using a range-based H0 where arbitrary cutoff values are used. } \description{ Detect differential ChIP signal using one of many approaches diff --git a/man/plotProfileHeatmap-methods.Rd b/man/plotProfileHeatmap-methods.Rd index 593bb951..fa235174 100644 --- a/man/plotProfileHeatmap-methods.Rd +++ b/man/plotProfileHeatmap-methods.Rd @@ -40,6 +40,7 @@ plotProfileHeatmap(object, ...) fillLab = fillValue, relHeight = 0.3, summaryLabelSide = "left", + respectLevels = FALSE, ... ) } @@ -73,6 +74,10 @@ Represents the fraction of the plotting area taken up by the summary panel.} \item{summaryLabelSide}{Side to place y-axis for the summary plot in the top panel} + +\item{respectLevels}{logical(1) If FALSE, facets along the y-axis will be +arranged in descending order of signal, otherwise any original factor levels +will be retained} } \value{ A \code{ggplot2} object, able to be customised using standard \code{ggplot2} syntax