Draws 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).
PlotAnnotatedHeatmap(
object,
features,
sort.by,
anno.var = NULL,
anno.colors = NULL,
assay = NULL,
layer = "scale.data",
hm.limit = c(-2, 0, 2),
hm.colors = c("#4575b4", "white", "#d73027"),
cluster.rows = FALSE,
cluster.columns = FALSE,
show.column.names = FALSE,
row.font.size = 12,
...
)A Heatmap-class object, which draws when
printed. For the horizontal, bottom-placed legend layout use
ComplexHeatmap::draw(ht, heatmap_legend_side = "bottom").
A Seurat object.
Character vector of features (rows of the heatmap). Features absent from the requested layer are dropped with a warning.
One or more metadata column names used to order the cells (columns of the heatmap). Multiple names are applied in order as tie-breakers.
Optional character vector of metadata column names, each drawn
as a top annotation bar. NULL (default) draws no annotation.
Optional list of colors for anno.var, one element per
variable (named by variable, or positionally matched to anno.var). For a
categorical variable supply at least one color per level; for a numeric variable
supply exactly three colors (min, median, max). NULL entries use defaults.
Assay to pull expression from. Defaults to the object's default assay.
Layer to pull expression from. Default is "scale.data".
Numeric vector of three breakpoints for the heatmap color
gradient (low, mid, high). Default is c(-2, 0, 2).
Three colors mapped to hm.limit. Values beyond the range
saturate to the endpoint colors. Default is a blue-white-red gradient.
Whether to cluster rows (features). Default is FALSE.
Whether to cluster columns (cells). Default is FALSE;
clustering overrides the sort.by ordering.
Whether to show cell names. Default is FALSE.
Font size for row (feature) names. Default is 12.
Additional arguments passed to Heatmap.
This is an independent implementation whose interface is inspired by
Scillus::plot_heatmap; it does not reuse that package's code.
if (FALSE) {
PlotAnnotatedHeatmap(
object = sample_obj,
features = top_genes,
sort.by = "pseudotime",
anno.var = "Disease"
)
}
Run the code above in your browser using DataLab