plotStackProfile: plotStackProfile()

View source: R/plotStackProfile.R

plotStackProfileR Documentation

plotStackProfile()

Description

Display a heatmap of an epigenetic track centered at genomic anchors such as Transcription Start Sites or peak center.

Usage

plotStackProfile(
  rse,
  assay = NULL,
  x_labels = c("Before", "Anchor", "After"),
  title = "",
  zlim = NULL,
  palette = function(n) grDevices::hcl.colors(n, rev = TRUE),
  target_height = 650,
  summary_func = function(x) mean(x, na.rm = TRUE),
  n_core = 1,
  pattern = NULL
)

Arguments

rse

a RangedSummarizedExperiment input. Aletrnatively: can be a GRanges object (for backward compatibility, pattern will be required).

assay

specify the name of the assay to plot, that should match one of assayNames(rse).

x_labels

a character vectors of length 3 used to label the x-axis.

title

The title of the heatmap

zlim

The minimum and maximum z values to match color to values. Format: zlim = c (min, max)

palette

a palette of color, (i.e. a function of parameter n that should retrun n colors).

target_height

The matrix height is reduced to this number of rows before plotting. Useful to limit overplotting artefacts. It should roughtly be set to the pixel height in the final heatmap.

summary_func

function passed to redimMatrix(). Usualy mean, but can be set to median or max for sparse matrices.

n_core

multicore option, passed to redimMatrix().

pattern

only if rse is of class GRanges. A character vector of length 1 of a column prefixe (can be regular expressions) that should match columns of rse.

Details

The visualisation is centered on an anchor, a set of genomic coordinated that can be transcription start sites or peak center for example. Anchor coordinates are those of the RangedSummarizedExperiment object used as an input (hereafter rse).

Anchors are plotted from top to bottom in the same order as in rse. One should sort rse before plotting if needed.

The matrix used to display the heatmap should be passed as assay of rse. Such matrix can be obtained using EnrichedHeatmap::normalizeToMatrix() for example.

This function scale reasonnably wells up to hundred thousands of regions. Overplotting issues are solved by last-minute reduction of the matrix size using redimMatrix().

Value

Display a plot.

See Also

plotAverageProfile, plotEpistack, normalizeToMatrix, plotStackProfileLegend

Examples

data("stackepi")
plotStackProfile(stackepi,
                   target_height = 650,
                   zlim = c(0, 1),
                   palette = colorRampPalette(c("white", "dodgerblue", "black")),
                   title = "DNA methylation")


GenEpi-GenPhySE/epistack documentation built on July 27, 2023, 1:09 a.m.