Inferensys

Glossary

Hypergeometric Distribution

A discrete probability distribution used in Over-Representation Analysis to model the probability of observing a specific number of differentially expressed genes within a pathway by random chance.
MLOps engineer reviewing model serving infrastructure on laptop, container orchestration visible, technical workspace.
PROBABILITY THEORY

What is Hypergeometric Distribution?

A discrete probability distribution that models the likelihood of observing a specific number of successes in a sequence of draws from a finite population without replacement, forming the statistical backbone of Over-Representation Analysis in bioinformatics.

The hypergeometric distribution is a discrete probability distribution that describes the probability of k successes in n draws from a finite population of size N containing exactly K successes, without replacement. Unlike the binomial distribution, each draw is dependent on previous draws, making it the exact statistical model for gene set enrichment testing where genes are sampled from the genome without duplication.

In pathway enrichment analysis, the hypergeometric test calculates the probability of observing a specific number of differentially expressed genes within a pathway purely by random chance. The resulting p-value quantifies whether the overlap between a user's gene list and a pathway gene set is statistically significant, enabling researchers to identify biological processes truly associated with their experimental condition.

Hypergeometric Distribution

Key Statistical Properties

The hypergeometric distribution is the foundational probability model for Over-Representation Analysis (ORA), quantifying the likelihood of observing a specific overlap between a gene list and a pathway purely by chance.

01

Sampling Without Replacement

Unlike the binomial distribution, the hypergeometric model assumes sampling without replacement. Each gene drawn from the universe is not returned before the next draw. This is critical because a gene list for enrichment analysis contains unique identifiers—a gene cannot appear twice. The probability of selecting a gene belonging to a pathway changes after each draw, as the composition of the remaining population shifts. This dependency accurately reflects the discrete, finite nature of the genome background.

Finite Population
Sampling Model
02

The Four Core Parameters

The distribution is fully defined by four parameters derived from the experimental context:

  • N: Total number of genes in the background universe (e.g., all protein-coding genes).
  • K: Number of genes in the universe that belong to the pathway of interest (successes in population).
  • n: Number of genes in the user's differentially expressed (DE) list (sample size).
  • k: The observed overlap—the number of DE genes that are also in the pathway.

The probability mass function calculates P(X = k), the exact chance of that overlap occurring randomly.

03

Probability Mass Function (PMF)

The core formula calculates the exact probability of observing exactly k pathway genes in a DE list of size n:

P(X = k) = [ C(K, k) * C(N-K, n-k) ] / C(N, n)

Where C(a, b) is the binomial coefficient "a choose b". The numerator multiplies the ways to choose the pathway genes by the ways to choose the non-pathway genes. The denominator represents all possible ways to draw the DE list from the universe. This combinatorial logic directly models the null hypothesis of random selection.

C(K, k) × C(N-K, n-k)
Numerator
C(N, n)
Denominator
04

One-Tailed Test for Enrichment

ORA uses the upper cumulative distribution function (CDF) to test for enrichment, not the PMF of a single point. The p-value is the probability of observing k or more pathway genes:

P(X ≥ k) = 1 - P(X ≤ k-1)

This one-tailed test asks: "What is the chance that random sampling would produce an overlap at least this extreme?" A small p-value (typically < 0.05 after correction) rejects the null hypothesis, suggesting the pathway is significantly over-represented. Depletion testing uses the lower tail P(X ≤ k).

P(X ≥ k)
Enrichment p-value
05

Fisher's Exact Test Equivalence

For a 2×2 contingency table classifying genes by DE status (yes/no) and pathway membership (yes/no), the hypergeometric distribution is mathematically identical to Fisher's exact test. The test evaluates the null hypothesis of independence between the two classifications. This equivalence is why ORA tools often report "Fisher's exact p-value"—it is the same underlying combinatorial calculation applied to the overlap count. The test is exact because it computes the p-value directly from the distribution without asymptotic approximations.

2×2 Contingency
Test Structure
06

Background Universe Sensitivity

The choice of N (the background gene universe) is the most critical parameter and a common source of bias. Using the entire genome as background inflates significance for pathways with genes detectable by the assay platform. Best practice dictates using only the expressed or measurable gene set as the background—genes that had a non-zero chance of being detected as DE. Mismatched backgrounds violate the assumption that every gene had an equal probability of being sampled, leading to inflated Type I error rates and spurious enrichments.

Expressed Genes Only
Recommended Background
STATISTICAL MODEL COMPARISON

Hypergeometric vs. Alternative Enrichment Distributions

Comparison of probability distributions used to model gene set enrichment significance in Over-Representation Analysis and related methods

FeatureHypergeometricFisher's ExactBinomialChi-Squared

Sampling model

Without replacement

Without replacement

With replacement

With replacement

Null hypothesis

Random draw from urn

Independence in 2x2 table

Fixed success probability

Observed = Expected

Exact p-value

Small sample validity

Computational complexity

Factorial-heavy

Factorial-heavy

Low

Very low

Assumes large population

Typical enrichment use

ORA default

ORA alternative

Rarely used

Preliminary screening

Handles sparse contingency tables

HYPERGEOMETRIC DISTRIBUTION IN PATHWAY ANALYSIS

Frequently Asked Questions

Clear, technically precise answers to the most common questions about applying the hypergeometric distribution in Over-Representation Analysis for biomarker discovery.

The hypergeometric distribution is a discrete probability distribution that models the likelihood of drawing a specific number of successes from a finite population without replacement. In Over-Representation Analysis (ORA), it calculates the exact probability of observing a given number of differentially expressed genes (DEGs) within a specific biological pathway purely by random chance. The distribution uses four parameters: the total number of genes in the universe (N), the number of DEGs in the experiment (K), the size of the pathway gene set (n), and the number of DEGs found in that pathway (k). The resulting p-value quantifies whether the overlap is statistically significant, allowing researchers to identify pathways that are genuinely perturbed in their experimental condition rather than appearing enriched due to random sampling variation.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.