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

mzpeaks

A library representing peaks in mass spectrometry data

31 releases (8 stable)

1.0.8 Mar 8, 2025
1.0.6 Jan 25, 2025
1.0.1 Dec 24, 2024
0.23.0 Nov 10, 2024
0.1.0 Jul 31, 2021

#199 in Data structures

Download history 199/week @ 2024-12-21 102/week @ 2024-12-28 25/week @ 2025-01-04 161/week @ 2025-01-11 285/week @ 2025-01-18 422/week @ 2025-01-25 440/week @ 2025-02-01 267/week @ 2025-02-08 198/week @ 2025-02-15 160/week @ 2025-02-22 141/week @ 2025-03-01 225/week @ 2025-03-08 162/week @ 2025-03-15 70/week @ 2025-03-22 83/week @ 2025-03-29 245/week @ 2025-04-05

565 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

~90–560KB
~11K SLoC