Skip to main content

gsva/
lib.rs

1//! `gsva-rust`: a pure-Rust port of the GSVA family of gene-set enrichment
2//! methods — GSVA (Hänzelmann et al. 2013), ssGSEA (Barbie et al. 2009),
3//! combined z-score (Lee et al. 2008), and PLAGE (Tomfohr et al. 2005) — as
4//! exposed by the Bioconductor `GSVA` package, validated for numeric parity
5//! against the original R implementation.
6//!
7//! Built with Claude Code (Anthropic). See the README for the AI-assistance
8//! disclosure and licensing (Artistic-2.0, matching upstream GSVA).
9//!
10//! # Quick start
11//!
12//! ```
13//! use gsva::{ExprMatrix, GeneSet, GeneSets, GsvaParams};
14//!
15//! // Expression as genes × samples, stored row-major.
16//! let expr = ExprMatrix::new(
17//!     vec!["TP53".into(), "EGFR".into(), "MYC".into(), "PTEN".into()],
18//!     vec!["sample1".into(), "sample2".into(), "sample3".into()],
19//!     vec![
20//!         5.1, 6.2, 4.8, // TP53
21//!         2.0, 9.1, 3.3, // EGFR
22//!         7.7, 1.2, 8.0, // MYC
23//!         4.4, 4.6, 4.5, // PTEN
24//!     ],
25//! );
26//! let sets = GeneSets::new(vec![
27//!     GeneSet::new("proliferation", vec!["MYC".into(), "EGFR".into()]),
28//!     GeneSet::new("suppressors", vec!["TP53".into(), "PTEN".into()]),
29//! ]);
30//!
31//! // The free function and the module share the name `gsva`, so call it
32//! // qualified as `gsva::gsva` (or alias it on import).
33//! let res = gsva::gsva(&expr, &sets, &GsvaParams::default());
34//! assert_eq!(res.gene_sets, ["proliferation", "suppressors"]);
35//! let _proliferation_s2 = res.score(0, 1); // (gene-set index, sample index)
36//! ```
37//!
38//! Swap in [`ssgsea`], [`zscore`], or [`plage`] (with their `*Params`) for the
39//! other methods — they share the `(&ExprMatrix, &GeneSets, &Params) ->
40//! EnrichmentResult` shape.
41
42pub mod geneset;
43pub mod gsva;
44pub mod io;
45pub mod kcdf;
46pub mod matrix;
47mod par;
48pub mod plage;
49mod prep;
50pub mod rank;
51pub mod result;
52pub mod ssgsea;
53pub mod zscore;
54
55pub use geneset::{GeneSet, GeneSets};
56pub use gsva::{gsva, GsvaParams, Kcdf};
57pub use matrix::ExprMatrix;
58pub use plage::{plage, PlageParams};
59pub use result::EnrichmentResult;
60pub use ssgsea::{ssgsea, SsgseaParams};
61pub use zscore::{zscore, ZscoreParams};