Gene set enrichment analysis (GSEA) is one of the most cited methods in genomics — yet most researchers apply it as a black box. What does the enrichment score actually measure? When should you reach for GSEA instead of a simple gene list overlap test? And what happens when you apply pathway enrichment not to differential expression between two groups, but to morphological clusters defined purely by how tumors look under a microscope? HistoAtlas computes pathway enrichment across 10 pan-cancer morphological clusters spanning 5,877 TCGA samples — revealing which biological programs distinguish tumors that share visual features but originate from different organs.
What Is Gene Set Enrichment Analysis?
Traditional differential expression analysis tests genes one at a time: is BRCA1 up or down? Is TP53 significant? This approach works well for strong, isolated signals. But biological pathways rarely hinge on a single gene. A tumor that activates its epithelial-mesenchymal transition (EMT) program does not flip one gene — it shifts dozens of genes, each modestly, in a coordinated direction [1].
Gene set enrichment analysis addresses exactly this problem. Instead of asking which individual genes differ, GSEA asks: do the genes in a predefined biological pathway show a coordinated shift between two conditions? The method was introduced by Subramanian et al. in 2005 [1] and has since accumulated over 40,000 citations, making it the standard approach for pathway-level inference in genomics.
The intuition is straightforward. If you rank all measured genes from most upregulated to most downregulated, pathway members should not scatter randomly across that list. If a pathway is active, its member genes cluster toward one end. GSEA quantifies exactly how non-random that clustering is.
How Gene Set Enrichment Analysis Works
The GSEA algorithm follows five steps, each building on the last.
Step 1 — Rank all genes by a signal. This could be a fold change between tumor and normal, a correlation with a phenotype, or any continuous metric. The ranking captures the full gradient of expression, not just the “significant” genes.
Step 2 — Walk down the ranked list. For each gene, GSEA checks: is this gene a member of the pathway being tested? If yes, the running sum increases. If no, it decreases. The magnitude of the increase is weighted by the gene’s signal strength — a strongly upregulated gene set member counts more than one with a modest change.
Step 3 — Record the enrichment score (ES). The ES is the maximum deviation of the running sum from zero. A large positive ES means pathway members concentrate at the top of the ranked list (pathway upregulated). A large negative ES means they concentrate at the bottom (pathway downregulated).
Step 4 — Normalize across gene sets. Different pathways contain different numbers of genes, which affects the expected ES under the null. GSEA normalizes ES to a normalized enrichment score (NES) to enable comparison across pathways.
Step 5 — Assess significance. GSEA generates a null distribution by permuting sample labels (or gene labels) and recomputing the ES thousands of times. The false discovery rate (FDR q-value) controls for multiple testing across all pathways tested simultaneously.
GSEA vs. Over-Representation Analysis
A common alternative to GSEA is over-representation analysis (ORA), sometimes called a hypergeometric test or Fisher’s exact test on gene lists. The difference is fundamental.
ORA takes a binary input: a list of “significant” genes (those passing an arbitrary p-value or fold-change threshold). It then asks whether pathway members are over-represented in that list compared to chance. This approach is fast and easy to interpret, but it discards all magnitude information and depends entirely on where you draw the significance cutoff [5].
GSEA, by contrast, uses the entire ranked list — no threshold needed. Genes that are modestly but consistently shifted in one direction still contribute to the enrichment score. This makes GSEA more sensitive to coordinated, subtle changes — precisely the kind of signal that characterizes complex programs like immune activation or metabolic reprogramming.
| Dimension | ORA | GSEA |
|---|---|---|
| Input | Gene list (binary) | Ranked gene list (continuous) |
| Threshold | Required (arbitrary) | Not required |
| Magnitude | Discarded | Preserved |
| Sensitivity | Strong, isolated effects | Coordinated, subtle effects |
| Speed | Fast | Moderate (permutation-based) |
When your signal involves a handful of dramatically altered genes, ORA works well. When the biology operates through coordinated shifts across many genes — as most cancer programs do — GSEA is the right tool.
How HistoAtlas Uses Pathway Enrichment
HistoAtlas takes pathway analysis in an unusual direction. Rather than comparing molecular subtypes or treatment groups, HistoAtlas asks: do tumors that share morphological features also share active biological pathways?
The approach works in three steps. First, 5,877 TCGA whole-slide images are characterized by 41 quantitative histomic features — metrics capturing immune cell density, stromal architecture, nuclear morphology, and tissue organization. Second, slides are clustered into 10 pan-cancer morphological groups using k-means on these features. Third, for each cluster, pathway enrichment is computed by comparing ssGSEA pathway scores inside vs. outside the cluster using Mann-Whitney U tests with Cliff’s delta effect sizes and Benjamini-Hochberg correction.
The result is a pathway enrichment map across 21 curated biological programs for each of the 10 morphological clusters.
Data: HistoAtlas / TCGA (n=5,877 slides across 10 clusters)
The heatmap reveals that morphology is not molecularly arbitrary. Clusters enriched for immune cell features (C4, C3) show strong positive enrichment for immune pathways (T-cell, cytotoxic, checkpoint). Clusters characterized by high tissue uniformity (C2, C8) are depleted in proliferation and DNA repair. The correspondence between visual phenotype and molecular program is striking — and it emerges without any molecular data being used in the clustering itself.
Live Example: The Immune-Hot Cluster
Cluster 4 (“Immune-Hot, Lymph-Proximal”) contains 196 slides, predominantly from thymic carcinomas (THYM, 76%) with contributions from BRCA, THCA, CESC, and HNSC. Its pathway enrichment profile is the most polarized in the atlas.
Data: HistoAtlas / TCGA (n=196 in cluster, 5,681 out of cluster)
The immune activation signal is unambiguous. T-cell pathway enrichment reaches a Cliff’s delta of
+0.83 Cliff's d (T-cell pathway, n=196 vs. 5,681)with cytotoxic and B-cell programs close behind. Checkpoint signaling (d=+0.56) and costimulatory pathways (d=+0.35) are both significantly enriched, painting a picture of active anti-tumor immunity.
Equally informative is what is depleted. Stemness (d=-0.59), hypoxia (d=-0.62), and angiogenesis (d=-0.52) are all strongly suppressed. This pattern — high immune activation paired with low stemness and hypoxia — is consistent with well-perfused, immune-infiltrated tumors that have not undergone the mesenchymal shift associated with immune evasion.
The fact that this coherent molecular signature emerges from morphology alone underscores a central insight: tumor architecture encodes molecular state. Pathologists have long recognized that tumor appearance carries prognostic information. Pathway enrichment analysis quantifies exactly which molecular programs that appearance reflects.
Explore the full enrichment profile on the Cluster 4 detail page , or browse all 10 clusters on the HistoAtlas Explorer .
Explore Further on HistoAtlas
Every morphological cluster in HistoAtlas includes a dedicated pathway enrichment panel — the same analysis shown above, computed for all 10 pan-cancer clusters and for per-cancer-type clusters where sample sizes allow. You can compare immune, proliferative, and signaling programs side by side, drill into the underlying gene lists, and connect pathway enrichment back to histomic features and survival outcomes.
Start with the pan-cancer atlas view to see how clusters distribute across the morphological embedding. Select any cluster to view its full pathway enrichment profile. For the statistical methodology behind these analyses, see the HistoAtlas Methods page .
References
- Subramanian A, Tamayo P, Mootha VK, et al. Gene set enrichment analysis: A knowledge-based approach for interpreting genome-wide expression profiles. PNAS 102(43):15545–15550, 2005.
- Liberzon A, Birger C, Thorvaldsdottir H, et al. The Molecular Signatures Database Hallmark Gene Set Collection. Cell Systems 1(6):417–425, 2015.
- Barbie DA, Tamayo P, Boehm JS, et al. Systematic RNA interference reveals that oncogenic KRAS-driven cancers require TBK1. Nature 462:108–112, 2009.
- Hanzelmann S, Castelo R, Guinney J. GSVA: gene set variation analysis for microarray and RNA-Seq data. BMC Bioinformatics 14:7, 2013.
- Geistlinger L, Csaba G, Zimmer R. Toward a gold standard for benchmarking gene set enrichment analysis. Briefings in Bioinformatics 22(1):545, 2021.