#mass-spectrometry #data #tolerance #peak #peaks

mzpeaks

A library representing peaks in mass spectrometry data

32 releases (9 stable)

new 1.0.9 May 25, 2025
1.0.8 Mar 8, 2025
1.0.7 Feb 11, 2025
1.0.1 Dec 24, 2024
0.1.0 Jul 31, 2021

#208 in Data structures

Download history 420/week @ 2025-01-31 283/week @ 2025-02-07 181/week @ 2025-02-14 166/week @ 2025-02-21 154/week @ 2025-02-28 231/week @ 2025-03-07 153/week @ 2025-03-14 82/week @ 2025-03-21 84/week @ 2025-03-28 95/week @ 2025-04-04 201/week @ 2025-04-11 40/week @ 2025-04-18 121/week @ 2025-04-25 59/week @ 2025-05-02 76/week @ 2025-05-09 78/week @ 2025-05-16

350 downloads per month
Used in 10 crates (7 directly)

Apache-2.0

350KB
9K SLoC

mzpeaks implements the building blocks and machinery for representing peaks in a mass spectrum.

It's meant to be used as a building block for other tools and does not provide any I/O machinery for peak lists. For that, consider mzdata

use mzpeaks::{CentroidPeak, PeakSet, PeakCollection, Tolerance};

let peaks = PeakSet::new(vec![
    CentroidPeak::new(186.04, 522.0, 0),
    CentroidPeak::new(204.07, 9800.0, 1),
    CentroidPeak::new(205.07, 150.0, 2)
]);

assert_eq!(peaks.search(204.05, Tolerance::Da(0.02)).unwrap(), 1);

let peak = match peaks.has_peak(204.05, Tolerance::Da(0.02)) {
    Some(p) => p,
    None => panic!("Failed to retrieve peak!")
};

assert!((peak.mz - 204.07).abs() < 1e-6);

mzpeaks

Latest Version

mzpeaks implements the building blocks and machinery for representing peaks in a mass spectrum.

It's meant to be used as a building block for other tools and does not provide any I/O machinery for peak lists

Usage

use mzpeaks::{CentroidPeak, PeakSet, PeakCollection, Tolerance};

let peaks = PeakSet::new(vec![
    CentroidPeak::new(186.04, 522.0, 0),
    CentroidPeak::new(204.07, 9800.0, 1),
    CentroidPeak::new(205.07, 150.0, 2)
]);

assert_eq!(peaks.search(204.05, Tolerance::Da(0.02)).unwrap(), 1);

let peak = match peaks.has_peak(204.05, Tolerance::Da(0.02)) {
    Some(p) => p,
    None => panic!("Failed to retrieve peak!")
};

assert!((peak.mz - 204.07).abs() < 1e-6);

Dependencies

~89–560KB
~11K SLoC