do_SCExpressionHeatmap() | Single-cell expression heatmaps

Single-cell expression heatmaps display gene expression at individual cell resolution. Cells are ordered by group, and optional metadata tracks can be added alongside the main heatmap. Inspired by Seurat’s DoHeatmap.


Basic usage

genes <- c("CDC25C", "KIF18B", "KIF14", "CENPE",
           "DNAAF1", "ADGB", "CFAP61", "CFAP157",
           "KCNQ5", "MEOX2", "MBP", "SNTG1",
           "S100A1", "MGP", "TNNT1", "H2AFJ")

p <- SCpubr::do_SCExpressionHeatmap(sample = sample,
                                    features = genes)
p


Add metadata tracks

Display categorical metadata alongside the expression heatmap:

p <- SCpubr::do_SCExpressionHeatmap(
  sample          = sample,
  features        = genes,
  metadata        = c("Annotation", "subtype")
)
p


Clustering

Cluster genes

p <- SCpubr::do_SCExpressionHeatmap(sample = sample,
                                    features = genes,
                                    cluster = TRUE)
p


Subsampling

For large datasets, subsample cells to reduce memory and improve rendering:

p <- SCpubr::do_SCExpressionHeatmap(sample = sample,
                                    features = genes,
                                    subsample = 5)
p


Proportional sizing

Equal space per group (default)

p <- SCpubr::do_SCExpressionHeatmap(sample = sample,
                                    features = genes,
                                    proportional.size = TRUE)
p

Size proportional to cell count

p <- SCpubr::do_SCExpressionHeatmap(sample = sample,
                                    features = genes,
                                    proportional.size = FALSE)
p


Interpolation

Smooth the heatmap for rasterized output:

p <- SCpubr::do_SCExpressionHeatmap(sample = sample,
                                    features = genes,
                                    interpolate = TRUE)
p


Parameter reference

Note

For parameters shared across many functions (color palettes, typography, legend styling), see Shared features.

Core parameters

Parameter Description Default
features Genes to display

Metadata tracks

Parameter Description Default
metadata Metadata columns to display NULL
metadata.colors Named list of colors for metadata NULL

Layout

Parameter Description Default
proportional.size Equal space per group TRUE
main.heatmap.size Main heatmap proportion (0-1) 0.95
strip.spacing Space between group strips 10
strip.text.angle Strip label rotation 0

Subsampling & clustering

Parameter Description Default
subsample Max cells per group NA
cluster Cluster genes TRUE
features.order Custom gene order NULL
interpolate Smooth heatmap FALSE

See also