Skip to main content

Crate gsva

Crate gsva 

Source
Expand description

gsva-rust: a pure-Rust port of the GSVA family of gene-set enrichment methods — GSVA (Hänzelmann et al. 2013), ssGSEA (Barbie et al. 2009), combined z-score (Lee et al. 2008), and PLAGE (Tomfohr et al. 2005) — as exposed by the Bioconductor GSVA package, validated for numeric parity against the original R implementation.

Built with Claude Code (Anthropic). See the README for the AI-assistance disclosure and licensing (Artistic-2.0, matching upstream GSVA).

§Quick start

use gsva::{ExprMatrix, GeneSet, GeneSets, GsvaParams};

// Expression as genes × samples, stored row-major.
let expr = ExprMatrix::new(
    vec!["TP53".into(), "EGFR".into(), "MYC".into(), "PTEN".into()],
    vec!["sample1".into(), "sample2".into(), "sample3".into()],
    vec![
        5.1, 6.2, 4.8, // TP53
        2.0, 9.1, 3.3, // EGFR
        7.7, 1.2, 8.0, // MYC
        4.4, 4.6, 4.5, // PTEN
    ],
);
let sets = GeneSets::new(vec![
    GeneSet::new("proliferation", vec!["MYC".into(), "EGFR".into()]),
    GeneSet::new("suppressors", vec!["TP53".into(), "PTEN".into()]),
]);

// The free function and the module share the name `gsva`, so call it
// qualified as `gsva::gsva` (or alias it on import).
let res = gsva::gsva(&expr, &sets, &GsvaParams::default());
assert_eq!(res.gene_sets, ["proliferation", "suppressors"]);
let _proliferation_s2 = res.score(0, 1); // (gene-set index, sample index)

Swap in [ssgsea], [zscore], or [plage] (with their *Params) for the other methods — they share the (&ExprMatrix, &GeneSets, &Params) -> EnrichmentResult shape.

Re-exports§

pub use geneset::GeneSet;
pub use geneset::GeneSets;
pub use gsva::gsva;
pub use gsva::GsvaParams;
pub use gsva::Kcdf;
pub use matrix::ExprMatrix;
pub use plage::plage;
pub use plage::PlageParams;
pub use result::EnrichmentResult;
pub use ssgsea::ssgsea;
pub use ssgsea::SsgseaParams;
pub use zscore::zscore;
pub use zscore::ZscoreParams;

Modules§

geneset
Gene sets and a dependency-free GMT parser.
gsva
GSVA enrichment scores (Hänzelmann et al. 2013), the namesake method of the Bioconductor GSVA package.
io
Minimal, dependency-free TSV reader for expression matrices.
kcdf
Kernel cumulative-distribution estimates for GSVA’s kcdf step.
matrix
Minimal expression-matrix container: features (genes) in rows, samples in columns. Data is stored row-major, so a whole gene (row) is contiguous.
plage
PLAGE — Pathway Level Analysis of Gene Expression (Tomfohr et al. 2005), as implemented by GSVA’s plage path.
rank
R-faithful ranking helpers.
result
Shared result type for gene-set enrichment methods.
ssgsea
Single-sample GSEA (Barbie et al. 2009), as implemented by GSVA’s ssgsea path.
zscore
Combined z-score gene-set enrichment (Lee et al. 2008), as implemented by GSVA’s zscore path.