pub struct MultiLayerSpectrum<C = CentroidPeak, D = DeconvolutedPeak>where
C: CentroidLike,
D: DeconvolutedCentroidLike,{
pub description: SpectrumDescription,
pub arrays: Option<BinaryArrayMap>,
pub peaks: Option<PeakSetVec<C, MZ>>,
pub deconvoluted_peaks: Option<PeakSetVec<D, Mass>>,
}
Expand description
Represent a spectrum with multiple layers of representation of the peak data.
This type is useful because it permits us to hold spectra in incrementally more processed representations without loss of information.
Fields§
§description: SpectrumDescription
The spectrum metadata describing acquisition conditions and details.
arrays: Option<BinaryArrayMap>
The (potentially absent) data arrays describing the m/z, intensity, and potentially other measured properties
peaks: Option<PeakSetVec<C, MZ>>
§deconvoluted_peaks: Option<PeakSetVec<D, Mass>>
Implementations§
Source§impl<C, D> MultiLayerSpectrum<C, D>where
C: CentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
D: DeconvolutedCentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
impl<C, D> MultiLayerSpectrum<C, D>where
C: CentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
D: DeconvolutedCentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
pub fn new( description: SpectrumDescription, arrays: Option<BinaryArrayMap>, peaks: Option<PeakSetVec<C, MZ>>, deconvoluted_peaks: Option<PeakSetVec<D, Mass>>, ) -> MultiLayerSpectrum<C, D>
Sourcepub fn into_centroid(
self,
) -> Result<CentroidSpectrumType<C>, SpectrumConversionError>
pub fn into_centroid( self, ) -> Result<CentroidSpectrumType<C>, SpectrumConversionError>
Convert a spectrum into a CentroidSpectrumType
Sourcepub fn into_raw(self) -> Result<RawSpectrum, SpectrumConversionError>
pub fn into_raw(self) -> Result<RawSpectrum, SpectrumConversionError>
Convert a spectrum into a RawSpectrum
pub fn from_arrays_and_description( arrays: BinaryArrayMap, description: SpectrumDescription, ) -> MultiLayerSpectrum<C, D>
pub fn from_description( description: SpectrumDescription, ) -> MultiLayerSpectrum<C, D>
pub fn from_peaks_data_levels_and_description( peaks: PeakDataLevel<C, D>, description: SpectrumDescription, ) -> MultiLayerSpectrum<C, D>
pub fn from_spectrum_like<S>(spectrum: S) -> MultiLayerSpectrum<C, D>where
S: SpectrumLike<C, D>,
Source§impl<C, D> MultiLayerSpectrum<C, D>
impl<C, D> MultiLayerSpectrum<C, D>
Sourcepub fn try_build_peaks(
&mut self,
) -> Result<RefPeakDataLevel<'_, C, D>, SpectrumConversionError>
pub fn try_build_peaks( &mut self, ) -> Result<RefPeakDataLevel<'_, C, D>, SpectrumConversionError>
Attempt to reconstruct one of the peak layers based upon the available data arrays if this spectrum is in centroid mode.
§Errors
If constructing the peak list encounters an error, or if data array access/decoding fails,
a SpectrumConversionError
is returned.
pub fn try_build_centroids( &mut self, ) -> Result<&PeakSetVec<C, MZ>, SpectrumConversionError>
pub fn try_build_deconvoluted_centroids( &mut self, ) -> Result<&PeakSetVec<D, Mass>, SpectrumConversionError>
Trait Implementations§
Source§impl<C, D> Clone for MultiLayerSpectrum<C, D>
impl<C, D> Clone for MultiLayerSpectrum<C, D>
Source§fn clone(&self) -> MultiLayerSpectrum<C, D>
fn clone(&self) -> MultiLayerSpectrum<C, D>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<C, D> Debug for MultiLayerSpectrum<C, D>
impl<C, D> Debug for MultiLayerSpectrum<C, D>
Source§impl<C, D> Default for MultiLayerSpectrum<C, D>where
C: CentroidLike,
D: DeconvolutedCentroidLike,
impl<C, D> Default for MultiLayerSpectrum<C, D>where
C: CentroidLike,
D: DeconvolutedCentroidLike,
Source§fn default() -> MultiLayerSpectrum<C, D>
fn default() -> MultiLayerSpectrum<C, D>
Returns the “default value” for a type. Read more
Source§impl<C, D> From<CentroidSpectrumType<C>> for MultiLayerSpectrum<C, D>where
C: CentroidLike,
D: DeconvolutedCentroidLike,
impl<C, D> From<CentroidSpectrumType<C>> for MultiLayerSpectrum<C, D>where
C: CentroidLike,
D: DeconvolutedCentroidLike,
Source§fn from(spectrum: CentroidSpectrumType<C>) -> MultiLayerSpectrum<C, D>
fn from(spectrum: CentroidSpectrumType<C>) -> MultiLayerSpectrum<C, D>
Converts to this type from the input type.
Source§impl<CFeat, DFeat, CPeak, DPeak> From<MultiLayerIonMobilityFrame<CFeat, DFeat>> for MultiLayerSpectrum<CPeak, DPeak>where
CFeat: FeatureLike<MZ, IonMobility> + BuildArrayMap3DFrom,
DFeat: FeatureLike<Mass, IonMobility> + KnownCharge + BuildArrayMap3DFrom,
CPeak: CentroidLike + BuildFromArrayMap,
DPeak: DeconvolutedCentroidLike + BuildFromArrayMap,
impl<CFeat, DFeat, CPeak, DPeak> From<MultiLayerIonMobilityFrame<CFeat, DFeat>> for MultiLayerSpectrum<CPeak, DPeak>where
CFeat: FeatureLike<MZ, IonMobility> + BuildArrayMap3DFrom,
DFeat: FeatureLike<Mass, IonMobility> + KnownCharge + BuildArrayMap3DFrom,
CPeak: CentroidLike + BuildFromArrayMap,
DPeak: DeconvolutedCentroidLike + BuildFromArrayMap,
Source§fn from(
value: MultiLayerIonMobilityFrame<CFeat, DFeat>,
) -> MultiLayerSpectrum<CPeak, DPeak>
fn from( value: MultiLayerIonMobilityFrame<CFeat, DFeat>, ) -> MultiLayerSpectrum<CPeak, DPeak>
Converts to this type from the input type.
Source§impl<C, D> From<MultiLayerSpectrum<C, D>> for RawSpectrumwhere
C: CentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
D: DeconvolutedCentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
impl<C, D> From<MultiLayerSpectrum<C, D>> for RawSpectrumwhere
C: CentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
D: DeconvolutedCentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
Source§fn from(spectrum: MultiLayerSpectrum<C, D>) -> RawSpectrum
fn from(spectrum: MultiLayerSpectrum<C, D>) -> RawSpectrum
Converts to this type from the input type.
Source§impl<C, D> From<RawSpectrum> for MultiLayerSpectrum<C, D>
impl<C, D> From<RawSpectrum> for MultiLayerSpectrum<C, D>
Source§fn from(spectrum: RawSpectrum) -> MultiLayerSpectrum<C, D>
fn from(spectrum: RawSpectrum) -> MultiLayerSpectrum<C, D>
Converts to this type from the input type.
Source§impl<C, D> ParamDescribed for MultiLayerSpectrum<C, D>where
C: CentroidLike,
D: DeconvolutedCentroidLike,
impl<C, D> ParamDescribed for MultiLayerSpectrum<C, D>where
C: CentroidLike,
D: DeconvolutedCentroidLike,
Source§fn params_mut(&mut self) -> &mut Vec<Param>
fn params_mut(&mut self) -> &mut Vec<Param>
Obtain an mutable slice over the encapsulated
Param
listSource§fn extend_params(&mut self, it: impl IntoIterator<Item = Param>)
fn extend_params(&mut self, it: impl IntoIterator<Item = Param>)
Add all parameters from an iterator of
Param
to the entitySource§fn get_param_by_name(&self, name: &str) -> Option<&Param>
fn get_param_by_name(&self, name: &str) -> Option<&Param>
Find the first
Param
whose name matches name
Source§impl<C, D> SpectrumLike<C, D> for MultiLayerSpectrum<C, D>where
C: CentroidLike,
D: DeconvolutedCentroidLike,
impl<C, D> SpectrumLike<C, D> for MultiLayerSpectrum<C, D>where
C: CentroidLike,
D: DeconvolutedCentroidLike,
Source§fn description(&self) -> &SpectrumDescription
fn description(&self) -> &SpectrumDescription
The method to access the spectrum description itself, which supplies
the data for most other methods on this trait.
Source§fn description_mut(&mut self) -> &mut SpectrumDescription
fn description_mut(&mut self) -> &mut SpectrumDescription
The method to access the spectrum descript itself, mutably.
Source§fn peaks(&self) -> RefPeakDataLevel<'_, C, D>
fn peaks(&self) -> RefPeakDataLevel<'_, C, D>
Retrieve the most processed representation of the mass spectrum’s signal
Source§fn raw_arrays(&self) -> Option<&BinaryArrayMap>
fn raw_arrays(&self) -> Option<&BinaryArrayMap>
Obtain a reference to the
BinaryArrayMap
if one is available for the peak
information. This may not be the most refined version of the peak signal if
it has been processed further.fn into_peaks_and_description( self, ) -> (PeakDataLevel<C, D>, SpectrumDescription)
Source§fn acquisition(&self) -> &Acquisition
fn acquisition(&self) -> &Acquisition
Access the acquisition information for this spectrum.
Source§fn precursor_iter(&self) -> impl Iterator<Item = &Precursor>
fn precursor_iter(&self) -> impl Iterator<Item = &Precursor>
Iterate over all precursors of the spectrum
Source§fn precursor_mut(&mut self) -> Option<&mut Precursor>
fn precursor_mut(&mut self) -> Option<&mut Precursor>
Mutably access the precursor information, if it exists
Source§fn precursor_iter_mut(&mut self) -> impl Iterator<Item = &mut Precursor>
fn precursor_iter_mut(&mut self) -> impl Iterator<Item = &mut Precursor>
Iterate over all precursors of the spectrum mutably
Source§fn start_time(&self) -> f64
fn start_time(&self) -> f64
A shortcut method to retrieve the scan start time of a spectrum
Source§fn signal_continuity(&self) -> SignalContinuity
fn signal_continuity(&self) -> SignalContinuity
Access a description of how raw the signal is, whether a
profile spectrum is available or only centroids are present.
Source§fn polarity(&self) -> ScanPolarity
fn polarity(&self) -> ScanPolarity
Access a description of the spectrum polarity
Source§fn ion_mobility(&self) -> Option<f64>
fn ion_mobility(&self) -> Option<f64>
Access the point measure of ion mobility associated with the scan if present. This is distinct from
having a frame-level scan across the ion mobility dimension.
Source§fn has_ion_mobility(&self) -> bool
fn has_ion_mobility(&self) -> bool
Check if this spectrum has a point measure of ion mobility. This is distinct from
having a frame-level scan across the ion mobility dimension.
Source§fn has_ion_mobility_dimension(&self) -> bool
fn has_ion_mobility_dimension(&self) -> bool
Check if this spectrum has an ion mobility dimension/array. This is distinct from
having a scan-level point measure of ion mobility.
Source§fn has_ion_mobility_class(&self) -> HasIonMobility
fn has_ion_mobility_class(&self) -> HasIonMobility
A single point of entry for checking if ion mobility is present.
Source§fn update_summaries(&mut self)
fn update_summaries(&mut self)
Compute and update the the total ion current, base peak, and m/z range for
the spectrum based upon its current peak data. Read more
Source§impl<C, D> TryFrom<MultiLayerSpectrum<C, D>> for CentroidSpectrumType<C>where
C: CentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
D: DeconvolutedCentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
impl<C, D> TryFrom<MultiLayerSpectrum<C, D>> for CentroidSpectrumType<C>where
C: CentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
D: DeconvolutedCentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
Source§type Error = SpectrumConversionError
type Error = SpectrumConversionError
The type returned in the event of a conversion error.
Source§fn try_from(
spectrum: MultiLayerSpectrum<C, D>,
) -> Result<CentroidSpectrumType<C>, <CentroidSpectrumType<C> as TryFrom<MultiLayerSpectrum<C, D>>>::Error>
fn try_from( spectrum: MultiLayerSpectrum<C, D>, ) -> Result<CentroidSpectrumType<C>, <CentroidSpectrumType<C> as TryFrom<MultiLayerSpectrum<C, D>>>::Error>
Performs the conversion.
Source§impl<C, D> TryFrom<MultiLayerSpectrum<C, D>> for DeconvolutedSpectrumType<D>where
C: CentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
D: DeconvolutedCentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
impl<C, D> TryFrom<MultiLayerSpectrum<C, D>> for DeconvolutedSpectrumType<D>where
C: CentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
D: DeconvolutedCentroidLike + BuildFromArrayMap + BuildArrayMapFrom,
Source§type Error = SpectrumConversionError
type Error = SpectrumConversionError
The type returned in the event of a conversion error.
Source§fn try_from(
value: MultiLayerSpectrum<C, D>,
) -> Result<DeconvolutedSpectrumType<D>, <DeconvolutedSpectrumType<D> as TryFrom<MultiLayerSpectrum<C, D>>>::Error>
fn try_from( value: MultiLayerSpectrum<C, D>, ) -> Result<DeconvolutedSpectrumType<D>, <DeconvolutedSpectrumType<D> as TryFrom<MultiLayerSpectrum<C, D>>>::Error>
Performs the conversion.
Source§impl<CFeat, DFeat, CPeak, DPeak> TryFrom<MultiLayerSpectrum<CPeak, DPeak>> for MultiLayerIonMobilityFrame<CFeat, DFeat>where
CFeat: FeatureLike<MZ, IonMobility>,
DFeat: FeatureLike<Mass, IonMobility> + KnownCharge,
CPeak: CentroidLike,
DPeak: DeconvolutedCentroidLike,
impl<CFeat, DFeat, CPeak, DPeak> TryFrom<MultiLayerSpectrum<CPeak, DPeak>> for MultiLayerIonMobilityFrame<CFeat, DFeat>where
CFeat: FeatureLike<MZ, IonMobility>,
DFeat: FeatureLike<Mass, IonMobility> + KnownCharge,
CPeak: CentroidLike,
DPeak: DeconvolutedCentroidLike,
Source§type Error = ArrayRetrievalError
type Error = ArrayRetrievalError
The type returned in the event of a conversion error.
Source§fn try_from(
value: MultiLayerSpectrum<CPeak, DPeak>,
) -> Result<MultiLayerIonMobilityFrame<CFeat, DFeat>, <MultiLayerIonMobilityFrame<CFeat, DFeat> as TryFrom<MultiLayerSpectrum<CPeak, DPeak>>>::Error>
fn try_from( value: MultiLayerSpectrum<CPeak, DPeak>, ) -> Result<MultiLayerIonMobilityFrame<CFeat, DFeat>, <MultiLayerIonMobilityFrame<CFeat, DFeat> as TryFrom<MultiLayerSpectrum<CPeak, DPeak>>>::Error>
Performs the conversion.
Auto Trait Implementations§
impl<C, D> Freeze for MultiLayerSpectrum<C, D>
impl<C, D> RefUnwindSafe for MultiLayerSpectrum<C, D>where
C: RefUnwindSafe,
D: RefUnwindSafe,
impl<C, D> Send for MultiLayerSpectrum<C, D>
impl<C, D> Sync for MultiLayerSpectrum<C, D>
impl<C, D> Unpin for MultiLayerSpectrum<C, D>
impl<C, D> UnwindSafe for MultiLayerSpectrum<C, D>where
C: UnwindSafe,
D: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more