#mass-spectrometry #peak #tolerance #machinery #spectral #peaks #centroid-peak

mzpeaks

A library representing peaks in mass spectrometry data

21 breaking releases

new 0.22.0 Oct 14, 2024
0.20.0 Aug 29, 2024
0.17.0 Jul 12, 2024
0.11.0 Feb 21, 2024
0.1.0 Jul 31, 2021

#2 in #peak

Download history 228/week @ 2024-06-26 33/week @ 2024-07-03 194/week @ 2024-07-10 92/week @ 2024-07-17 35/week @ 2024-07-24 10/week @ 2024-07-31 248/week @ 2024-08-07 65/week @ 2024-08-14 85/week @ 2024-08-21 360/week @ 2024-08-28 131/week @ 2024-09-04 141/week @ 2024-09-11 113/week @ 2024-09-18 136/week @ 2024-09-25 213/week @ 2024-10-02 270/week @ 2024-10-09

736 downloads per month
Used in 7 crates

Apache-2.0

230KB
6K SLoC

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);

lib.rs:

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);

Dependencies

~94–320KB