Plot an annotated expression heatmap of features across cells
Source:R/scslide_de.R
PlotAnnotatedHeatmap.RdDraws a features-by-cells expression heatmap with one or more metadata
annotation bars on top, built on Heatmap. Columns
are ordered by a chosen metadata variable (e.g. a trajectory value) independently
of the annotation bars, which makes it suited to trajectory / differential-expression
heatmaps where cells are ordered along a continuous axis while still displaying a
categorical annotation (something the grouped DoHeatmap cannot do).
Arguments
- object
A Seurat object.
- features
Character vector of features (rows of the heatmap). Features absent from the requested layer are dropped with a warning.
- sort.by
One or more metadata column names used to order the cells (columns of the heatmap). Multiple names are applied in order as tie-breakers.
- anno.var
Optional character vector of metadata column names, each drawn as a top annotation bar.
NULL(default) draws no annotation.- anno.colors
Optional list of colors for
anno.var, one element per variable (named by variable, or positionally matched toanno.var). For a categorical variable supply at least one color per level; for a numeric variable supply exactly three colors (min, median, max).NULLentries use defaults.- assay
Assay to pull expression from. Defaults to the object's default assay.
- layer
Layer to pull expression from. Default is
"scale.data".- hm.limit
Numeric vector of three breakpoints for the heatmap color gradient (low, mid, high). Default is
c(-2, 0, 2).- hm.colors
Three colors mapped to
hm.limit. Values beyond the range saturate to the endpoint colors. Default is a blue-white-red gradient.- cluster.rows
Whether to cluster rows (features). Default is
FALSE.- cluster.columns
Whether to cluster columns (cells). Default is
FALSE; clustering overrides thesort.byordering.- show.column.names
Whether to show cell names. Default is
FALSE.- row.font.size
Font size for row (feature) names. Default is 12.
- ...
Additional arguments passed to
Heatmap.
Value
A Heatmap-class object, which draws when
printed. For the horizontal, bottom-placed legend layout use
ComplexHeatmap::draw(ht, heatmap_legend_side = "bottom").