mzpeaks/lib.rs
1//! `mzpeaks` implements the building blocks and machinery for representing peaks
2//! in a mass spectrum.
3//!
4//! It's meant to be used as a building block for other tools and does not provide
5//! any I/O machinery for peak lists. For that, consider [`mzdata`](https://crates.io/crates/mzdata)
6//!
7//! ```rust
8//! use mzpeaks::{CentroidPeak, PeakSet, PeakCollection, Tolerance};
9//!
10//! let peaks = PeakSet::new(vec![
11//! CentroidPeak::new(186.04, 522.0, 0),
12//! CentroidPeak::new(204.07, 9800.0, 1),
13//! CentroidPeak::new(205.07, 150.0, 2)
14//! ]);
15//!
16//! assert_eq!(peaks.search(204.05, Tolerance::Da(0.02)).unwrap(), 1);
17//!
18//! let peak = match peaks.has_peak(204.05, Tolerance::Da(0.02)) {
19//! Some(p) => p,
20//! None => panic!("Failed to retrieve peak!")
21//! };
22//!
23//! assert!((peak.mz - 204.07).abs() < 1e-6);
24//!```
25
26pub mod coordinate;
27#[macro_use]
28pub mod macros;
29pub mod feature;
30pub mod feature_map;
31pub mod mass_error;
32pub mod peak;
33pub mod peak_set;
34pub mod prelude;
35#[cfg(test)]
36mod test_data;
37
38pub use crate::coordinate::{
39 CoordinateLike, CoordinateLikeMut, CoordinateRange, CoordinateRangeParseError, IndexType,
40 IndexedCoordinate, IonMobility, MZLocated, Mass, MassLocated, Time, MZ,
41};
42pub use crate::mass_error::{Tolerance, ToleranceParsingError};
43pub use crate::peak::{
44 CentroidLike, CentroidPeak, DeconvolutedCentroidLike, DeconvolutedPeak, IntensityMeasurement,
45 IntensityMeasurementMut, KnownCharge, KnownChargeMut,
46};
47pub use crate::peak_set::{
48 DeconvolutedPeakSet, MZPeakSetType, MassPeakSetType, PeakCollection, PeakSet,
49};