plotEpistack | R Documentation |
Given a list of genomic regions,
epigenetic signals surrounding these regions, and a score for each regions,
plot epigenetic stacks depending on the score. An optional bin
column
allow the grouping of several genomic regions to produce average profiles per
bins.
plotEpistack(
rse,
assays = NULL,
tints = "gray",
titles = NULL,
legends = "",
main = NULL,
x_labels = c("Before", "Anchor", "After"),
zlim = c(0, 1),
ylim = NULL,
metric_col = "exp",
metric_title = "Metric",
metric_label = "metric",
metric_ylab = NULL,
metric_transfunc = function(x) x,
bin_palette = colorRampPalette(c("#DF536B", "black", "#61D04F")),
npix_height = 650,
n_core = 1,
high_mar = c(2.5, 0.6, 4, 0.6),
low_mar = c(2.5, 0.6, 0.3, 0.6),
error_type = c("ci95", "sd", "sem"),
reversed_z_order = FALSE,
rel_widths = c(score = 0.35, bin = 0.08, assays = 0.35),
rel_heights = c(1, 0.14, 0.3),
patterns = NULL,
...
)
rse |
a RangedSummarizedExperiment input. Aletrnatively: can be a
GRanges object
(for backward compatibility, |
assays |
specify the name(s) and order of assay(s) to plot. A vector of
names that should match |
tints |
a vector of colors to tint the heatmaps. Can alos be a
function returning |
titles |
titles of each heatmap. Defaults to |
legends |
legend names for the epistacks. |
main |
Main title for the figure. |
x_labels |
a character vector of length 3 used as x-axis labels. |
zlim |
the minimum and maximum z values the heatmap.
Format: |
ylim |
limits of the y axis for bottom plots. |
metric_col |
a character, name of a column in |
metric_title |
title to be display on the leftmost plots. |
metric_label |
label of the leftmost plots. |
metric_ylab |
y axis label of the top left plot. |
metric_transfunc |
a function to transform value of |
bin_palette |
A vector of colors, or a function that returns
a palette of |
npix_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 heatmaps |
n_core |
number of core used to speedup the martrix resizing. |
high_mar |
a vector of numerical values corresponding to the margins of the top figures. c(bottom, left, top, right) |
low_mar |
a vector of numerical values corresponding to the margins of the bottom figures. c(bottom, left, top, right) |
error_type, |
error_type, can be either |
reversed_z_order |
For the bottom panels: should the z-order of the curves be reversed (i.e. first or last bin on top)? |
rel_widths |
A named vector of three elements of relative panel widths:
|
rel_heights |
A vector of three elements of relative panel heights.
Default to |
patterns |
only if |
... |
Arguments to be passed to |
This function produce a comprehensive figure including epigenetic heatmaps
and average epigenetic profiles from a well formated
RangedSummarizedExperiment
object
with expected rowData metadata columns.
It scales resonably well up to hundreds of
thousands of genomic regions.
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 GRanges
used as a rowData in the input RangedSummarizedExperiment object
(hereafter rse
).
Anchors are plotted from top to bottom in the same order as in rse
.
One should sort rse
before plotting if needed.
rse
's rowData should have a metric column that is used in the
leftmost plots.
The name of the metric column must be specified to metric_col
.
The metric can be transformed before plotting if needed using the
metric_transfunc
parameter.
The matrix or matrices used to display the heatmap(s) should be passed as
assay(s) in rse
. Such matrix can be obtained using
EnrichedHeatmap::normalizeToMatrix()
for example. The assay
names are then specified through assays
.
If an optionnal bin
column is present in rse
's rowData,
it will be used
to group genomic regions to performed average profile per bins in the bottom
plots.
Epistack are multipanel plots build using layout()
. Margins for the
panels can be specified using high_mar
and low_mar
parameters
if needed, especially to avoid text overlaps. The default value should
be appropriate in most situations. Individual component can be plotted
using severa epistack
functions such has plotStackProfile()
or plotAverageProfile()
.
Plotting more than > 1000 regions can lead to overplotting
issued as well as some plotting artefacts (such as horizontal white strips).
Both issues can be resolved with fidling with the npix_height
parameter. npix_height
should be smaller than the number of regions,
and in the same order of magnitude of the final heatmap height in pixels.
Last minutes call to the redimMatrix()
function will hapen before
plotting using npix_height
as target height. Parameter n_core
is passed to redimMatrix()
to speed up the down-scaling.
The input can also be a GRanges
object for backward compatibility. See
GRanges2RSE
. patterns
would then be required.
Display a plot.
plotStackProfile
,
plotAverageProfile
,
redimMatrix
,
normalizeToMatrix
,
addMetricAndArrangeGRanges
,
addBins
data("stackepi")
plotEpistack(stackepi,
metric_col = "exp",
ylim = c(0, 1),
metric_transfunc = function(x) log10(x+1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.