Session #2: Gene Ontology and Overrepresentation Analysis
The Gene Ontology (GO) is being developed with the goal of providing a set of structured vocabularies for the annotation of genes and their products. Since the publication of the original paper in Nature Genetics in 20001, GO has become one of the most widely used and mature bio-ontologies, although it is still very much a work in progress.
The following represents the lineage of the term DNA ligase (ATP) activity (GO:0003910):
The term function is sometimes used in a rather vague way..
figure credit: EMBL-EBI
GO Molecular function
Molecular functions generally correspond to the individual steps in a biological process (like the activity of a single protein within a metabolic pathway).
figure credit: EMBL-EBI
Note
A cellular component is not just a “where”—it can be a functional structure like a protein complex that acts as a unit.
figure credit: EMBL-EBI
Each entry (term) in the Gene Ontology contains these standardized metadata fields to ensure consistency across different databases.
[Term]
id: GO:0003678
name: DNA helicase activity
namespace: molecular_function
alt_id: GO:0003679
alt_id: GO:0004003
def: "Unwinding of a DNA helix, driven by ATP hydrolysis." [GOC:jl]
synonym: "ATP-dependent DNA helicase activity" EXACT []
xref: EC:3.6.4.12
xref: Reactome:R-HSA-5693589 "D-loop dissociation and strand annealing"
is_a: GO:0004386 ! helicase activity
is_a: GO:0008094 ! ATP-dependent activity, acting on DNA
property_value: skos:exactMatch EC:3.6.4.12The “Annotation” vs. “Term”
Remember: A Term is a definition in the ontology. An Annotation is the link between a specific gene and that term.
An annotation record typically includes:
| Field | Value | Description |
|---|---|---|
| Accession | O00115 |
Unique protein identifier |
| DB Name | DRN2_HUMAN |
Standardized database symbol |
| GO ID | GO:0003677 |
The GO term assigned (DNA binding) |
| Evidence | TAS |
Traceable Author Statement |
Metadata
Records also include synonyms, PubMed IDs, Taxon (species), and the date the annotation was last updated (biocuration date).
How do we know that a gene product has a certain function?
Caution
Many high-throughput analyses filter out IEA codes because they are automated and tend to have a higher false-positive rate as compared to experimental data.
The Situation
We have performed a high-throughput experiment (e.g., RNA-seq) and identified a list of differentially expressed genes. What are the salient characteristics of the genes in this list?
For background on RNA-seq analysis, see - Conesa A, et al. (2016) A survey of best practices for RNA-seq data analysis. Genome Biol 17:13
Keep it simple stupid?
Basic assumption
Note
\(\binom{n}{k}\): read “N choose k” (“N über k”)
To calculate the number of unique ways to arrange \(k\) “heads” and \(n-k\) “tails,” we must account for redundant rearrangements:
Total Permutations: There are \(n!\) ways to rearrange \(n\) distinct objects.
Redundancy Correction: Exchanging the positions of two “heads” does not change the observable sequence.
The Formula: To find the number of distinct orderings, we divide the total by the redundancies: \[ \binom{n}{k} = \dfrac{n!}{(n-k)! k!} \tag{1}\]
Note
This value \(\binom{n}{k}\), represents the number of different ways of choosing \(k\) items from a set of \(n\) items where the order of selection does not matter.
For instance:
Note
How do we go from the binomial distribution to a statistical test?
\[ \begin{align} p(k \geq k^{'},n,p) &= \sum_{k=k^{'}}^{N}\binom{n}{k} p^k\left(1-p\right)^{n-k} \\ \end{align} \tag{3}\]
Before we continue: If we apply the binomial test to Gene Ontology overrepresentation analysis, where do we get \(n\), \(k\), and \(p\)?
Before we continue: Why is the binomial test not quite correct to perform GO overrepresentation analysis?
The statistical analysis counts up all the ways of getting \(k\) genes annotated to \(t\) and \(n-k\) remaining genes not annotated to \(t\), and compares this number to the number of all possible outcomes.
Let \(m\) be the number of genes on the microarray chip.
We have: \[ P(k\mid n,m,m_t) = \dfrac{\binom{m_t}{k}\binom{m-m_t}{n-k}}{\binom{m}{n}} \tag{4}\]
Numerator: \(\binom{m_t}{k}\binom{m-m_t}{n-k}\): The number of ways to choose exactly \(k\) annotated genes AND \(n-k\) non-annotated genes.
Denominator: \(\binom{m}{n}\): The total number of ways to choose any \(n\) genes from the population \(m\).
\[ \begin{align} P(k\mid n,m,m_t) &= \dfrac{\binom{m_t}{k}\binom{m-m_t}{n-k}}{\binom{m}{n}} \\ &=\dfrac{\text{\# ways to choose } k \text{ annotated and } (n-k)\text{ non-annotated genes }}{\text{\# ways to choose } n \text{ genes }} \\ \end{align} \]
\[ p(k,n,m,m_t) = \dfrac{\binom{m_t}{k}\binom{m-m_t}{n-k}}{\binom{m}{n}} \]
Equation 4 is known as the hypergeometric distribution.
Fisher Exact Test:\[ P(X \geq k) = \sum_{i=k}^{\min(n,\, m_t)} \dfrac{\binom{m_t}{i}\binom{m-m_t}{n-i}}{\binom{m}{n}} \tag{5}\]
\[ P(X \geq k) = \sum_{i=k}^{\min(n,\, m_t)} \dfrac{\binom{m_t}{i}\binom{m-m_t}{n-i}}{\binom{m}{n}} \]
\[ P(X \geq k) = \sum_{i=k}^{\min(n,\, m_t)} \dfrac{\binom{m_t}{i}\binom{m-m_t}{n-i}}{\binom{m}{n}} \]
Note
The actual testing procedure for the most basic kind of GO analysis involves performing one statistical test for each GO term that is represented in the dataset of interest (usually this means we are performing thousands of tests)
For each tested GO term, we have:
Null Hypothesis (\(H_0\)): there is no positive association between genes annotated to the term \(t\) and the study set; that is, there is no overrepresentation of term \(t\).
Alternative Hypothesis (\(H_1\)): There is overrepresentation of the term.
The null hypothesis corresponds to the probability of observing a test statistic that is at least as extreme as the one that was observed given that the null hypothesis is true.
Therefore, the null hypothesis corresponding to a one-sided test is rejected if the probability of observing \(n_t\) genes annotated to term \(t\) in the study set by chance is less than \(\alpha\)
By convention, \(\alpha\) is usually set to 0.05
This is given by:
\[ P(X_t\geq n_t|H_0) = \sum_{k=n_t}^{\min(m_t,n)} \frac{\displaystyle{m_t \choose k}\displaystyle{{m - m_t} \choose {n - k}}}{\displaystyle{m \choose n}}. \]
Suppose that there is a population set of \(m=18\) genes, of which \(m_t=4\) genes are annotated to the term \(t\).
The outcome of an experiment conducted on all 18 genes of the population yields a set of 5 genes. This means that the study set consists of \(n=5\) genes.
Moreover, we observe that a total of \(n_t=3\) genes from the genes of the study set are annotated to term \(t\)
We would now like to analyze whether term \(t\) is significantly overrepresented in the study set and thus can be interpreted to represent an important result of the experiment:
\[ P(X_t\geq 3|H_0) = \frac{\displaystyle{5 \choose 3}\displaystyle{{13} \choose {2}}}{\displaystyle{18 \choose 5}} + \frac{\displaystyle{5 \choose 4}\displaystyle{{13} \choose {1}}}{\displaystyle{18 \choose 5}} = 0.044. \] - Since \(P(X_t\geq 3|H_0)=0.044<0.05=\alpha\), the null-hypotheses is rejected and the term may be interpreted as being characteristic of the experiment.
More background: Noble WS (2009) How does multiple testing correction work? Nat Biotechnol 27:1135-7
Input: A ranked list of N genes, ordered by some gene-level statistic
The most differentially expressed genes are placed at the top of the list, the least differential at the bottom.
The original GSEA implementation had a type of signal to noise ratio (Difference of class means divided by sum of class standard deviations. This is essentially a variance-stabilized fold-change)
\[ r_j = \frac{\mu_{j,A} - \mu_{j,B}}{\sigma_{j,A} + \sigma_{j,B}} \]
The running-sum construction - Walk down the ranked list from position \(j=1,\ldots,N\) - At each step, maintain two running sums:
\[ P_{hit}(S,i) = \sum_{\substack{j \le i \\ g_j \in S}} \dfrac{|r_j|^p}{N_R} \quad\quad \bullet N_R = \sum_{g_j\in S}|r_j|^p \tag{6}\]
hit term of Equation 6 increases whenever it encounters a gene that belongs to \(S\), weighted by the magnitude of its ranking statistic \(r_j\)and
\[ P_{miss}(S,i) = \sum_{\substack{j \le i \\ g_j \notin S}}\dfrac{1}{N-N_R} \]
The miss term increases whenever it encounters a gene not in S, with a uniform step size.
Both are normalized so each is a proper empirical CDF: they start at 0, and \(P_{hit}(S,N) = P_{miss}(S,N) = 1\).
The enrichment score is the maximum deviation between these two running sums as you sweep across the whole list:
\[ ES(S) = \max_i [P_{hit}(S,i) - P_{miss}(S,i)] \tag{7}\]
\[ D = \sup_x |CDF_1(x) - CDF_2(x)| \tag{8}\]
The calculation of the p-value in the KS test is .is computed from a known asymptotic distribution (the Kolmogorov distribution), either via an exact formula for small n or asymptotically for large n.
GSEA has no such closed-form null
In GSEA, the p-value is estimated empirically using permutations
permuting phenotype labels changes the ranked gene list itself
If the actual GSEA statistic is higher than all but 2 of 10,000 permutations, then the p value is calculated as \[ p=\frac{b+1}{m+1} = \frac{2+1}{10000+1} \approx 3\times 10^{-4} \]
Specifically, we permute the phenotype labels and recompute the ES of the gene set for the permuted data, which generates a null distribution for the ES.
The empirical, nominal P value of the observed ES is then calculated relative to this null distribution.
The adjustment for multiple testing is essentially the same as with GO Overrepresentation Analysis
Skipping some details in the original publication
Sources:
GO-CAM:
Image: https://geneontology.org/docs/gocam-overview/
A GO-CAM model is a combination of standard GO annotations to produce a network of annotations (“model”) that is a more complete model of biological function than the separate annotations.
- **a)**: set of disconnected GO annotations
a molecular activity (GO molecular function annotation) of a gene product occurs
in a location (GO cellular component annotation)
is part of a larger biological program (GO biological process annotation).
In GO-CAM, relations to terms from other ontologies can provide additional specificity:
| GO-CAM element | Ontology or identifier source(s) | Example |
|---|---|---|
| Molecular activity | GO molecular function | ubiquitin-protein transferase activity (GO:0004842) |
| Biological process | GO biological process | cellular response to UV (GO:0034644) |
| Location | GO cellular component | nucleus (GO:0005634) |
| Cell Type Ontology (CL) | retinal cell (CL:0009004) | |
| anatomy ontologies, e.g. UBERON, C. elegans gross anatomy, EMAPA | eye (UBERON:0000970) | |
| Active entity | Gene, protein, RNA or complex identifier from a standard source, e.g. HGNC for a human gene | NEDD4 (HGNC:7727) |
| Target entity | Same as active entity, or chemical from ChEBI | MAP2K1 (HGNC:6840) |
| Biological phase | GO biological phase (GO:0044848) | mitotic G1 phase (GO:0000080) |
| Developmental phase ontology, e.g. Mouse Developmental Stage | Theiler stage 02 (MmusDv:0000005) | |
| Relations | Relations Ontology | occurs in (BFO:0000066) |
Feuermann M, et al. (2025) A compendium of human gene functions derived from evolutionary modelling. Nature 640:146-154
Suggested Reading
Gene Ontology Consortium (2026) The Gene Ontology knowledgebase in 2026. Nucleic Acids Res 54:D1779-D1792