Skip to main content

Crate ms_chem

Crate ms_chem 

Source
Expand description

§ms-chem — mass-spectrometry chemistry primitives

The L0 leaf of the rustims crate federation: elements, amino-acid residues, sum formulas, isotopes, modifications, and backbone fragments. Pure Rust, no PyO3 — usable by any Rust MS consumer (the simulator is only the first).

§Provenance

ms-chem unifies the three chemistry implementations that lived in the rustims monorepo (mscore/chem, rustms/chem, timsim-chem). It is not a fresh guess: every table and formula was chosen from those impls’ differential parity evidence (CHEM_PARITY.md). The canonical semantics:

  • Element masses — identical across impls; adopted verbatim (elements).
  • Residue masses — computed from elements, a single source of truth (residue).
  • Isotopic abundances — the newer CIAAW values (N/S differed; resolved) — (isotope module, next increment).
  • Proton — full CODATA 1.007276466621 (mass::PROTON).
  • Modifications / fragments — a unified cross-checked table and typed b/y ions — (next increments).

The parity suite that proved the equivalence rides along as ms-chem’s regression gate.

Re-exports§

pub use formula::FormulaError;
pub use fragment::fragment_ions;
pub use fragment::Fragment;
pub use fragment::IonType;
pub use isotope::envelope;
pub use isotope::EnvelopeError;
pub use mass::monoisotopic;
pub use mass::mz;
pub use mass::UnknownResidue;
pub use mass::PROTON;
pub use mass::WATER;
pub use modification::by_id as modification_by_id;
pub use modification::Modification;
pub use modification::BUILTIN as BUILTIN_MODIFICATIONS;
pub use unimod::mass_delta as unimod_mass_delta;
pub use residue::peptide_composition;
pub use residue::residue_composition;
pub use residue::residue_monoisotopic_mass;
pub use residue::Composition;

Modules§

elements
Elements — monoisotopic masses of the neutral atoms.
formula
Sum-formula parsing — "C2H3NO" → element counts → monoisotopic mass.
fragment
Backbone fragment ions (b / y) — the m/z ladders of a peptide broken at the amide bond.
isotope
Isotope envelopes — the relative intensities of a peptide’s monoisotopic peak and its heavier neighbours.
mass
Peptide mass and m/z.
modification
Modifications — a single coverage-consistent table pairing mass and composition.
residue
Amino-acid residues — elemental composition and monoisotopic mass.
unimod
UNIMOD modification masses — the full monoisotopic mass-delta table (mass-only lookup).