Inferensys

Glossary

Single-Sample GSEA (ssGSEA)

Single-Sample GSEA (ssGSEA) is an extension of Gene Set Enrichment Analysis that calculates separate enrichment scores for each pairing of a sample and gene set, enabling pathway activity inference for individual samples.
Developer testing AI inference on mobile phone in hand, laptop with optimization code visible, casual tech review moment.
PATHWAY ANALYSIS

What is Single-Sample GSEA (ssGSEA)?

An extension of Gene Set Enrichment Analysis that calculates separate enrichment scores for each pairing of a sample and gene set, enabling pathway activity inference for individual samples.

Single-sample GSEA (ssGSEA) is a rank-based, non-parametric method that projects a single gene expression profile onto a space of gene set enrichment scores, producing a pathway activity score for each individual sample without requiring a comparative phenotype. Unlike canonical GSEA, which computes an enrichment score relative to a two-class phenotype contrast, ssGSEA computes a separate enrichment score (ES) for each sample–gene set pair by ordering genes by absolute expression within that sample and evaluating the empirical cumulative distribution functions of the genes in the set versus those outside it.

The algorithm generates a normalized enrichment score per sample, enabling downstream analyses such as clustering, survival modeling, or differential pathway activity comparisons across heterogeneous cohorts. By decoupling enrichment from group-level contrasts, ssGSEA is particularly suited for patient stratification, single-cell transcriptomics, and studies where biological variation within a condition is the primary object of investigation rather than a nuisance variable.

SINGLE-SAMPLE ENRICHMENT

Key Features of ssGSEA

Single-Sample GSEA (ssGSEA) extends traditional GSEA by calculating independent enrichment scores for each sample-gene set pair, enabling pathway activity inference without requiring defined phenotypic groups.

01

Sample-Wise Normalization

ssGSEA ranks genes within a single sample by absolute expression and compares the empirical cumulative distribution functions (ECDFs) of genes inside and outside the gene set. This produces a Normalized Enrichment Score (NES) per sample, independent of other samples in the cohort. Unlike traditional GSEA, which requires phenotype labels to rank genes by differential expression, ssGSEA uses the sample's own expression profile as the ranking metric.

  • Input: A single sample's expression vector and a gene set
  • Output: One enrichment score per sample-gene set pair
  • Key distinction: No phenotype permutation required; null distributions are built from gene-level randomization
02

Rank-Based ECDF Calculation

The core algorithm walks down a gene list ranked by expression values within a single sample. It computes two empirical cumulative distribution functions: one for genes in the target gene set and one for genes outside it. The enrichment score is the sum of differences between these ECDFs, weighted by the rank position.

  • Genes are ranked from highest to lowest expression
  • A running sum statistic increases when encountering a gene set member and decreases for non-members
  • The maximum deviation from zero becomes the raw enrichment score
  • This approach captures coordinated upregulation or downregulation of pathway members within a single sample
03

Phenotype-Free Analysis

ssGSEA eliminates the requirement for predefined class labels (e.g., tumor vs. normal). This makes it ideal for exploratory analyses where phenotypes are unknown, heterogeneous, or continuous. Each sample becomes its own analytical unit, enabling pathway-level comparisons across large cohorts without binary grouping.

  • Use cases: Tumor subtype discovery, drug response prediction, single-cell pathway analysis
  • Advantage: Detects pathway activity gradients rather than just on/off states
  • Integration: Resulting sample-by-pathway matrices can feed into clustering algorithms or machine learning classifiers
04

Gene Set Variation Analysis (GSVA) Comparison

ssGSEA and GSVA are both single-sample methods but differ in their statistical frameworks. ssGSEA uses a rank-based ECDF approach, while GSVA employs a non-parametric kernel estimation of the cumulative density function. GSVA applies a Kolmogorov-Smirnov-like random walk, whereas ssGSEA uses a weighted running sum.

  • ssGSEA: Weighted ECDF difference, sensitive to the extremes of the ranked list
  • GSVA: Kernel-smoothed CDF estimation, more robust to outliers
  • Both produce: Sample-level pathway enrichment scores suitable for downstream modeling
  • Selection criteria: ssGSEA for detecting strong pathway activation; GSVA for noisy or sparse data
05

Downstream Machine Learning Integration

The sample-by-pathway matrix generated by ssGSEA serves as a feature matrix for predictive modeling. Each column represents a biological pathway, and each row represents a sample. This transforms high-dimensional gene expression data (~20,000 genes) into a biologically interpretable feature space (~50–5,000 pathways).

  • Classification: Train models to predict drug response or disease subtype using pathway scores as features
  • Clustering: Apply hierarchical clustering or t-SNE to pathway enrichment profiles for patient stratification
  • Survival analysis: Use pathway scores as continuous covariates in Cox proportional hazards models
  • Biomarker discovery: Identify pathways whose ssGSEA scores significantly differ between outcome groups
06

Leading-Edge Analysis per Sample

ssGSEA identifies the leading-edge subset—the core genes driving the enrichment signal—within each individual sample. This reveals which specific pathway members are most responsible for the observed activity, enabling fine-grained mechanistic interpretation. Unlike traditional GSEA where the leading edge is defined across a phenotype contrast, ssGSEA pinpoints sample-specific pathway drivers.

  • Output: A binary mask indicating which genes in the set contribute to the maximum enrichment score
  • Application: Identifying patient-specific therapeutic targets within activated oncogenic pathways
  • Visualization: Heatmaps of leading-edge membership across samples reveal heterogeneity in pathway utilization
METHOD COMPARISON

ssGSEA vs. Traditional GSEA vs. GSVA

Comparison of enrichment analysis methodologies for gene set activity inference

FeaturessGSEATraditional GSEAGSVA

Sample resolution

Single-sample

Group comparison

Single-sample

Requires phenotype labels

Output per sample

Enrichment score per sample-gene set pair

Enrichment score per phenotype contrast

Enrichment score per sample-gene set pair

Ranking method

Empirical CDF of gene expression within sample

Signal-to-noise ratio across phenotype groups

Kernel estimation of CDF across samples

Null distribution estimation

Gene set permutation

Phenotype permutation

Gene set permutation

Handles small sample sizes

Suitable for unsupervised analysis

Computational complexity

O(n × m × k)

O(n × m)

O(n × m × k)

SINGLE-SAMPLE GSEA

Frequently Asked Questions

Clear, technically precise answers to the most common questions about the ssGSEA algorithm, its interpretation, and its application in precision medicine.

Single-sample Gene Set Enrichment Analysis (ssGSEA) is a projection-based extension of the original GSEA algorithm that calculates a separate enrichment score for each individual sample-gene set pairing, rather than requiring a comparison between two distinct biological phenotypes. While standard GSEA ranks genes by a differential expression metric (e.g., signal-to-noise ratio) derived from a class comparison and produces a single enrichment result per gene set for the entire experiment, ssGSEA ranks genes within a single sample based on their absolute expression values. This fundamental difference enables pathway activity inference on a per-sample basis, making it suitable for unsupervised analyses, patient stratification, and correlating pathway activity with clinical outcomes without pre-defined group labels. The method treats each sample as an independent observation, generating a matrix of enrichment scores (samples × gene sets) that can be directly used as input for machine learning classifiers or survival models.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.