Expand description
koth_ff: A high-performance LC-MS feature finder for timsTOF and mzML data.
The in-memory detection stages live in the koth_core crate, which has no
file I/O or native dependencies. They are re-exported here at their original
paths (koth_ms::hills, koth_ms::models, koth_ms::config::KothConfig,
koth_ms::run_features, …); this crate adds the mzML, Bruker .d and
Thermo .raw readers, the output writers, cross-run alignment and LFQ, and
the koth_ff / koth_align executables.
§Pipeline
- Hill detection – groups MS1 peaks across scans into chromatographic hills
- Feature finding – groups hills into isotope envelopes with charge state assignment
- Scoring – scores isotope pattern quality using the averagine model
§Quick start
use std::path::Path;
use koth_ms::{run_hills, run_features, run_scoring, config::KothConfig};
let config = KothConfig::default();
let input = Path::new("data.mzML");
let spectra = koth_ms::read_spectra(input, &config.file).unwrap();
let hills = run_hills(&spectra, &config.hills, &config.file);
let features = run_features(&hills, &config.features, &config.file).unwrap();
let scored = run_scoring(&features, &config.scoring, &config.features, config.file.polarity);Re-exports§
pub use pipeline::run_pipeline;pub use pipeline::run_pipeline_streaming;pub use pipeline::run_pipeline_with_ms2;
Modules§
- alignment
- config
- Configuration. The
koth_ffdetection settings ([file],[hills],[hills_ms2],[features],[scoring],[output]andKothConfig) live inkoth-coreand are re-exported here at their original paths; this module adds thekoth_alignconfiguration. - error
- features
- hills
- input
- io
- lfq
- mem
- models
- output
- pipeline
- In-process / streaming feature-finding API.
- scoring
- stats
- Small shared numeric helpers.
Structs§
- Feature
- A detected isotope feature: a group of hills forming an isotope envelope.
- Feature
Finding Output - Owned, in-memory result of a full run — the convenience shape for consumers
(like
uno) that just want the final lists rather than a streaming callback. - Hill
- A finalized chromatographic hill (elution peak for a single m/z trace).
- Isolation
Window - Precursor isolation window for an MS2 spectrum (mzML coordinates).
- Pipeline
Options - Knobs that mirror the
koth_ffbinary’s optional stages. Everything else is taken from theKothConfigpassed in explicitly. - Scored
Feature - Feature with isotope pattern scoring applied.
- Spectrum
- A single mass spectrum with all its peaks.
Enums§
- Polarity
- Ion polarity: which way the charge-carrying adduct shifts m/z, and so which way to undo it when recovering a neutral mass.
Constants§
- VERSION
- Crate version with the git commit it was built from, e.g.
0.1.0 (a1b2c3d4e5f6), or0.1.0 (a1b2c3d4e5f6-dirty)when the working tree had uncommitted changes.
Traits§
- Pipeline
Sink - A consumer notified as pipeline stages finalize.
Functions§
- group_
ms2_ hills_ by_ window - Group a finalized MS2 hill set by its precursor isolation window, in a
deterministic order (sorted by
IsolationWindow::key). - read_
spectra - Read MS1 spectra from an mzML file or Bruker .d directory.
- run_
features - Stage 2: Detect isotope features from hills.
- run_
hills - Stage 1: Detect chromatographic hills from MS1 spectra.
- run_
hills_ streaming - Stage 1 (streaming): Detect hills from mzML, Bruker
.d, or Thermo.rawusing bounded spectrum buffers. Completed hills are retained for assembly; native readers also retain scan metadata. Decoy shuffling and optional TIC normalization still collect spectra. Gzipped mzML is decompressed as it is parsed, never held whole in memory. - run_
ms2_ hills_ streaming - Stage 1 (MS2): Detect MS2 hills partitioned by the precursor isolation window of each MS2 spectrum (DIA channels).
- run_
pipeline_ from_ spectra - Convenience: run the pipeline from an in-memory spectrum iterator and collect all hills and features into owned vectors.
- run_
pipeline_ streaming_ from_ spectra - Run the full pipeline from an in-memory iterator of spectra, streaming
results to
sink. No files are written and noVec<Spectrum>is retained (unlesshills.tic_norm_window > 0orfile.decoy_mode, which inherently need the whole set — matching the binary). - run_
scoring - Stage 3: Score isotope features using the averagine model.