38 breaking releases

0.39.0 Nov 30, 2024
0.37.0 Nov 29, 2024
0.25.0 Jul 26, 2024
0.13.0 Mar 29, 2024
0.3.0 Jul 23, 2021

#478 in Parser implementations

Download history 189/week @ 2024-08-19 343/week @ 2024-08-26 316/week @ 2024-09-02 104/week @ 2024-09-09 155/week @ 2024-09-16 308/week @ 2024-09-23 196/week @ 2024-09-30 26/week @ 2024-10-07 340/week @ 2024-10-14 77/week @ 2024-10-21 274/week @ 2024-10-28 64/week @ 2024-11-04 234/week @ 2024-11-11 211/week @ 2024-11-18 487/week @ 2024-11-25 454/week @ 2024-12-02

1,390 downloads per month
Used in 4 crates

Apache-2.0

1.5MB
32K SLoC

mzdata

Latest Version docs.rs

A Rust library for reading mass spectrometry data file formats.

Quickstart

use std::fs;
use mzdata::prelude::*;
use mzpeaks::Tolerance;
use mzdata::MzMLReader;
use mzdata::spectrum::SignalContinuity;

fn main() {
    let mut ms1_count = 0;
    let mut msn_count = 0;
    let reader = MzMLReader::new(fs::File::open("./test/data/small.mzML").unwrap());
    for spectrum in reader {
        if spectrum.ms_level() == 1 {
            ms1_count += 1;
        } else {
            msn_count += 1;
        }
        println!("Scan {} => BP {}", spectrum.id(), spectrum.peaks().base_peak().mz);
        if spectrum.signal_continuity() == SignalContinuity::Centroid {
            let peak_picked = spectrum.into_centroid().unwrap();
            println!("Matches for 579.155: {:?}", peak_picked.peaks.all_peaks_for(579.155, Tolerance::Da(0.02)));
        }
    }
    println!("MS1 Count: {}\nMSn Count: {}", ms1_count, msn_count);
    assert_eq!(ms1_count, 14);
    assert_eq!(msn_count, 34);
}


Supported Formats

  1. mzML and indexedmzML
  2. MGF
  3. mzMLb
  4. Thermo RAW

Disclaimer

This library was made in part to learn Rust, so it may not use the preferred idioms, patterns, or libraries. Any recommendations are welcome.

Dependencies

~7–39MB
~569K SLoC