View source: R/gseaEnrichment.R
gseaEnrichment | R Documentation |
Produces the familiar two-panel GSEA graphic—running enrichment score (RES) plus a “hit” rug—for a **single gene-set** evaluated across multiple biological groups (clusters, conditions, samples, ...).
gseaEnrichment(
input.data,
gene.set.use,
gene.sets,
group.by = NULL,
summary.fun = "mean",
p = 1,
nperm = 1000,
rug.height = 0.02,
digits = 2,
BPPARAM = NULL,
palette = "inferno"
)
input.data |
A Seurat object or a SingleCellExperiment. |
gene.set.use |
Character(1). Name of the gene set to display. |
gene.sets |
A named list of character vectors, the result of [getGeneSets()], or the built-in data object [escape.gene.sets]. |
group.by |
Metadata column. Defaults to the Seurat/SCE 'ident' slot when 'NULL'. |
summary.fun |
Method used to collapse expression within each group **before** ranking: one of '"mean"' (default), '"median"', '"max"', '"sum"', or '"geometric"'. |
p |
Weighting exponent in the KS statistic (classical GSEA uses 'p = 1'). |
nperm |
Integer >= 0. Gene-label permutations per group (default 1000). '0' value will skip NES/*p* calculation. |
rug.height |
Vertical spacing of the hit rug as a fraction of the y-axis (default '0.02'). |
digits |
Number of decimal places displayed for ES in the legend (default '2'). |
BPPARAM |
A BiocParallel parameter object describing the parallel backend. |
palette |
Character. Any palette from |
**Algorithm (Subramanian _et al._, PNAS 2005)** 1. Within every group, library-size-normalise counts to CPM. 2. Collapse gene expression with 'summary.fun' (mean/median/…). 3. Rank genes (descending) to obtain one ordered list per group. 4. Compute the weighted Kolmogorov–Smirnov running score (weight = \|stat\|^*p*). 5. ES = maximum signed deviation of the curve.
A single 'patchwork'/'ggplot2' object
escape.matrix
, densityEnrichment
pbmc_small <- SeuratObject::pbmc_small
gs <- list(Bcells = c("MS4A1", "CD79B", "CD79A", "IGH1", "IGH2"),
Tcells = c("CD3E", "CD3D", "CD3G", "CD7","CD8A"))
gseaEnrichment(pbmc_small,
gene.set.use = "Bcells",
gene.sets = gs,
group.by = "groups",
summary.fun = "mean",
digits = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.