Expand description
Negative binomial differential expression for bulk and single-cell RNA-seq.
A Rust port of the edgeR numerical stack (normalisation, Cox-Reid dispersion
estimation, the Levenberg-damped negative binomial GLM, quasi-likelihood
weights, the exact test), the limma linear model stack (squeezeVar, the
F-distribution fits, voom, lmFit, contrasts.fit, eBayes, topTable),
and NEBULA, a negative binomial gamma mixed model for single cell.
The bulk stack follows edgePython, itself a port of edgeR and limma. Where
the two disagree, edgeR and limma win. NEBULA is ported from the nebula
package’s own C++.
§Numeric policy
Public containers and fits are generic over prelude::EdgeFloat, so
single-cell counts can be held as f32 and halve the memory. Likelihood
evaluation, Cox-Reid log-determinants, the optimisers and every p-value run
in f64 regardless of T: an NB deviance is a difference of large logs and
loses edgeR parity in f32 long before it saves anything.
§Parallelism
Genes are the parallel axis almost everywhere. Counts are gene-major, so one gene is a contiguous slice, and the fan-out is a rayon iterator over genes with a per-thread scratch buffer.
Normalisation is the exception: TMM’s unit of work is one sample against a reference column, so it parallelises over samples and transposes the counts once on entry. Any module departing from the gene-major rule says so in its own header.
Modules§
- core
- Containers and the per-sample quantities edgeR derives from raw counts.
- dispersion
- Dispersion estimation.
- errors
- The crate-level error enum.
- exact
- The classic two-group exact test, edgeR’s
exactTest. - glm
- Negative binomial generalised linear models, fitted per gene.
- limma
- The limma routines edgeR depends on, and the linear model stack on top.
- numeric
- The numerical support layer: everything edgePython reaches into
scipyfor. - prelude
- The types most modules want. Prefer
use crate::prelude::*;over deep imports in new code. - ql
- Quasi-likelihood machinery: edgeR’s
ql_weights.cand the adjusted deviances built on it. - results
- Ranking and calling: edgeR’s
topTagsanddecideTests. - sc
- NEBULA: negative binomial mixed models for single cell.
- splicing
diffSpliceDGE: differential exon usage.- utils
- Shared building blocks: trait bounds, SIMD kernels and the data structures every other module indexes through.