'C++' Implementations of Functional Enrichment Analysis

Fast implementations of functional enrichment analysis methods using 'C++' via 'Rcpp'. Currently provides Over-Representation Analysis (ORA), Gene Set Enrichment Analysis (GSEA), design-aware GSEA on RNA-seq counts with per-sample gene set scoring, Weighted Enrichment Analysis for ORA and GSEA, Network-based Set Enrichment Analysis (NSEA), multi-layer network-based enrichment, and multi-omics integration workflows. Additional features include early fusion at the feature level, late fusion at the pathway level, multi-omics contribution tracing, topology-aware explanation helpers, Bayesian term selection, and extremely fast Random Walk with Restart (RWR) using 'RcppEigen'. The enrichment methods build on GSEA by Subramanian et al. (2005) , the multilevel strategy derived from 'fgsea' by Korotkevich et al. (2021) , and network-based enrichment ideas described by Glaab et al. (2012) .


enrichit: C++ Implementations of Functional Enrichment Analysis

enrichit provides C++ implementations of functional enrichment analysis methods and S4 result classes used by the clusterProfiler family. It supports ORA, GSEA, design-aware GSEA on RNA-seq counts, weighted enrichment, network-based enrichment, multilayer network workflows, and multi-omics aggregation and contribution analysis.

Installation

You can install the development version of enrichit from GitHub using devtools:

# install.packages("devtools")
devtools::install_github("YuLab-SMU/enrichit")

Main components

enrichit organizes its functions around five components:

  • Core enrichment engines: ORA, GSEA, weighted ORA/GSEA, and GSON-aware variants.
  • Design-aware and score-level GSEA: dsea() for enrichment on a count matrix plus a design (rank by the requested contrast, then GSEA), and dsea_scores()/ssgsea_scores() for per-sample gene set scores.
  • Network-aware enrichment: single-layer nsea() and multi-layer mnsea() workflows based on Random Walk with Restart.
  • Multi-omics integration: early fusion at the feature level and late fusion at the pathway level.
  • Contribution and topology outputs: contribution tables and topology-aware extraction helpers for visualization in enrichplot.

Implementation and features

  • Implementation: Algorithms are implemented in C++ via Rcpp, with sparse network propagation using RcppEigen.
  • ORA: standard hypergeometric ORA with optional weighted ORA through Wallenius' noncentral hypergeometric distribution.
  • GSEA: multilevel, permutation, and adaptive strategies for ranked enrichment analysis.
  • Design-aware GSEA: dsea() takes a count matrix or a DESeqDataSet plus a design from model.matrix() (rownames must match the sample names), variance-stabilises the counts (vst or rlog), ranks genes by the requested contrast, and runs the GSEA engine already in the package. It returns a plain data.frame -- GSEA's table plus padj and contrast -- so it can be filtered and plotted like any other GSEA result. dsea_scores() and ssgsea_scores() are the other half: a gene set x sample score matrix for analyses that need samples rather than one contrast.
  • DESeq2 adapters: as_ranked() and as_genes() turn DESeqResults and fitted DESeqDataSet objects into a ranking or a gene vector, so a dsea() analysis can start from an existing DESeq2 result; extra arguments are passed on to DESeq2::results(), so the contrast uses its c("factor", "numerator", "denominator") form. DESeq2 is suggested, not imported.
  • GSON support: native ora_gson() and gsea_gson() interfaces for structured gene set collections.
  • NSEA: nsea() and nsea_gson() for network-ranked enrichment on a single graph, including mode = "signed" for bidirectional propagation.
  • Multi-layer topology fusion: mnsea() and mnsea_gson() for multiplex or heterogeneous network propagation across multiple layers.
  • Multi-omics early fusion: aggregate_omics(), harmonize_ids(), and select_features_for_ora() for feature-level integration before enrichment.
  • Multi-omics late fusion: aggregate_enrichment() for pathway-level aggregation of multiple enrichment results.
  • Contribution tracing: get_omics_contribution(), classify_omics_pattern(), and get_mnsea_contribution() for contribution summaries.
  • Topology-aware extraction: extract_mnsea_subnetwork() for pathway-specific node/edge tables that can be passed to downstream visualization packages.
  • Bayesian term selection: bayes_enrich() and bayes_summary() for posterior-based term prioritization.

Main APIs

Classical enrichment

  • ora(), ora_gson()
  • gsea(), gsea_gson()
  • gseaScores()

Weighted enrichment

  • ora(..., weight = )
  • ora_gson(..., weight = )
  • gsea(..., weight = )
  • gsea_gson(..., weight = )

Design-aware and score-level GSEA

  • dsea()
  • dsea_scores(), ssgsea_scores()
  • as_ranked(), as_genes()

Network-aware enrichment

  • prepare_network()
  • nsea(), nsea_gson()
  • prepare_multilayer_network()
  • propagate_multilayer()
  • collapse_multilayer_scores()
  • mnsea(), mnsea_gson()

Multi-omics integration

  • aggregate_omics()
  • harmonize_ids()
  • select_features_for_ora()
  • aggregate_enrichment()

Explanation helpers

  • get_omics_contribution()
  • classify_omics_pattern()
  • get_mnsea_contribution()
  • extract_mnsea_subnetwork()

Result Objects

The package returns the following S4 result classes:

  • enrichResult for ORA-like workflows
  • gseaResult for ranked enrichment workflows
  • nseaResult for single-network propagation plus enrichment
  • mnseaResult for multi-layer propagation, collapsed scores, and cached explanation tables

dsea() is the exception on the other side: it returns a plain data.frame rather than a gseaResult. dsea_scores() and ssgsea_scores() return a DseaScores object, an S3 list holding the gene set x sample score matrix ($scores) and the metadata it was built with ($meta).

These classes are used across the clusterProfiler family:

  • enrichit handles core computation, algorithm implementation, and contribution data preparation
  • clusterProfiler provides high-level biological interpretation workflows and general enrichment analysis interfaces
  • enrichplot handles visualization
  • gson provides a structured gene set resource layer for managing and exchanging gene set collections across the family
  • knowledge-base-oriented downstream packages such as DOSE, ReactomePA, meshes, and MicrobiomeProfiler provide domain-specific annotation and interpretation layers

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("enrichit")

0.2.7 by Guangchuang Yu, 5 days ago


https://yulab-smu.top/biomedical-knowledge-mining-book/


Browse source code at https://github.com/cran/enrichit


Authors: Guangchuang Yu [aut, cre]


Documentation:   PDF Manual  


Artistic-2.0 license


Imports Matrix, methods, Rcpp, rlang, S4Vectors, stats, SummarizedExperiment, yulab.utils

Suggests AnnotationDbi, BiasedUrn, clusterProfiler, DESeq2, DOSE, fgsea, gson, qvalue, testthat, jsonlite

Linking to Rcpp, RcppEigen


See at CRAN