heatmapEnrichment: Visualize Enrichment Value Summaries Using Heatmaps

View source: R/heatmapEnrichment.R

heatmapEnrichmentR Documentation

Visualize Enrichment Value Summaries Using Heatmaps

Description

This function allows to the user to examine the heatmap with the mean enrichment values by group. The heatmap will have the gene sets as rows and columns will be the grouping variable.

Usage

heatmapEnrichment(
  input.data,
  assay = NULL,
  group.by = NULL,
  gene.set.use = "all",
  cluster.rows = FALSE,
  cluster.columns = FALSE,
  facet.by = NULL,
  scale = FALSE,
  summary.stat = "mean",
  palette = "inferno"
)

Arguments

input.data

Output of escape.matrix or a single‑cell object previously processed by runEscape.

assay

Name of the assay holding enrichment scores when 'input.data' is a single‑cell object. Ignored otherwise.

group.by

Metadata column plotted on the *x*‑axis. Defaults to the Seurat/SCE 'ident' slot when 'NULL'.

gene.set.use

Vector of gene‑set names to plot, or "all" (default) to show every available gene set.

cluster.rows, cluster.columns

Logical; if TRUE, rows/columns are ordered by Ward‑linkage hierarchical clustering (Euclidean distance).

facet.by

Optional metadata column used to facet the plot.

scale

If TRUE, Z‑transforms each gene‑set column **after** summarization.

summary.stat

Optional method used to summarize expression within each group. One of: "mean" (default), "median", "max", "sum", or "geometric".

palette

Character. Any palette from hcl.pals.

Value

A ggplot2 object.

Examples

gs <- list(Bcells = c("MS4A1", "CD79B", "CD79A", "IGH1", "IGH2"),
           Tcells = c("CD3E", "CD3D", "CD3G", "CD7","CD8A"))
           
pbmc <- SeuratObject::pbmc_small |>
  runEscape(gene.sets = gs, min.size = NULL)
  
heatmapEnrichment(pbmc, assay = "escape", palette = "viridis")


ncborcherding/escape documentation built on June 12, 2025, 1 p.m.