Crate mzpeaks

Crate mzpeaks 

Source
Expand description

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

Re-exports§

pub use crate::coordinate::CoordinateLike;
pub use crate::coordinate::CoordinateLikeMut;
pub use crate::coordinate::CoordinateRange;
pub use crate::coordinate::CoordinateRangeParseError;
pub use crate::coordinate::IndexType;
pub use crate::coordinate::IndexedCoordinate;
pub use crate::coordinate::IonMobility;
pub use crate::coordinate::MZLocated;
pub use crate::coordinate::Mass;
pub use crate::coordinate::MassLocated;
pub use crate::coordinate::Time;
pub use crate::coordinate::MZ;
pub use crate::mass_error::Tolerance;
pub use crate::mass_error::ToleranceParsingError;
pub use crate::peak::CentroidLike;
pub use crate::peak::CentroidPeak;
pub use crate::peak::DeconvolutedCentroidLike;
pub use crate::peak::DeconvolutedPeak;
pub use crate::peak::IntensityMeasurement;
pub use crate::peak::IntensityMeasurementMut;
pub use crate::peak::KnownCharge;
pub use crate::peak::KnownChargeMut;
pub use crate::peak_set::DeconvolutedPeakSet;
pub use crate::peak_set::MZPeakSetType;
pub use crate::peak_set::MassPeakSetType;
pub use crate::peak_set::PeakCollection;
pub use crate::peak_set::PeakSet;

Modules§

coordinate
A type system implementation of a coordinate system that attempts to deal with the different dimensions an observation may be placed in simultaneously.
feature
A feature is a two dimensional mass spectrum concept for a measure over some time unit. It represents something that is located at a constrained but varying coordinate system X over a sequentially ordered dimension Y with an abundance measure at each time point.
feature_map
Collections of features that are ordered and searchable by a coordinate, support fast access and are growable. While the main behaviors are provided through the FeatureMapLike generic trait, a (generic) full implementation is given by FeatureMap.
macros
mass_error
Measure accuracy error tolerance ranges
peak
A peak is the most atomic unit of a (processed) mass spectrum. It represents a location in one (or more) coordinate spaces with an measured intensity value
peak_set
Collections of peaks that are ordered and searchable by a coordinate, support fast access and are growable. While the main behaviors are provided through the PeakCollection generic trait, a (generic) full implementation is given by PeakSetVec.
prelude
A prelude to bring into scope all the traits of this library.

Macros§

implement_centroid_conversion
implement_centroidlike
The first argument is the type, the second is whether to strictly adhere to the indexing requirement.
implement_centroidlike_inner
The first argument is the type, the second is whether to strictly adhere to the indexing requirement, and the third is whether or not to generate From specializations.
implement_deconvoluted_centroid_conversion
implement_deconvoluted_centroidlike
The first argument is the type, the second is whether to strictly adhere to the indexing requirement.
implement_deconvoluted_centroidlike_inner
The first argument is the type, the second is whether to strictly adhere to the indexing requirement, and the third is whether or not to generate From specializations.
implement_mass_coord
implement_mz_coord
A set of code generation macros to make a type behave as CentroidLike or DeconvolutedCentroidLike.