Package 'ReactomePA'

Title: Reactome Pathway Analysis
Description: This package provides functions for pathway analysis based on REACTOME pathway database. It implements enrichment analysis, gene set enrichment analysis, network-based enrichment analysis (NSEA) on the Reactome reaction graph, Bayesian term selection, weighted enrichment, and several functions for visualization. This package is not affiliated with the Reactome team.
Authors: Guangchuang Yu [aut, cre], Vladislav Petyuk [ctb]
Maintainer: Guangchuang Yu <[email protected]>
License: GPL-2
Version: 1.99.2
Built: 2026-09-24 19:33:58 UTC
Source: https://github.com/bioc/ReactomePA

Help Index


Bayesian term selection for Reactome enrichment results

Description

'bayes_reactome()' adds a model-based selection layer on top of 'enrichPathway()' results. It estimates the posterior probability that each candidate Reactome pathway is an active biological program explaining the observed input genes.

Usage

bayes_reactome(
  x,
  candidate = c("top", "significant", "all"),
  n_terms = 200,
  by = "p.adjust",
  prior = 0.1,
  false_positive = 0.01,
  false_negative = 0.1,
  n_iter = 5000,
  burnin = 1000,
  thin = 1,
  posterior_cutoff = 0.5,
  seed = NULL,
  verbose = FALSE
)

Arguments

x

An 'enrichResult' object from 'enrichPathway()'.

candidate

Candidate terms to include. '"significant"' uses 'as.data.frame(x)', '"all"' uses 'x@result', '"top"' uses the top 'n_terms' rows from 'x@result' ordered by 'by'; or provide a character vector of term IDs.

n_terms

Maximum number of candidate terms when 'candidate = "top"' or when more candidates are supplied than this value. Use 'Inf' to disable.

by

Column used to order candidate terms.

prior

Prior probability that a term is active.

false_positive

Probability of observing a gene not covered by active terms.

false_negative

Probability of missing a gene covered by active terms.

n_iter

Total number of MCMC iterations.

burnin

Number of initial iterations discarded.

thin

Keep one sample every 'thin' iterations after burn-in.

posterior_cutoff

Terms with posterior greater than or equal to this value are marked active.

seed

Optional random seed.

verbose

Print sampler progress.

Details

This is a thin wrapper around 'enrichit::bayes_enrich()', intended as a result-compression and interpretation layer for Reactome pathway enrichment. Reactome's hierarchical pathway structure often produces many redundant significant terms — Bayesian selection helps distinguish truly active programs from statistically significant but dependent ones.

Value

The input 'enrichResult' object with additional columns in '@result': 'posterior', 'posterior_odds', 'bayes_rank', 'bayes_active', 'bayes_covered_gene', and 'bayes_covered_count'.

See Also

[enrichit::bayes_enrich()]

Examples

## Not run: 
  gene <- c("11171", "8243", "112464", "2194",
            "9318", "79026", "1654", "65003",
            "6240", "3476", "6238", "3836",
            "4176", "1017", "249")
  x <- enrichPathway(gene, pvalueCutoff = 0.1)
  bx <- bayes_reactome(x)
  head(as.data.frame(bx))

## End(Not run)

Datasets sample contains a sample of gene IDs.

Description

Datasets sample contains a sample of gene IDs.


Pathway Enrichment Analysis of a gene set. Given a vector of genes, this function will return the enriched pathways with FDR control.

Description

Pathway Enrichment Analysis of a gene set. Given a vector of genes, this function will return the enriched pathways with FDR control.

Usage

enrichPathway(
  gene,
  pvalueCutoff = 0.05,
  pAdjustMethod = "BH",
  universe = NULL,
  weight = NULL,
  minGSSize = 10,
  maxGSSize = 500,
  qvalueCutoff = 0.2,
  organism = "human",
  readable = FALSE
)

Arguments

gene

a vector of entrez gene id.

pvalueCutoff

Cutoff value of pvalue.

pAdjustMethod

one of "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none"

universe

background genes

weight

A named numeric vector of weights for background genes. If provided, Weighted ORA will be performed using Wallenius' noncentral hypergeometric distribution.

minGSSize

minimal size of genes annotated by Ontology term for testing.

maxGSSize

maximal size of each geneSet for analyzing

qvalueCutoff

Cutoff value of qvalue

organism

one of "human", "rat", "mouse", "celegans", "yeast", "zebrafish", "fly".

readable

whether mapping gene ID to gene Name

Value

A enrichResult instance.

Author(s)

Guangchuang Yu http://ygc.name

See Also

enrichResult-class

Examples

## Not run: 
	gene <- c("11171", "8243", "112464", "2194",
			"9318", "79026", "1654", "65003",
			"6240", "3476", "6238", "3836",
			"4176", "1017", "249")
	yy = enrichPathway(gene, pvalueCutoff=0.05)
	head(summary(yy))

## End(Not run)

getDb

Description

mapping organism name to annotationDb package name

Usage

getDb(organism)

Arguments

organism

one of supported organism

Value

annotationDb name

Author(s)

Yu Guangchuang


gsePathway

Description

Gene Set Enrichment Analysis of Reactome Pathway

Usage

gsePathway(
  geneList,
  organism = "human",
  exponent = 1,
  weight = NULL,
  minGSSize = 10,
  maxGSSize = 500,
  eps = 1e-10,
  pvalueCutoff = 0.05,
  pAdjustMethod = "BH",
  verbose = TRUE,
  nPerm = 1000,
  method = "multilevel",
  adaptive = FALSE,
  minPerm = 101,
  maxPerm = 1e+05,
  pvalThreshold = 0.1,
  seed = FALSE,
  ...
)

Arguments

geneList

order ranked geneList

organism

organism

exponent

weight of each step

weight

A named numeric vector of weights for genes. The names should match the names of geneList. If provided, the geneList will be multiplied by the weight and resorted before GSEA (default: NULL).

minGSSize

minimal size of each geneSet for analyzing

maxGSSize

maximal size of each geneSet for analyzing

eps

boundary for calculating the p value in multilevel mode

pvalueCutoff

pvalue Cutoff

pAdjustMethod

pvalue adjustment method

verbose

print message or not

nPerm

The number of permutations for the "permute" method

method

one of "sample", "permute", "multilevel"

adaptive

logical

minPerm

minimal number of permutations for the "multilevel" method

maxPerm

maximal number of permutations for the "multilevel" method

pvalThreshold

The p-value threshold for the "multilevel" method

seed

random seed for reproducibility, set to a number (or TRUE to use a fixed default seed) to make the result reproducible, or FALSE (default) to draw a random seed on each run, so results may vary between runs. The underlying permutation engine uses its own RNG seeded with this value; see enrichit::gsea() for details.

...

other parameters passed to enrichit::gsea_gson()

Value

gseaResult object

Author(s)

Yu Guangchuang


gson_Reactome

Description

download the latest version of Reactome and stored in a 'GSON' object

Usage

gson_Reactome(organism = "human")

Arguments

organism

one of "human", "rat", "mouse", "celegans", "yeast", "zebrafish", "fly".

Value

a 'GSON' object

Examples

## Not run: 
rec_gson <- gson_Reactome("human")

## End(Not run)

Network-based Reactome pathway enrichment analysis

Description

'nsePathway()' performs network-based set enrichment analysis (NSEA) on Reactome pathways. Instead of using raw gene-level scores directly, scores are propagated across the Reactome reaction graph via Random Walk with Restart (RWR), and enrichment scores are computed on the diffused ranking. Statistical significance is assessed with a whole-pipeline permutation null (gene labels of the input scores are reshuffled, the diffusion is re-run, and the enrichment scores are recomputed), so the reported p-values account for the correlation induced by network diffusion and control the false-positive rate. This captures pathway-level signals that may be diluted in individual gene-level statistics.

Usage

nsePathway(
  geneList,
  organism = "human",
  mode = c("evidence", "signed"),
  network = NULL,
  restart_prob = 0.5,
  specific_weight = FALSE,
  minGSSize = 10,
  maxGSSize = 500,
  threshold = 1e-09,
  maxIter = 100,
  nPerm = 1000,
  seed = NULL,
  verbose = TRUE,
  ...
)

Arguments

geneList

A named numeric vector of gene-level scores (e.g. log2FC). Names must be Entrez Gene IDs.

organism

Supported organism. Default is "human".

mode

Character, either "evidence" (default) or "signed". In "evidence" mode, all seeds are propagated once. In "signed" mode, positive and negative seeds are propagated separately and the difference is taken.

network

Optional pre-built network from 'prepareReactomeNetwork()'. If NULL, the network is auto-built and cached.

restart_prob

Restart probability for RWR (default: 0.5).

specific_weight

Logical, whether to apply gene specificity weighting (TF-IDF style). Default is FALSE.

minGSSize

Minimal size of each gene set for analyzing (default: 10).

maxGSSize

Maximal size of each gene set for analyzing (default: 500).

threshold

Convergence threshold for RWR (default: 1e-9).

maxIter

Maximal number of RWR iterations (default: 100).

nPerm

Number of whole-pipeline permutations used to estimate p-values and NES (default: 1000). Each permutation reshuffles the gene labels of the input scores, re-runs the RWR diffusion over the network, and recomputes the enrichment scores, giving a null distribution that accounts for the network diffusion. The smallest estimable p-value is 1/(nPerm + 1).

seed

Numeric random seed for the whole-pipeline permutation null (default: NULL uses the current R RNG state). Set a number for fully reproducible results.

verbose

Print progress messages (default: TRUE).

...

Other arguments passed to 'enrichit::nsea_gson()'.

Details

The Reactome reaction network is automatically built and cached on first call. Users can pre-build and pass a custom network via the 'network' parameter.

Value

A 'nseaResult' object (inherits from 'gseaResult').

See Also

[prepareReactomeNetwork()], [enrichit::nsea()]

Examples

## Not run: 
  data(geneList, package = "DOSE")
  nsea_res <- nsePathway(geneList)
  head(nsea_res)

## End(Not run)

Prepare Reactome reaction network for NSEA

Description

Builds a gene-gene interaction network from all Reactome reaction steps for a given species. Two genes are connected if they co-participate in the same reaction step. The network is returned as a column-normalized sparse matrix (dgCMatrix) suitable for Random Walk with Restart.

Usage

prepareReactomeNetwork(
  organism = "human",
  directed = FALSE,
  cores = getOption("mc.cores", 1L)
)

Arguments

organism

Supported organism: "human", "mouse", "rat", "yeast", "zebrafish", "fly", "celegans", etc. See 'graphite::pathways()' for the full list.

directed

Logical. If FALSE (default), edges are treated as undirected (reciprocal edges added).

cores

Number of CPU cores used to convert Reactome pathways to reaction edges in parallel. Defaults to 'getOption("mc.cores")', or '1' (serial) if the option is unset: the conversion is fast enough (~40 s for human) that parallelizing is optional, and serial leaves the rest of the machine untouched. The per-pathway conversions are independent and pure in-memory vectorized operations (the species identifier map is loaded once up front), so wall time scales close to linearly with 'cores'. On Windows, 'mclapply()' falls back to serial execution regardless.

Details

The network is cached via 'yulab.utils::with_cache()' so repeated calls are fast.

Value

A sparse matrix (dgCMatrix) of the Reactome reaction graph.

Examples

## Not run: 
  net <- prepareReactomeNetwork("human")

## End(Not run)

viewPathway

Description

view reactome pathway

Usage

viewPathway(
  pathName,
  organism = "human",
  readable = TRUE,
  foldChange = NULL,
  keyType = "ENTREZID",
  layout = "kk"
)

Arguments

pathName

pathway Name

organism

supported organism

readable

logical

foldChange

fold change

keyType

keyType of gene ID (i.e. names of foldChange, if available)

layout

graph layout

Details

plotting reactome pathway

Value

plot

Author(s)

Yu Guangchuang