Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Pathway Analysis

KTH JupyterHub Open In Colab Binder

Introduction

A typical output from a high-throughput experiment is a list of genes, transcripts, or proteins. Given this list, one might want to identify common functions among these analytes. Here, pathway analysis has become a go-to method for associating functions with experimental findings. A pathway represents a set of biochemical reactions and interactions that take place within a cell or organism, involving metabolites, genes, and proteins. Understanding these pathways allows researchers to link molecular changes to phenotypic outcomes, such as disease states or responses to treatment.

Pathway Databases

Examples of commonly used pathway databases include KEGG, Reactome, WikiPathways, and BioCyc, which provide curated pathways for metabolic and signaling processes across various organisms. For specialized needs, researchers use databases like MetaCyc for metabolic pathways, SIGNOR for signaling networks, and CTD for studying toxicogenomic interactions. Although not formally a pathway database, Gene Ontology (GO) is often utilized alongside pathway-based methods to identify enriched biological processes, cellular components, and molecular functions from gene or protein lists.

KEGG

The Kyoto Encyclopedia of Genes and Genomes (KEGG) is a manually curated database that integrates genomic, chemical, and systemic functional information into comprehensive pathway maps, including metabolic and regulatory pathways, drawn as graphical diagrams of the molecular interactions.

Reactome

Reactome is a detailed, open-source, manually curated knowledge base that provides information about cellular processes like metabolic reactions and immune system functions. Reactome focuses on the relationships between genes, proteins, and other molecules, offering more granular details about molecular interactions than KEGG.

Over-Representation Analysis (ORA)

One of the basic approaches to pathway analysis is Over-Representation Analysis (ORA). ORA identifies pathways that are statistically overrepresented in a list of differentially expressed genes or proteins compared to what would be expected by chance.

Fisher’s Exact Test

A common statistical method used for ORA is Fisher’s exact test, which is designed to determine if there are nonrandom associations between two categorical variables. In the context of pathway analysis, Fisher’s exact test can be used to assess whether the number of genes from a given pathway in the input list is significantly larger than what would be expected by random chance. The null hypothesis in this context is that a gene in the pathway is no more likely to appear in the gene list than a gene outside the pathway, i.e. that the odds ratio ad/bcad/bc equals 1.

Consider the following contingency table:

In PathwayNot in PathwaySum
In Gene Listaabba+ba+b
Not in Gene Listccddc+dc+d
All Genesa+ca+cb+db+da+b+c+da+b+c+d

We expect the overlap between the pathway and a gene list, as a fraction of all genes, to be just the product of the fraction of genes in the pathway and the fraction of genes in the gene list. Any excess over that fraction is an enrichment. To calculate the significance of such an enrichment, we start by considering the number of combinations of ways to pick genes from the input list and pathway using choose notation. The probability of observing a particular outcome can be expressed as:

P(X=a)=(a+ba)(c+dc)(a+b+c+da+c)P(X = a) = \frac{\binom{a+b}{a} \binom{c+d}{c}}{\binom{a+b+c+d}{a+c}}

Expanding the binomial expressions, we have:

P(X=a)=(a+b)!a!b!⋅(c+d)!c!d!(a+b+c+d)!(a+c)!(b+d)!P(X = a) = \frac{\frac{(a+b)!}{a! b!} \cdot \frac{(c+d)!}{c! d!}}{\frac{(a+b+c+d)!}{(a+c)! (b+d)!}}

Simplifying this further, we get:

P(X=a)=(a+b)!(c+d)!(a+c)!(b+d)!a!b!c!d!(a+b+c+d)!P(X = a) = \frac{(a+b)! (c+d)! (a+c)! (b+d)!}{a! b! c! d! (a+b+c+d)!}

This represents the probability of picking aa genes in, and bb genes not in the pathway from the gene list. The pp value is the probability of an overlap at least as large as the observed one, given the row and column sums of the table. We therefore sum over the observed outcome and all outcomes that are more extreme in the direction of over-representation:

p=∑x≥aP(X=x)p = \sum_{x \geq a} P(X = x)
Source
<Figure size 800x600 with 1 Axes>

Above is an illustration of the expected overlap (6%) of a pathway consisting of 20% of all genes and a gene list of 30% of all genes.

Gene Set Enrichment Analysis (GSEA)

Gene Set Enrichment Analysis (GSEA) is a more sophisticated pathway analysis method compared to ORA, in that it makes use of quantitative information. Unlike ORA, which relies on a predefined threshold to determine differentially expressed genes, GSEA considers the entire list of genes, sorted by differential abundance, and asks whether the genes of a given pathway tend to be overrepresented among the most up- or down-regulated genes, i.e. at the top or bottom of the ranked list.

Enrichment Score

GSEA works by calculating an enrichment score (ES), which quantifies the maximal difference between the observed and expected cumulative distributions of gene ranks of the genes in a pathway; i.e. how unevenly distributed the genes from the gene set of interest appear in the list of all genes. Starting at the top of the ranked gene list, an enrichment score is computed by walking down the list, increasing when a gene is in the gene set and decreasing otherwise.

Here is an illustration of the enrichment score. We generate a normally-distributed dataset of 30 samples covering 130 genes, of which 100 form an unregulated background and the remaining 30 belong to two pathways of 15 genes each. The pathway genes are simulated as “regulated”, i.e. given an additional random offset between the “Healthy” and the “Sick” samples, but in opposite directions for the two pathways. GSEA ranks the data and displays the position of the genes of a pathway as colored vertical lines among the remaining genes. If the colored vertical lines were evenly distributed, the enrichment of the pathway genes would be close to zero. Here, the genes of one pathway fall preferentially at the top (left) of the ranked list, driving the running sum upwards and giving a large positive enrichment score, while the genes of the other fall preferentially at the bottom (right), giving a large negative enrichment score.

Notebook Cell
Source
Loading...
<Figure size 400x500 with 3 Axes>

To assess the statistical significance of the observed enrichment score, GSEA uses a sampling distribution of ES obtained through permutation. The phenotype labels are shuffled many times; for each shuffle the genes are re-ranked and the ES recomputed, generating a background distribution of ES values which can then be used to calculate the pp value for the observed enrichment score. Permuting the phenotype rather than the ranked gene list preserves the correlation structure between genes, which is why it is the recommended null.

For a more detailed explanation of the enrichment score, please check out the original paper, Subramanian et al..

Kolmogorov-Smirnov (KS) Test

The Kolmogorov-Smirnov (KS) test is a non-parametric test that measures the maximum deviation between the observed cumulative distribution of the gene set and the expected distribution under the null hypothesis. The GSEA enrichment score, the maximum deviation of the running sum as we move down the ranked list, is a statistic of this kind.

GSEA uses a KS-like test to evaluate whether the genes of a pathway differ significantly from all other genes in how they correlate with the phenotype (e.g. “Healthy” or “Disease”).

Figure 1:GSEA uses a KS-like test to evaluate whether the genes of a pathway differ significantly from all other genes in how they correlate with the phenotype (e.g. “Healthy” or “Disease”).

It is not the classic KS statistic, though: by default the running sum is weighted, stepping up by ∣rj∣/∑hits∣rj∣|r_j|/\sum_{\rm hits}|r_j| at each pathway gene, where rjr_j is that gene’s ranking metric, and down by 1/(N−NH)1/(N-N_H) at each of the remaining genes (NN is the number of genes in the ranked list and NHN_H the number of them in the pathway), so that strongly ranked genes contribute more than marginal ones. Only the unweighted variant reduces to the classic KS statistic. Because this weighted statistic has no closed-form null distribution, and because the genes of a pathway are correlated rather than independent as the KS asymptotics assume, significance is assessed by permutation rather than read off from KS tables. GSEA also corrects for multiple testing by calculating false discovery rates (FDRs).

What you should know after reading this chapter

You should be able to:

  1. Explain what pathway analysis is used for, and describe what pathway databases such as KEGG and Reactome provide.

  2. Write down the 2×22 \times 2 contingency table (aa, bb, cc, dd) of gene-list membership against pathway membership, and calculate the overlap expected by chance from the fraction of genes in the pathway and the fraction in the gene list.

  3. Calculate the probability P(X=a)P(X = a) of an observed overlap with the hypergeometric formula of Fisher’s exact test, and the pp value p=∑x≥aP(X=x)p = \sum_{x \geq a} P(X = x), for a small example by hand.

  4. Contrast over-representation analysis (ORA) with gene set enrichment analysis (GSEA): ORA needs a threshold to select a gene list, while GSEA uses the whole list of genes ranked by differential expression.

  5. Describe how the GSEA enrichment score (ES) is computed as a running sum down the ranked list, stepping up at genes in the gene set and down at other genes, and interpret a large positive or large negative ES.

  6. Explain how GSEA builds a null distribution by permuting the phenotype labels, why this preserves the correlation between genes, and why significance is not read off from Kolmogorov-Smirnov tables.