Skip to main content

edge_rs/
lib.rs

1//! Negative binomial differential expression for bulk and single-cell RNA-seq.
2//!
3//! A Rust port of the edgeR numerical stack (normalisation, Cox-Reid dispersion
4//! estimation, the Levenberg-damped negative binomial GLM, quasi-likelihood
5//! weights, the exact test), the limma linear model stack (`squeezeVar`, the
6//! F-distribution fits, voom, `lmFit`, `contrasts.fit`, `eBayes`, `topTable`),
7//! and NEBULA, a negative binomial gamma mixed model for single cell.
8//!
9//! The bulk stack follows edgePython, itself a port of edgeR and limma, with
10//! the R winning wherever the two disagree. NEBULA is ported from the `nebula`
11//! package's own C++ instead.
12//!
13//! ### Numeric policy
14//!
15//! Public containers and fits are generic over [`prelude::EdgeFloat`], so
16//! single-cell counts can be held as `f32` and halve the memory. Likelihood
17//! evaluation, Cox-Reid log-determinants, the optimisers and every p-value run
18//! in `f64` regardless of `T`. A negative binomial deviance is a difference of
19//! large logs, and accumulating one in `f32` loses parity with edgeR well
20//! before it saves anything worth having.
21//!
22//! ### Parallelism
23//!
24//! Genes are the parallel axis almost everywhere. Counts are stored gene-major,
25//! so one gene is a contiguous slice, and the fan-out is a rayon iterator over
26//! genes with a per-thread scratch buffer.
27//!
28//! Normalisation is the exception, and deliberately so: TMM has no gene axis to
29//! fan out over, since the unit of work is one sample compared against a
30//! reference column. It parallelises over samples and transposes the counts
31//! once on entry so each sample is contiguous. Any module that departs from the
32//! gene-major rule says so in its own header.
33
34#![warn(missing_docs)]
35
36pub mod core;
37pub mod dispersion;
38pub mod errors;
39pub mod exact;
40pub mod glm;
41#[cfg(feature = "gpu")]
42pub mod gpu;
43pub mod limma;
44pub mod numeric;
45pub mod prelude;
46pub mod ql;
47pub mod results;
48pub mod sc;
49pub mod splicing;
50pub mod utils;