- Introduced by
- Pierre Baldi, Anthony Long; Michael Newton et al. (foundational Bayesian gene-set frameworks)
- Year
- 2001–2007
- Type
- Probabilistic gene-set testing
- Family
- Bioinformatics / omics
What does it do?
Bayesian pathway enrichment analysis asks whether a predefined set of genes, such as a biological pathway, shows coordinated differential activity in an experiment.
Rather than counting significant genes against a threshold, it places a prior distribution on enrichment, updates it with the observed expression data, and returns posterior probabilities of enrichment instead of p-values. The result is a probability that a pathway is enriched, together with an explicit account of the uncertainty in the gene-level estimates.
The intuition behind the method
Imagine your experiment measured expression changes across 20,000 genes, and you want to know whether the 80 genes in the 'apoptosis' pathway behave differently as a group, not by chance. A classical test counts how many pathway genes pass a fold-change threshold and applies a hypergeometric test. The Bayesian alternative instead asks: given what we knew about gene-to-gene variability before the experiment (the prior), and given the expression signals we observed (the likelihood), what is the probability that apoptosis genes are truly enriched? The result is an interpretable posterior probability — e.g., 0.94 — rather than a borderline p-value of 0.048 that demands an arbitrary significance threshold.
History
Bayesian modelling of microarray expression data is represented early by Baldi and Long (2001), whose framework placed hierarchical priors on log-expression values and regularised gene-level variances. That work addressed differential expression for individual genes, not pathway testing. Newton and colleagues also developed random-set methods for gene-set analysis that identify distinct aspects of the enrichment signal. RNA-seq counts, unlike the log-expression values of the original microarray framework, are overdispersed relative to a Poisson model, so count-based models with a dispersion parameter are used for them. ROAST is a related gene-set test that uses empirical-Bayes variance moderation, although it is usually grouped with rotation-based tests rather than with fully Bayesian pathway models.
When to use it
Choose this approach when the number of replicates per group is small. With very few replicates, uncertainty in gene-level estimates is large, and a Bayesian model makes that uncertainty explicit; the replicate number at which this matters depends on the design and the model used. Also choose it when you need to carry uncertainty in fold-change estimates into the enrichment step rather than treating those estimates as known, or when credible prior knowledge about pathway relevance exists and should be formally encoded. It also suits multi-condition designs in which one probabilistic model tests enrichment across conditions jointly. Do not choose it simply as a replacement for standard GSEA in large, well-powered studies that need a widely implemented, standardised result; there the established GSEA workflow is usually easier to justify and reproduce. Avoid it when the pathway database does not match the organism or tissue under study, because the enrichment result will not be interpretable whatever the statistical framework.
Limitations and considerations
- Computationally heavier than hypergeometric or GSEA-style tests, especially for full hierarchical models fitted by MCMC.
- When data are sparse, posterior conclusions depend strongly on the prior; a prior sensitivity analysis is needed for every reported result.
- Fewer standardised, off-the-shelf implementations exist than for classical GSEA, so any software chosen should be checked for maintenance and documentation before use.
- Requires working knowledge of Bayesian modelling to specify the likelihood, interpret credible intervals and check MCMC convergence.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Carries uncertainty in gene-level expression estimates into the pathway-level conclusion, rather than treating fold-changes as exact.
- Shrinks gene-level variance estimates toward background values from neighbouring genes. Baldi and Long (2001) reported that this kind of regularisation partly compensates for low replication in gene-level testing; whether pathway-level models inherit that benefit depends on the likelihood chosen.
- Returns a posterior probability of enrichment for each pathway that can be read directly. A decision threshold is still needed, but it is applied to a probability rather than to a p-value.
- Allows external biological knowledge, such as a known disease pathway, to be encoded in the prior, which can sharpen inference when that knowledge is credible.
- Bayesian FDR can be applied to the posterior probabilities, so error control sits within the same probabilistic framework (see the posterior step).
Applications
- Identifying enriched apoptosis or immune-response pathways in tumour RNA-seq datasets with small patient cohorts where permutation tests lack power.
- Jointly testing metabolic pathway enrichment across multiple time points in a longitudinal treatment experiment.
- Integrating prior knowledge from published GWAS results to upweight disease-relevant pathways when analysing a new expression dataset.
- Quantifying pathway-level uncertainty in single-cell pseudo-bulk analyses where cell-type-specific replicates are few.
- Comparing enrichment probabilities across two disease subtypes to identify subtype-specific pathway signatures with calibrated uncertainty.
How it works
How it works
Raw RNA-seq reads are aligned and quantified, and count data are normalised (e.g., TMM or DESeq2 size-factor normalisation). Genes are mapped to curated pathway databases such as KEGG, Reactome, or Gene Ontology. Low-count genes and pathways with fewer than ten member genes are typically filtered out before testing to avoid inflating uncertainty.
A prior distribution is specified for each gene's baseline expression variability and for the probability that a pathway is enriched. Empirical-Bayes methods estimate the prior hyperparameters from the data itself; for gene-level variances, the regularised approach of Baldi and Long (2001) combines each gene's empirical variance with a background variance associated with neighbouring genes. Full Bayesian analyses may instead encode expert or literature-based beliefs that particular pathways have a higher baseline enrichment probability.
For each pathway, a likelihood model links the observed expression signals to the latent enrichment parameter. Candidate choices include a normal mixture model on log fold-changes, a random-effects model in which gene-level effects are drawn from a common distribution, or a Dirichlet-multinomial model for count data. Because the model describes gene-level effects jointly, it can account for within-pathway correlation, which hypergeometric over-representation tests assume away.
Bayes' theorem combines the prior and likelihood to compute a posterior distribution over the pathway enrichment parameter θ: p(θ | data) ∝ p(data | θ) p(θ). The likelihood is the model chosen in the previous step, so the posterior depends on that choice as well as on the prior. Pathway-level summaries (the posterior mean enrichment, the posterior standard deviation, and the posterior probability that enrichment exceeds zero or a biologically meaningful threshold) are extracted. False-discovery control can be applied to these probabilities using Bayesian FDR (local or tail-area).
Pathways are ranked by their posterior probability of enrichment or by their Bayes factors relative to a null model. No universal cut-off exists for calling a pathway enriched. The posterior probability or Bayes factor threshold must be chosen and reported before the analysis, and the prior sensitivity check should be applied to that decision as well as to the ranking. Pathway rankings, credible intervals, and heatmaps of member-gene posterior effects are reported. Sensitivity analyses vary the prior specification to confirm that key findings are robust to prior assumptions.
Common pitfalls
- Using an uninformative prior when sample sizes are very small (n < 4) and treating the resulting posterior as if it were data-driven — the prior will dominate, and conclusions will reflect assumptions rather than evidence.
- Ignoring within-pathway gene correlation — treating pathway genes as independent inflates false-positive rates in both classical and Bayesian settings; the likelihood model must account for gene correlation structure.
- Conflating the Bayesian FDR with the classical Benjamini-Hochberg FDR — they are derived from different frameworks and should not be mixed in the same reporting table.
- Selecting pathways post-hoc based on biological plausibility and then citing their posterior probability as confirmatory — the enrichment test must precede interpretation, not follow it.
- Running the analysis on pathways that cover fewer than 10 or more than 500 genes without acknowledging the reduced statistical power (small sets) or inflated noise (very large sets).
Frequently asked questions
How does this differ from standard GSEA?
Standard GSEA ranks all genes by a correlation-type statistic, computes a running-sum enrichment score for each gene set, and estimates significance by permutation, producing a normalised enrichment score and an empirical p-value. Bayesian pathway enrichment analysis instead models the expression data probabilistically, places a prior on enrichment and reports posterior probabilities. It handles uncertainty more explicitly and is motivated by low-replication settings, but GSEA is more widely implemented and accepted in standard genomics pipelines.
Which software implements Bayesian pathway enrichment?
The limma package (Bioconductor) provides rotation-based gene-set tests. Its mroast and fry functions are variants of the ROAST approach and use empirical-Bayes moderated variances. These are empirical-Bayes methods rather than fully Bayesian pathway models. Fully hierarchical Bayesian implementations are less standardised and are often written as custom models, for example in Stan. Most options require R/Bioconductor familiarity, and any package should be checked for documentation and maintenance before use.
How do I choose the prior?
An empirical-Bayes approach, which estimates prior hyperparameters from the data, is the safest default when no strong external knowledge exists. If prior biological knowledge is available (e.g., known disease pathways), informative priors can be set on those pathway enrichment probabilities. Always report what prior was used and include a sensitivity analysis varying the prior to show how robust conclusions are to that choice.
Can I use this for single-cell RNA-seq data?
Yes, but single-cell data requires an additional aggregation step. A common practice is pseudo-bulk analysis: cells are aggregated by cell type and biological replicate to produce count matrices that behave like bulk RNA-seq, and Bayesian pathway testing is then applied to those pseudo-bulk profiles. Testing individual cells without aggregation can produce inflated false positives, because the counts are sparse and the cells act as pseudo-replicates rather than independent biological replicates.
What pathway databases should I use?
KEGG, Reactome, and Gene Ontology Biological Process are the most commonly used curated databases and are available via the msigdb collections in R. The choice should match the biological question: KEGG for metabolic and signalling pathways, Reactome for mechanistic biochemical detail, GO BP for broader functional categories. Using all three simultaneously inflates the multiple-testing burden and requires careful Bayesian FDR handling.
Related methods
Sources
Baldi, P., & Long, A. D. (2001). A Bayesian framework for the analysis of microarray expression data: regularized t-test and statistical inferences of gene changes. Bioinformatics, 17(6), 509–519.
Open DOI referenceNewton, M. A., Quintana, F. A., Den Boon, J. A., Bhattacharya, S., & Ahlquist, P. (2004). Random-set methods identify distinct aspects of the enrichment signal in gene-set analysis. The Annals of Applied Statistics, 1(1), 85–106.
Open publication reference