Contingency Table & Fisher's Exact Test
| In pathway | Not in pathway | Total | |
|---|---|---|---|
| DEG | — | — | — |
| Expected (H₀) | — | — | — |
| Not DEG | — | — | — |
| Total | — | — | — |
One-sided p-value P(X ≥ k)
—
—
Two-sided p-value
—
—
Odds ratio
—
k(N−n−(K−k)) / (n−k)(K−k)
Expected overlap E[X]
—
n·K/N under H₀
Hypergeometric PMF — P(X = x)
Blue bars: x < k. Accent bars: x ≥ k (shaded tail = one-sided p-value). Dashed line = observed k. ◀▶ arrow keys adjust k.
GSEA Random Walk — Enrichment Score ES(S)
Ranked gene list (left = top correlation with phenotype). Black bars: gene-set members. Red curve: running enrichment score. ES(S) = maximum deviation from zero. In Enriched mode gene-set members cluster near the top.
ORA — Fisher's Exact Test
// Hypergeometric PMF
P(X = k) =
C(K, k) · C(N−K, n−k)
C(N, n)
// One-sided p-value
p = Σi=k..min(K,n) P(X = i)
// Expected overlap under H₀
E[X] = n · K / N
| sym | meaning |
|---|---|
| N | total genes in genome |
| K | genes in pathway |
| n | total DEGs (draws) |
| k | DEGs ∩ pathway (observed) |
Fisher vs χ²: use Fisher when any Ei < 5; χ² = Σ(O−E)²/E otherwise (df = (r−1)(c−1), critical value χ²(1, 0.95) = 3.841).
GSEA — Random Walk
// Rank all genes by fold-change
score ← 0
for gene_i in ranked_list:
if gene_i ∈ S:
score += 1 / |S|
else:
score −= 1 / (N − |S|)
ES(S) = maxi(score)
// Significance via permutation
NES = ES(S) / E[ESperm]
S = gene set, N = ranked list length, |S| = set size.
Large positive ES → set members cluster near top (enriched in condition A).
Leading edge = genes in S above the ES peak.
Apply BH-FDR across all tested gene sets.
Large positive ES → set members cluster near top (enriched in condition A).
Leading edge = genes in S above the ES peak.
Apply BH-FDR across all tested gene sets.