Skip to main content

Crate mzcore

Crate mzcore 

Source
Expand description

§(Proteomics) core for mass spectrometry in Rust

Handle mass spectrometry calculations in Rust. This crate is mostly used for proteomics data in the broadest sense: bottom-up, top-down, cross-linking, glycopeptidomics, and much more. Support for other mass spectrometry fields is not missing by design but by lack of expertise of the authors, so if you are doing something mass spectrometry related and need some extensions to this crate please reach out.

§Library features

  • Read ProForma sequences (complete specification supported: ‘level 2-ProForma + top-down compliant + cross-linking compliant + glycans compliant + mass spectrum compliant version 2.1’)
  • Handle glycans
  • Has GNOme database built-in with all structures
  • Can render glycan structures as well as fragments of structures (use feature glycan-render)
  • Exhaustively fuzz tested for reliability (using cargo-afl)
  • Extensive use of uom for compile time unit checking
  • Handle molecular formula, mass + average weight + most abundant mass (for the latter use feature isotopes)
  • Generate isotopic patterns (use feature isotopes)
  • Access to Unimod, PSI-MOD, RESID, GNOme, and XL-MOD databases statically and possible to update at runtime

§Compilation features

  • isotopes - gives access to generation of an averagine model for isotopes, also enables two additional dependencies.
  • glycan-render - enables the rendering to SVGs for glycans and glycan fragments
  • glycan-render-bitmap - enables the rendering to bitmaps for glycans, by enabling the optional dependencies zeno and swash

§Changelog

§0.2.0

  • Made mass calculations generic, they can now either calculate as MolecularFormula or as Mass directly, the latter is faster (2.5 times so in some benchmarks) but makes it impossible to generate isotopic distributions or to calculate most abundant isotope. To do this the trait Chemical has been updated with a lot of additional functions, but still needs only one function to be imnplemented. No changes should be needed if the previous behaviour is to be retained, except that the trait Chemical has been renamed to Molecule, and MultiChemical to AmbiguousMolecule. Peptidoforms, ions, and sets now implement the Molecule trait as well which should mean that it is easier to calculate the masses there as well.
  • CompoundPeptidoformIon has been renamed to PeptidoformIonSet as decided for ProForma 2.1.
  • ProForma 2.1 is now released and fully supported in mzcore.
  • PlacementRule Anywhere and Terminal have been combined into PlacementRule::Position.
  • OpenSMILES v1.0 is now supported (only reading and converting to MolecularFormula).
  • Molecular formulas can now be formatted in PSI-MOD and XLMOD notation alongside the already in place ProForma notation.
  • Tracked positions of modifications for monosaccharides (not all positions are parsed yet from short IUPAC, open an issue if this is needed).
  • Removed all styling options from glycan rendering functions in favour of a struct with these options. New options are control over the modifications, if they should be rendered, and if the positions should be rendered.
  • The CrossId has been broken into the different options leading to more precise parsing, and the ability to fix formatting issues in Obo files.
  • Added shrink_to_fit functions to trim any unnecessary empty space from Vecs, Strings, and the like.
  • Used wider dependency definitions to be less likely to lead to duplicated dependencies.
  • Added charges when defined in PSI-MOD
  • Added stubs when defined in XLMOD
  • Updated static modification databases

Modules§

chemistry
Contains all things related to the underlying chemistry.
csv
Parse CSV files while keeping track of all necessary info to generate great error messages Methods for reading and parsing CSV files. (Internal use mostly).
glycan
Handle glycan related issues, access provided if you want to work with glycans on your own.
ontology
Ontologies or controlled vocabularies or databases of modifications
parse_json
Contains logic to parse the custom modifications and custom models databases with backwards compatibility
prelude
A subset of the types and traits that are envisioned to be used the most, importing this is a good starting point for working with the crate
quantities
Contains all things related to tolerances and structures to handle multiple mass/formula options.
sequence
Contains all things related to sequences, amongst others amino acids and peptidoforms.
system
The measurement system used in this crate. A redefinition of the important SI units for them to be stored in a more sensible base unit for MS purposes.

Macros§

Q
Macro to implement Quantity type aliases for a specific system of units and value storage type.
molecular_formula
Easily define molecular formulas using the following syntax: <element> <num> or [<isotope> <element> <num>]. The spaces are required by the Rust compiler.

Type Aliases§

ParserResult
The result of a parser, contains the result and a list of warnings if it succeeded and only a list of errors if it failed.