Expand description
§xcell — a pure-Rust port of xCell 1.1.0
xCell (Aran, Hu & Butte, Genome
Biology 2017) scores 64 immune and stromal cell types from bulk expression.
This crate is a faithful, dependency-light Rust re-implementation of the
xCell 1.1.0 pipeline, built on the gsva ssGSEA engine:
rawEnrichmentAnalysis— keep genes shared with xCell’s universe, per-sample average-tie rank, unnormalized ssGSEA over the 489 signatures, subtract each signature’s minimum, average signatures per cell type.transformScores— per-cell-type power-curve calibration.spillOver— per-sample non-negative least squares against the compensation matrixKto remove cross-cell-type spillover.microenvironmentScores— appendImmuneScore,StromaScore, andMicroenvironmentScore.
The bundled model data (signatures, gene universe, spillover matrix, and calibration table) is exported from the GPL-3 xCell package; this crate is therefore licensed GPL-3.0-or-later.
§Example
use xcell::{xcell_analysis, ExprMatrix, XCellModel, XCellParams};
// expr: genes (rows, labelled by symbol) × samples (columns).
let expr: ExprMatrix = xcell::io::read_tsv_matrix(&std::fs::read_to_string("expr.tsv").unwrap());
let model = XCellModel::load();
let scores = xcell_analysis(&expr, &model, &XCellParams::default());
println!("{} rows × {} samples", scores.gene_sets.len(), scores.samples.len());Loading the embedded model on its own is cheap and infallible:
let model = xcell::XCellModel::load();
assert_eq!(model.cell_types.len(), 64);Re-exports§
pub use data::SpillModel;pub use data::XCellModel;pub use xcell::xcell_analysis;pub use xcell::XCellParams;
Modules§
- data
- Embedded xCell model data (xCell 1.1.0): the signatures, the scoring-gene
universe, the spillover matrix
K, and the calibration tablefv, for both the RNA-seq and the microarray spill objects. All of it is exported from the GPL-3 xCell package bybenchmarks/export_xcell_data.R; xcell-rust is itself GPL-3.0-or-later, so bundling it is license-clean. - io
- Minimal, dependency-free TSV reader for expression matrices.
- microenv
- Stage 4 of xCell:
microenvironmentScores. - rawenrich
- Stage 1 of xCell:
rawEnrichmentAnalysis. - spillover
- Stage 3 of xCell:
spillOver. - transform
- Stage 2 of xCell:
transformScores. - xcell
- The xCell pipeline entry point:
xCellAnalysis.
Structs§
- Enrichment
Result - Result of a gene-set enrichment run: a per-set score for each sample.
- Expr
Matrix - An expression matrix with named rows (features/genes) and columns (samples).
- GeneSet
- A named gene set: a signature name and its member gene identifiers.
- Gene
Sets - An ordered collection of
GeneSets.