ms_chem/lib.rs
1//! # ms-chem — mass-spectrometry chemistry primitives
2//!
3//! The L0 leaf of the rustims crate federation: elements, amino-acid residues, sum formulas,
4//! isotopes, modifications, and backbone fragments. Pure Rust, no PyO3 — usable by any Rust MS
5//! consumer (the simulator is only the first).
6//!
7//! ## Provenance
8//!
9//! ms-chem unifies the three chemistry implementations that lived in the rustims monorepo
10//! (`mscore/chem`, `rustms/chem`, `timsim-chem`). It is not a fresh guess: every table and formula
11//! was chosen from those impls' *differential parity* evidence (`CHEM_PARITY.md`). The canonical
12//! semantics:
13//!
14//! - **Element masses** — identical across impls; adopted verbatim ([`elements`]).
15//! - **Residue masses** — *computed from elements*, a single source of truth ([`residue`]).
16//! - **Isotopic abundances** — the newer CIAAW values (N/S differed; resolved) — *(isotope module,
17//! next increment)*.
18//! - **Proton** — full CODATA `1.007276466621` ([`mass::PROTON`]).
19//! - **Modifications / fragments** — a unified cross-checked table and typed b/y ions — *(next
20//! increments)*.
21//!
22//! The parity suite that proved the equivalence rides along as ms-chem's regression gate.
23
24pub mod elements;
25pub mod formula;
26pub mod fragment;
27pub mod isotope;
28pub mod mass;
29pub mod modification;
30pub mod residue;
31pub mod unimod;
32
33pub use formula::FormulaError;
34pub use fragment::{fragment_ions, Fragment, IonType};
35pub use isotope::{envelope, EnvelopeError};
36pub use mass::{monoisotopic, mz, UnknownResidue, PROTON, WATER};
37pub use modification::{by_id as modification_by_id, Modification, BUILTIN as BUILTIN_MODIFICATIONS};
38pub use unimod::mass_delta as unimod_mass_delta;
39pub use residue::{peptide_composition, residue_composition, residue_monoisotopic_mass, Composition};