1 unstable release
Uses new Rust 2024
| 0.1.0 | Feb 16, 2026 |
|---|
#690 in Biology
Used in tru-ols
415KB
7K
SLoC
TRU-OLS (Truncated ReUnmixing Ordinary Least Squares) algorithm for flow cytometry unmixing.
This crate implements the TRU-OLS algorithm, which reduces the variance of unmixed abundance distributions by removing irrelevant endmembers (dyes) from the mixing matrix on a per-event basis.
Overview
TRU-OLS is a variant of stepwise regression that uses unstained control data to determine which endmembers are relevant for each event. By unmixing each event with only its relevant endmembers, the algorithm reduces variance and improves separation between populations.
Basic Usage
use flow_tru_ols::{TruOls, UnmixingStrategy};
use faer::mat;
// Mixing matrix (detectors × endmembers), unstained control (events × detectors)
let mixing_matrix = mat![
[0.9, 0.1],
[0.1, 0.9],
[0.05, 0.05],
];
let unstained_control = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
let dataset = mat![[100.0, 50.0, 10.0], [200.0, 150.0, 20.0]];
// Create a TRU-OLS instance (autofluorescence is endmember index 1)
let mut tru_ols = TruOls::new(mixing_matrix, unstained_control.clone(), 1)?;
// Configure the algorithm
tru_ols.set_cutoff_percentile(0.995, unstained_control.as_ref())?;
tru_ols.set_strategy(UnmixingStrategy::Zero);
// Unmix a dataset
let unmixed = tru_ols.unmix(dataset.as_ref())?;
Dependencies
~51–82MB
~1.5M SLoC