Pathway Analysis Tutorial
MSI-RI
November 11, 2025
What is Pathway Analysis?
Analysis technique to summarize biological pathways/processes/cellular compartments/molecular functions, etc that are changing in an experiment
→ Exploratory!
What is Pathway Analysis?
Typically performed after RNA-seq differential gene expression (DGE) analysis
bmm Overexpression VS Wild Type (baseline)
What is Pathway Analysis?
Typically performed after RNA-seq differential gene expression (DGE) analysis
bmm Overexpression VS Wild Type (baseline)
Nice! *
Significance threshold of FDR < 0.05 yields 112 DEGs!
What is Pathway Analysis?
Typically performed after RNA-seq differential gene expression (DGE) analysis
bmm Overexpression VS Wild Type (baseline)
…
What biological processes are these significant genes related to?
Significance threshold of FDR < 0.05 yields 112 DEGs!
What is Pathway Analysis?
Typically performed after RNA-seq differential gene expression (DGE) analysis
bmm Overexpression VS Wild Type (baseline)
…
What biological processes are these significant genes related to?
I definitely don’t want to look up each gene individually……
Why do we use it?
Why do we use it?
If I knock out or overexpress a gene involved in regulating metabolism, I would expect that gene to be differentially expressed, but I may also expect that all the genes that are regulated by it in a metabolic pathway to also be perturbed by its change in expression.
Why do we use it?
If I knock out or overexpress a gene involved in regulating metabolism, I would expect that gene to be differentially expressed, but I may also expect that all the genes that are regulated by it in a metabolic pathway to also be perturbed by its change in expression.
Where do we find these biological pathways?
Examples of pathway terms from databases
Terms may overlap across databases or may be unique to a database. If there is a particular pathway you are interested in, search the database websites to see if they have it and what genes are contained in it!
Examples of pathway terms from databases
Terms may overlap across databases or may be unique to a database. If there is a particular pathway you are interested in, search the database websites to see if they have it and what genes are contained in it!
Each pathway is defined by a set of genes ("gene set")
Databases: Gene Ontology (GO)
Ontology: a set of concepts and categories in a subject area or domain that shows their properties and the relations between them
Databases: Gene Ontology (GO)
Databases: Gene Ontology (GO)
See: http://geneontology.org/docs/guide-go-evidence-codes/
GO graphs show relationships of terms
Kogelman et al., 2011; https://doi.org/10.1186/1471-2164-12-607
GO graphs show relationships of terms
3 ontologies:
MF, BP, and CC
Kogelman et al., 2011; https://doi.org/10.1186/1471-2164-12-607
GO graphs show relationships of terms
Parent term (General)
Child term (Specific/
Specialized)
Thousands of genes annotated with term
Tens to hundreds of genes annotated with term
Kogelman et al., 2011; https://doi.org/10.1186/1471-2164-12-607
GO graphs show relationships of terms
No over-representation
Kogelman et al., 2011; https://doi.org/10.1186/1471-2164-12-607
Parent term (General)
Child term (Specific/
Specialized)
Thousands of genes annotated with term
Tens to hundreds of genes annotated with term
GO graphs show relationships of terms
GO graphs show relationships of terms
Significantly over-represented in our test set
Kogelman et al., 2011; https://doi.org/10.1186/1471-2164-12-607
Parent term (General)
Child term (Specific/
Specialized)
Tens to hundreds of genes annotated with term
No over-representation
Thousands of genes annotated with term
GO graphs show relationships of terms
GO graphs show relationships of terms
Significantly over-represented in our test set
Kogelman et al., 2011; https://doi.org/10.1186/1471-2164-12-607
Parent term (General)
Child term (Specific/
Specialized)
Thousands of genes annotated with term
Tens to hundreds of genes annotated with term
No over-representation
GO graphs show relationships of terms
No over-representation
Kogelman et al., 2011; https://doi.org/10.1186/1471-2164-12-607
Parent term (General)
Child term (Specific/
Specialized)
Thousands of genes annotated with term
Tens to hundreds of genes annotated with term
GO graphs show relationships of terms
No over-representation
Significantly over-represented in our test set
Side note: Plots such as this can be created using the goplot() function in the clusterProfiler R package.
Kogelman et al., 2011; https://doi.org/10.1186/1471-2164-12-607
Databases: KEGG
https://www.genome.jp/kegg/
KEGG pathview
This is an example of the “Cell Cycle” pathway in KEGG. This was produced using KEGG pathview (pathview package in R)
KEGG pathview
This is an example of the “Cell Cycle” pathway in KEGG. This was produced using KEGG pathview (pathview package in R)
What should we look at?
KEGG pathview
This is an example of the “Cell Cycle” pathway in KEGG. This was produced using KEGG pathview (pathview package in R)
What should we look at?
red = upregulation
green = downregulation
KEGG pathview
This is an example of the “Cell Cycle” pathway in KEGG. This was produced using KEGG pathview (pathview package in R)
What should we look at?
red = upregulation
green = downregulation
Databases: REACTOME
Covers “classical intermediary metabolism, signaling, transcriptional regulation, apoptosis and disease”
REACTOME may* have more disease-related terms and pathways than KEGG and GO.
https://reactome.org/
*: There is a lot of overlap between these databases! Be sure to search through the databases to find the pathways you care about analyzing!
Databases: Molecular Signatures
H - hallmark
C1 - positional gene sets
C2 - curated gene sets
C3 - regulatory target gene sets
C4 - computational gene sets
C5 - ontology gene sets
C6 - oncogenic signature sets
C7 - immunologic signature sets
C8 - cell type signature gene sets
https://www.gsea-msigdb.org/gsea/msigdb
Databases: Molecular Signatures
H - hallmark
C1 - positional gene sets
C2 - curated gene sets
C3 - regulatory target gene sets
C4 - computational gene sets
C5 - ontology gene sets
C6 - oncogenic signature sets
C7 - immunologic signature sets
C8 - cell type signature gene sets
https://www.gsea-msigdb.org/gsea/msigdb/human/genesets.jsp?collection=CGP
Choose a database that fits your needs!
Pathway Analysis Techniques
“Are more genes associated with gene set X than would be expected (over-represented) in my significant genes?”
“Based on the expression responses of all of the genes in my dataset, is a particular set of genes overexpressed (or under) in one treatment group or the other?”
Over-Representation Analysis (ORA)
Over-representation Analysis (ORA)
“Are more genes associated with pathway term X than would be expected (over-represented) in my significant gene set?”
Recall: GO Term Enrichment
No over-representation
Significantly over-represented in our test set
Kogelman et al., 2011; https://doi.org/10.1186/1471-2164-12-607
Side note: Plots such as this can be created using the goplot() function in the clusterProfiler R package.
Statistics of ORA
ID | Description | GeneRatio | BgRatio |
GO:0009617 | response to bacterium | 10/94 | 270/12175 |
List of 94 DEGs
ORA
results
List of all 12445 genes tested
Your data
gene sets to test
Statistics of ORA
GO: 0009617 (5.7e-12)
response to bacterium
10/94 | 270/12175
GO term ID (p-value significance)
GO term description
Fraction of test genes annotated with term
Fraction of reference genes annotated with term
Statistics of ORA: confusion matrix
significant genes:
genes examined:
Term
No Term
10
84
270
10 + 84 = 94 sig. genes
270 + 12175 = 12445 "universe"
12175
Fisher’s Exact Test or Hypergeometric test
GO: 0009617 (5.7e-12)
response to bacterium
10/94 | 270/12175
sig. genes with term
sig. genes without term
examined genes with term
examined genes without term
Statistics of ORA: confusion matrix
Term
No Term
10
84
270
10 / 94 = 0.106
270 / 12445 = 0.022
12175
Fisher’s Exact Test or Hypergeometric test
GO: 0009617 (5.7e-12)
response to bacterium
10/94 | 270/12175
sig. genes with term
sig. genes without term
examined genes with term
examined genes without term
is
this greater than this?
significant genes:
genes examined:
Statistics of ORA
GO term ID (p-value significance)
GO term description
Fraction of test genes annotated with term
Fraction of reference genes annotated with term
GO: 0004298 (5.7e-12)
threonine-type endopeptidase activity
8/69 | 19/11138
Statistics of ORA
test set
reference
Term
No Term
8
61
19
69
11,138
11,119
11,207 total genes in universe
GO: 0004298 (5.7e-12)
threonine-type endopeptidase activity
8/69 | 19/11138
Fisher’s Exact Test or Hypergeometric test
Statistics of ORA
Is this term over-represented in our test set?
test set
reference
Term
No Term
8
61
19
69
11,138
11,119
11,207 total genes in universe
Fisher’s Exact Test or Hypergeometric test
GO: 0004298 (5.7e-12)
threonine-type endopeptidase activity
8/69 | 19/11138
Reading ORA Results Table
ID | Description | GeneRatio | BgRatio | pvalue | p.adjust | qvalue | geneID | Count |
GO:0009617 | response to bacterium | 10/94 | 270/12175 | 4.27E-05 | 0.00732383 | 0.0066823 | Def/LysX/Diedel/TotM/CecA1/TotC/CG30062/Npc2e/TotA/NimC1 | 10 |
GO:0009607 | response to biotic stimulus | 13/94 | 462/12175 | 5.20E-05 | 0.00732383 | 0.0066823 | lectin-37Da/Def/LysX/Diedel/TotM/CecA1/Vago/TotC/Nazo/CG30062/Npc2e/TotA/NimC1 | 13 |
GO:0043207 | response to external biotic stimulus | 13/94 | 462/12175 | 5.20E-05 | 0.00732383 | 0.0066823 | lectin-37Da/Def/LysX/Diedel/TotM/CecA1/Vago/TotC/Nazo/CG30062/Npc2e/TotA/NimC1 | 13 |
GO:0051707 | response to other organism | 13/94 | 462/12175 | 5.20E-05 | 0.00732383 | 0.0066823 | lectin-37Da/Def/LysX/Diedel/TotM/CecA1/Vago/TotC/Nazo/CG30062/Npc2e/TotA/NimC1 | 13 |
GO:0044419 | biological process involved in interspecies interaction between organisms | 4/94 | 489/12175 | 9.27E-05 | 0.01043806 | 0.00952374 | lectin-37Da/Def/LysX/Diedel/TotM/CecA1/Vago/TotC/Nazo/CG30062/Npc2e/TotA/NimC1 | 13 |
GO:0034605 | cellular response to heat | 5/94 | 34/12175 | 0.00012941 | 0.01214314 | 0.01107947 | Hsp70Bb/Hsp70Ba/TotM/TotA | 4 |
GO:0034644 | cellular response to UV | 3/94 | 15/12175 | 0.00018961 | 0.0152499 | 0.01391409 | ninaD/TotC/TotA | 3 |
GO:0009408 | response to heat | 5/94 | 80/12175 | 0.00037527 | 0.02640968 | 0.02409633 | Hsp70Bb/Hsp70Ba/TotM/TotC/TotA | 5 |
GO:0009266 | response to temperature stimulus | 6/94 | 132/12175 | 0.00054079 | 0.03382935 | 0.03086608 | Hsp70Bb/Hsp70Ba/TotM/CG10912/TotC/TotA | 6 |
Visualizating results: dotplot
bmm Overexpression VS Wild Type (baseline)
Visualizating results: cnetplot
cnetplots are network plots that show the relationships of terms with each other and the significant genes that belong to those terms.
Visualizating results: cnetplot
cnetplots are network plots that show the relationships of terms with each other and the significant genes that belong to those terms.
“Hub” node
Other nodes
Visualizating results: emapplot
Comparing/Contrasting Types of ORA Plots
These three plot types are from the clusterProfiler package, specifically. Other pathway analysis tools may have similar or complementary visualizations.
Other ways to use ORA
Gene Set Enrichment Analysis (GSEA)
Gene Set Enrichment Analysis (GSEA)
Gene Set Enrichment Analysis (GSEA)
Gene Set Enrichment Analysis (GSEA)
e.g. Gene set 1 (cell cycle): P53, CycA, CDK1, SCF, SKP2,...
Gene Set Enrichment Analysis (GSEA)
“Based on the expression responses of all of the genes in my dataset, is a particular set of genes overexpressed (or under) in one treatment group or the other?”
Gene set 1 (cell cycle): P53, CycA, CDK1, SCF, SKP2,...
Gene Set Enrichment Analysis (GSEA)
How to rank?
== positive and negative evidence are separated (this graph uses this rank)
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
rank
rank value
Gene Set Enrichment Analysis (GSEA)
Ranked on one of these:
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
Gene Set Enrichment Analysis (GSEA)
Ranked on one of these:
Note: Genes can be tied of rank when they have equal values. Tied genes will be randomly ordered during the statistical test, impacting the GSEA “random walk”. Rerunning the ranking can change the result, so it is good to export the ranked gene list.
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
Gene Set Enrichment Analysis (GSEA)
Response to hypoxia
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
each horizontal line is the position of a "response to hypoxia" gene
Gene Set Enrichment Analysis (GSEA)
Response to hypoxia
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
-log10(p) * sign(logFC)
Ranked Gene List
Gene Set positions
Gene Set Enrichment Analysis (GSEA)
Response to hypoxia
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
-log10(p) * sign(logFC)
Ranked Gene List
Gene Set positions
Score (calculated left to right)
Gene Set Enrichment Analysis (GSEA)
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
-log10(p) * sign(logFC)
Ranked Gene List
Gene Set positions
Score (calculated left to right)
Enrichment Score (ES)
Leading Edge
leading edge genes
Gene Set Enrichment Analysis (GSEA)
Response to hypoxia
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
Gene Set Enrichment Analysis (GSEA)
Response to hypoxia
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
GSEA
Enrichment Score (ES)
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
Leading Edge
Gene Set Enrichment Analysis (GSEA)
Response to hypoxia
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
e.g. -log10(p) * sign(logFC)
GSEA
Enrichment Score (ES)
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
GSEA
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
Enrichment Score (ES)
GSEA
Enrichment Score (ES)
Subramanian et al., 2005; https://doi.org/10.1073/pnas.0506580102
GSEA statistical test: permutation test
https://www.gsea-msigdb.org/gsea/doc/GSEAUserGuideFrame.html
ACTUAL ranked gene list
Same data, but permuted gene names
compute ES score on permuted data,
re-permute many times
label swap
permutation
Calculating significance
Kolmogorov Smirnov permutation test
https://www.pathwaycommons.org/guide/primers/data_analysis/gsea/
actual ES
mean of ES permutations
Calculating significance
Kolmogorov Smirnov test
https://www.pathwaycommons.org/guide/primers/data_analysis/gsea/
GSEA
Normalized Enrichment Score (NES)
https://www.gsea-msigdb.org/gsea/doc/GSEAUserGuideFrame.html
NES =
actual ES
mean (ESs against all permutations of the dataset)
Calculating significance
Kolmogorov Smirnov test
https://www.pathwaycommons.org/guide/primers/data_analysis/gsea/
GSEA
Normalized Enrichment Score (NES)
NES =
actual ES
mean (ESs against all permutations of the dataset)
https://www.gsea-msigdb.org/gsea/doc/GSEAUserGuideFrame.html
GSEA
Normalized Enrichment Score (NES)
NES =
actual ES
mean (ESs against all permutations of the dataset)
https://www.gsea-msigdb.org/gsea/doc/GSEAUserGuideFrame.html
Examples of GSEA plots
Examples of GSEA plots
Test vs control
High in test
Low in test
Examples of GSEA plots
Leading edge
Leading edge
Test vs control
High in test
Low in test
GSEA Results Table
Table of significant pathway terms
Example table from clusterProfiler wrapper
GSEA Results Table
# genes associated with pathway term
GSEA Results Table
Enrichment score (ES)
GSEA Results Table
Normalized enrichment score (NES)
(influenced by the permutation method, the number of permutations, and the size of the expression set)
GSEA Results Table
Nominal p-value
(estimates the statistical significance of the enrichment score for a single gene set)
GSEA Results Table
Family Wise Error Rate (FWER)
(a more conservatively estimated probability that the normalized enrichment score represents a false positive finding)
GSEA Results Table
False Discovery Rate (FDR)
(estimated probability that a gene set with a given NES represents a false positive finding)
GSEA Results Table
Rank at Max
(position in the ranked list at which the maximum enrichment score occurred)
GSEA Results Table
Leading edge subset statistics
(% tags = % gene set hits in leading edge (coverage of GS)
% list = % ranked genes in leading edge (coverage of ranked list)
% signal = )
GSEA Results Table
Leading edge subset statistics
% tags = % gene set hits in leading edge (coverage of GS)
% list = % ranked genes in leading edge (coverage of ranked list)
% signal: complicated, but
Directly proportional to % tags
Inversely proportional to % list
Inversely proportional to gene set size
Leading edge
“% Signal” Example
“Tag %” is the percentage of gene set hits in leading edge (coverage of GS), “Gene %” is the percentage of ranked genes in leading edge (called “list” in the GSEA results table), N is the size of your ranked list, and Nh is the size of the gene set being tested.
For “REACTOME_DNA_REPAIR” (tag=39%,list=20%):
When to use ORA vs. GSEA:
ORA | GSEA |
have an unranked list of genes, no statistics | have a statistical ranking for all genes tested |
have a moderate number of DEGs | have no DEGs (but do have logFC) |
you only care about your small gene list | you're not sure what of your ranked genes might be important |
When to use GSEA:
Factors to consider when running GSEA
GSEA
GSEA paper: https://www.pnas.org/doi/10.1073/pnas.0506580102
-6.41
6.16
-5.49
5.49
…
…
…
-log(FDR) * direction of FC
Next: A Hands-on Guide (approx 50 minutes)
The later section of this tutorial will show you how to use a MSI-developed script for pathway enrichment analysis (ORA and GSEA) and interpreting the results.
This script is run from the command line.
A command line refresher module will be included