Expand description
The data structures and components that represent a mass spectrum and how to access their data.
A mass spectrum is made up of multiple components, the spectrum’s signal data itself, plus all the metadata that describes how that data was acquired by the instrument.
§Components
bindata
includes structures for dealing with raw binary data arrays that may or may not be byte-encoded but not strongly typed, though it does not include signal processing as that is outside the scope of this crate.
§Spectra
Represent the collection of attributes and data that compose a single mass spectrum.
Because a mass spectrum may be obtained from sources with varying levels of detail, several alternative structures are provided with a common set of trait-based methods to unify access:
RawSpectrum
for representing a spectrum that has not been decoded into distinct peaks yet, but whose data may be continuous or discrete.CentroidSpectrum
for representing spectra from sources which are guaranteed to be pre-centroided, like those from MGF files or other simple text representations.Spectrum
for representing a multi-layer representation of a spectrum where both raw data and a distinct peak list are available.
These structures all implement the SpectrumDescription
trait
The SpectrumDescription
trait is included in the crate prelude, and gives the caller
read-only access to components that describe a spectrum’s metadata.
use mzpeaks::Tolerance;
use mzdata::MzMLReader;
use mzdata::prelude::*;
use mzdata::spectrum::SignalContinuity;
let reader = MzMLReader::open_path("./test/data/small.mzML").unwrap();
for spectrum in reader {
println!("Scan {} => BP {}", spectrum.id(), spectrum.peaks().base_peak().mz);
if spectrum.signal_continuity() < SignalContinuity::Profile {
let peak_picked = spectrum.into_centroid().unwrap();
println!("Matches for 579.155: {:?}",
peak_picked.peaks.all_peaks_for(
579.155, Tolerance::Da(0.02)));
}
}
Re-exports§
pub use crate::spectrum::bindata::ArrayType;
pub use crate::spectrum::bindata::BinaryArrayMap;
pub use crate::spectrum::bindata::BinaryDataArrayType;
pub use crate::spectrum::bindata::DataArray;
Modules§
Structs§
- Describe the series of acquisition events that constructed the spectrum being described.
- Describes the activation method used to dissociate the precursor ion
- Represents a spectrum that has been centroided
- The set of descriptive metadata that give context for how a chromatogram was recorded.
- Represents a spectrum that has been centroided, deisotoped, and charge state deconvolved
- The interval around the precursor ion that was isolated in the precursor scan. Although an isolation window may be specified either with explicit bounds or offsets from the target, this data structure always uses explicit bounds once it is in a
IsolationWindowState::Complete
. - Represent a spectrum with multiple layers of representation of the peak data.
- Describes the precursor ion of the owning spectrum.
- Represents a spectrum that hasn’t been processed yet, with only data arrays, potentially no discrete peaks.
- Describes a single scan event. Unless additional post-processing is done, there is usually only one event per spectrum.
- The m/z range which was scanned
- Describes a single selected ion from a precursor isolation
- Wrap a
[SpectrumGroupingIterator]
to average MS1 spectra over - The set of descriptive metadata that give context for how a mass spectrum was acquired within a particular run. This forms the basis for a large portion of the
SpectrumDescription
trait. - A pairing of an optional MS1 spectrum with all its associated MSn spectra.
- Iterate over the spectra in
SpectrumGroup
- A wrapper for
Iterator
-implementors that will batch together all MSn spectra with their associated MS1 spectrum, producingSpectrumGroup
instances.
Enums§
- Types of chromatograms enumerated in the PSI-MS controlled vocabulary
- Describe the initialization stage of an isolation window
- An variant for dispatching to different strategies of computing common statistics of different levels of peak data.
- Represents means by which a spectrum is generated using one or more instrument analyzers
- Describes the polarity of a mass spectrum. A spectrum is either
Positive
(1+),Negative
(-1) orUnknown
(0). TheUnknown
state is the default. - Describes the initial representation of the signal of a spectrum.
- Errors that may arise when converting between different SpectrumBehavior-like types
- Errors that may arise when performing signal processing or other data transformation
Traits§
- A blanket trait that ties together all the assumed behaviors of an m/z coordinate centroid peak
- A blanket trait that ties together all the assumed behaviors of an neutral mass coordinate centroid peak
- Describe the precursor ion that this entity represents
- A trait for abstracting over how a precursor ion is described, immutably.
- Adds signal averaging to an
Iterator
that producesSpectrumGrouping
implementations of the appropriate type. - A trait for providing a uniform delegated access to spectrum metadata
Functions§
- Average a series of
MultiLayerSpectrum
together
Type Aliases§
- A ready-to-use parameterized type for representing a spectrum in multiple overlapping layers.