pub struct RawSpectrum {
pub description: SpectrumDescription,
pub arrays: BinaryArrayMap,
}Expand description
Represents a spectrum that hasn’t been processed yet, with only data arrays, potentially no discrete peaks. A raw spectrum may still be centroided, but the peaks still need to be decoded.
Fields§
§description: SpectrumDescriptionThe spectrum metadata describing acquisition conditions and details.
arrays: BinaryArrayMapThe data arrays describing the m/z, intensity, and potentially other measured properties
Implementations§
Source§impl<'transient, 'lifespan> RawSpectrumwhere
'lifespan: 'transient,
impl<'transient, 'lifespan> RawSpectrumwhere
'lifespan: 'transient,
pub fn new( description: SpectrumDescription, arrays: BinaryArrayMap, ) -> RawSpectrum
Sourcepub fn into_centroid<C>(
self,
) -> Result<CentroidSpectrumType<C>, SpectrumConversionError>where
C: BuildFromArrayMap + CentroidLike,
pub fn into_centroid<C>(
self,
) -> Result<CentroidSpectrumType<C>, SpectrumConversionError>where
C: BuildFromArrayMap + CentroidLike,
Convert a spectrum into a CentroidSpectrumType.
§Errors
This operation returns SpectrumConversionError::NotCentroided if the
SpectrumLike::signal_continuity != SignalContinuity::Centroid.
§See also
To pick peaks from profile data, see RawSpectrum::pick_peaks_into
Sourcepub fn mzs(&'lifespan self) -> Cow<'transient, [f64]>
pub fn mzs(&'lifespan self) -> Cow<'transient, [f64]>
Access the m/z array.
§Panics
This function will panic if ArrayType::MZArray is not
present in RawSpectrum::arrays
Sourcepub fn intensities(&'lifespan self) -> Cow<'transient, [f32]>
pub fn intensities(&'lifespan self) -> Cow<'transient, [f32]>
Access the intensity array.
§Panics
This function will panic if ArrayType::IntensityArray is not
present in RawSpectrum::arrays
pub fn mzs_mut(&mut self) -> Result<&mut [f64], ArrayRetrievalError>
pub fn intensities_mut(&mut self) -> Result<&mut [f32], ArrayRetrievalError>
Sourcepub fn decode_all_arrays(&mut self) -> Result<(), ArrayRetrievalError>
pub fn decode_all_arrays(&mut self) -> Result<(), ArrayRetrievalError>
Sourcepub fn into_spectrum<C, D>(
self,
) -> Result<MultiLayerSpectrum<C, D>, SpectrumConversionError>
pub fn into_spectrum<C, D>( self, ) -> Result<MultiLayerSpectrum<C, D>, SpectrumConversionError>
Convert a spectrum into a MultiLayerSpectrum.
Sourcepub fn denoise(&mut self, scale: f32) -> Result<(), SpectrumProcessingError>
pub fn denoise(&mut self, scale: f32) -> Result<(), SpectrumProcessingError>
Apply a local denoising algorithm to the signal that is suitable for profile mode
data using mzsignal::denoise.
Sourcepub fn pick_peaks_with_into<C, D>(
self,
peak_picker: &PeakPicker,
) -> Result<MultiLayerSpectrum<C, D>, SpectrumProcessingError>where
C: CentroidPeakAdapting + BuildFromArrayMap + From<FittedPeak>,
D: DeconvolutedPeakAdapting + BuildFromArrayMap,
pub fn pick_peaks_with_into<C, D>(
self,
peak_picker: &PeakPicker,
) -> Result<MultiLayerSpectrum<C, D>, SpectrumProcessingError>where
C: CentroidPeakAdapting + BuildFromArrayMap + From<FittedPeak>,
D: DeconvolutedPeakAdapting + BuildFromArrayMap,
pick peaks with peak_picker and convert this spectrum into a MultiLayerSpectrum with a centroid peak list
as well as raw data arrays.
§See also
Sourcepub fn pick_peaks_into<C, D>(
self,
signal_to_noise_threshold: f32,
) -> Result<MultiLayerSpectrum<C, D>, SpectrumProcessingError>where
C: CentroidPeakAdapting + BuildFromArrayMap + From<FittedPeak>,
D: DeconvolutedPeakAdapting + BuildFromArrayMap,
pub fn pick_peaks_into<C, D>(
self,
signal_to_noise_threshold: f32,
) -> Result<MultiLayerSpectrum<C, D>, SpectrumProcessingError>where
C: CentroidPeakAdapting + BuildFromArrayMap + From<FittedPeak>,
D: DeconvolutedPeakAdapting + BuildFromArrayMap,
Pick peaks with a minimum signal-to-noise threshold and convert this spectrum into a MultiLayerSpectrum with
a centroid peak list as well as raw data arrays.
§See also
Sourcepub fn pick_peaks_in_intervals_into<C, D>(
self,
signal_to_noise_threshold: f32,
intervals: &[(f64, f64)],
) -> Result<MultiLayerSpectrum<C, D>, SpectrumProcessingError>where
C: CentroidPeakAdapting + BuildFromArrayMap + From<FittedPeak>,
D: DeconvolutedPeakAdapting + BuildFromArrayMap,
pub fn pick_peaks_in_intervals_into<C, D>(
self,
signal_to_noise_threshold: f32,
intervals: &[(f64, f64)],
) -> Result<MultiLayerSpectrum<C, D>, SpectrumProcessingError>where
C: CentroidPeakAdapting + BuildFromArrayMap + From<FittedPeak>,
D: DeconvolutedPeakAdapting + BuildFromArrayMap,
Pick peaks in the specified m/z ranges with a minimum signal-to-noise threshold and convert
this spectrum into a MultiLayerSpectrum with a centroid peak list as well as raw data arrays.
§See also
Source§impl RawSpectrum
impl RawSpectrum
Sourcepub fn description(&self) -> &SpectrumDescription
pub fn description(&self) -> &SpectrumDescription
The method to access the spectrum description itself, which supplies the data for most other methods on this trait.
Sourcepub fn description_mut(&mut self) -> &mut SpectrumDescription
pub fn description_mut(&mut self) -> &mut SpectrumDescription
The method to access the spectrum descript itself, mutably.
Sourcepub fn acquisition(&self) -> &Acquisition
pub fn acquisition(&self) -> &Acquisition
Access the acquisition information for this spectrum.
Sourcepub fn precursor_iter(&self) -> impl Iterator<Item = &Precursor>
pub fn precursor_iter(&self) -> impl Iterator<Item = &Precursor>
Iterate over all precursors of the spectrum
Sourcepub fn precursor_mut(&mut self) -> Option<&mut Precursor>
pub fn precursor_mut(&mut self) -> Option<&mut Precursor>
Mutably access the (first) precursor information, if it exists
Sourcepub fn precursor_iter_mut(&mut self) -> impl Iterator<Item = &mut Precursor>
pub fn precursor_iter_mut(&mut self) -> impl Iterator<Item = &mut Precursor>
Iterate over all precursors of the spectrum mutably
Sourcepub fn start_time(&self) -> f64
pub fn start_time(&self) -> f64
A shortcut method to retrieve the scan start time of a spectrum
Sourcepub fn signal_continuity(&self) -> SignalContinuity
pub 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.
Sourcepub fn polarity(&self) -> ScanPolarity
pub fn polarity(&self) -> ScanPolarity
Access a description of the spectrum polarity
Sourcepub fn ion_mobility(&self) -> Option<f64>
pub 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.
Sourcepub fn has_ion_mobility(&self) -> bool
pub 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.
Sourcepub fn peaks(&self) -> RefPeakDataLevel<'_, CentroidPeak, DeconvolutedPeak>
pub fn peaks(&self) -> RefPeakDataLevel<'_, CentroidPeak, DeconvolutedPeak>
Retrieve the most processed representation of the mass spectrum’s signal
pub fn into_peaks_and_description(self) -> (PeakDataLevel, SpectrumDescription)
Sourcepub fn raw_arrays(&self) -> Option<&BinaryArrayMap>
pub 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.
Sourcepub fn has_ion_mobility_dimension(&self) -> bool
pub 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.
Sourcepub fn update_summaries(&mut self)
pub 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.
Trait Implementations§
Source§impl Clone for RawSpectrum
impl Clone for RawSpectrum
Source§fn clone(&self) -> RawSpectrum
fn clone(&self) -> RawSpectrum
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RawSpectrum
impl Debug for RawSpectrum
Source§impl Default for RawSpectrum
impl Default for RawSpectrum
Source§fn default() -> RawSpectrum
fn default() -> RawSpectrum
Source§impl<'de> Deserialize<'de> for RawSpectrum
impl<'de> Deserialize<'de> for RawSpectrum
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RawSpectrum, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RawSpectrum, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
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
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>
Source§impl ParamDescribed for RawSpectrum
impl ParamDescribed for RawSpectrum
Source§fn params_mut(&mut self) -> &mut Vec<Param>
fn params_mut(&mut self) -> &mut Vec<Param>
Param listSource§fn extend_params(&mut self, it: impl IntoIterator<Item = Param>)
fn extend_params(&mut self, it: impl IntoIterator<Item = Param>)
Param to the entitySource§fn get_param_by_name(&self, name: &str) -> Option<&Param>
fn get_param_by_name(&self, name: &str) -> Option<&Param>
Param whose name matches nameSource§impl Serialize for RawSpectrum
impl Serialize for RawSpectrum
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl<C, D> SpectrumLike<C, D> for RawSpectrumwhere
C: CentroidLike,
D: DeconvolutedCentroidLike,
impl<C, D> SpectrumLike<C, D> for RawSpectrumwhere
C: CentroidLike,
D: DeconvolutedCentroidLike,
Source§fn description(&self) -> &SpectrumDescription
fn description(&self) -> &SpectrumDescription
Source§fn description_mut(&mut self) -> &mut SpectrumDescription
fn description_mut(&mut self) -> &mut SpectrumDescription
Source§fn peaks(&self) -> RefPeakDataLevel<'_, C, D>
fn peaks(&self) -> RefPeakDataLevel<'_, C, D>
Source§fn raw_arrays(&self) -> Option<&BinaryArrayMap>
fn raw_arrays(&self) -> Option<&BinaryArrayMap>
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.Source§fn into_peaks_and_description(
self,
) -> (PeakDataLevel<C, D>, SpectrumDescription)
fn into_peaks_and_description( self, ) -> (PeakDataLevel<C, D>, SpectrumDescription)
SpectrumDescription and an owning
PeakDataLevel. Read moreSource§fn acquisition(&self) -> &Acquisition
fn acquisition(&self) -> &Acquisition
Source§fn precursor(&self) -> Option<&Precursor>
fn precursor(&self) -> Option<&Precursor>
Source§fn precursor_iter(&self) -> impl Iterator<Item = &Precursor> + ExactSizeIterator
fn precursor_iter(&self) -> impl Iterator<Item = &Precursor> + ExactSizeIterator
Source§fn precursor_count(&self) -> usize
fn precursor_count(&self) -> usize
Source§fn precursor_mut(&mut self) -> Option<&mut Precursor>
fn precursor_mut(&mut self) -> Option<&mut Precursor>
Source§fn precursor_iter_mut(
&mut self,
) -> impl Iterator<Item = &mut Precursor> + ExactSizeIterator
fn precursor_iter_mut( &mut self, ) -> impl Iterator<Item = &mut Precursor> + ExactSizeIterator
Source§fn add_precursor(&mut self, precursor: Precursor)
fn add_precursor(&mut self, precursor: Precursor)
Source§fn remove_precursor(&mut self, index: usize) -> Precursor
fn remove_precursor(&mut self, index: usize) -> Precursor
index in the precursor list. Read moreSource§fn start_time(&self) -> f64
fn start_time(&self) -> f64
Source§fn signal_continuity(&self) -> SignalContinuity
fn signal_continuity(&self) -> SignalContinuity
Source§fn polarity(&self) -> ScanPolarity
fn polarity(&self) -> ScanPolarity
Source§fn ion_mobility(&self) -> Option<f64>
fn ion_mobility(&self) -> Option<f64>
Source§fn has_ion_mobility(&self) -> bool
fn has_ion_mobility(&self) -> bool
Source§fn has_ion_mobility_dimension(&self) -> bool
fn has_ion_mobility_dimension(&self) -> bool
Source§fn has_ion_mobility_class(&self) -> HasIonMobility
fn has_ion_mobility_class(&self) -> HasIonMobility
Source§fn spectrum_type(&self) -> Option<SpectrumType>
fn spectrum_type(&self) -> Option<SpectrumType>
Source§fn set_spectrum_type(&mut self, spectrum_type: SpectrumType)
fn set_spectrum_type(&mut self, spectrum_type: SpectrumType)
Source§fn update_summaries(&mut self)
fn update_summaries(&mut self)
Source§impl<C, D> TryFrom<MultiLayerIonMobilityFrame<C, D>> for RawSpectrumwhere
C: FeatureLike<MZ, IonMobility> + BuildArrayMap3DFrom,
D: FeatureLike<Mass, IonMobility> + KnownCharge + BuildArrayMap3DFrom,
A MultiLayerIonMobilityFrame can be converted to RawSpectrum by flattening
the feature data into a BinaryArrayMap.
impl<C, D> TryFrom<MultiLayerIonMobilityFrame<C, D>> for RawSpectrumwhere
C: FeatureLike<MZ, IonMobility> + BuildArrayMap3DFrom,
D: FeatureLike<Mass, IonMobility> + KnownCharge + BuildArrayMap3DFrom,
A MultiLayerIonMobilityFrame can be converted to RawSpectrum by flattening
the feature data into a BinaryArrayMap.
Source§type Error = ArrayRetrievalError
type Error = ArrayRetrievalError
Source§fn try_from(
value: MultiLayerIonMobilityFrame<C, D>,
) -> Result<RawSpectrum, <RawSpectrum as TryFrom<MultiLayerIonMobilityFrame<C, D>>>::Error>
fn try_from( value: MultiLayerIonMobilityFrame<C, D>, ) -> Result<RawSpectrum, <RawSpectrum as TryFrom<MultiLayerIonMobilityFrame<C, D>>>::Error>
Source§impl<CFeat, DFeat> TryFrom<RawSpectrum> for MultiLayerIonMobilityFrame<CFeat, DFeat>
RawSpectrum instances can be converted to MultiLayerIonMobilityFrame by
using BinaryArrayMap3D::stack on the flat RawSpectrum::arrays.
impl<CFeat, DFeat> TryFrom<RawSpectrum> for MultiLayerIonMobilityFrame<CFeat, DFeat>
RawSpectrum instances can be converted to MultiLayerIonMobilityFrame by
using BinaryArrayMap3D::stack on the flat RawSpectrum::arrays.
§Errors
This will fail if BinaryArrayMap3D::stack fails
Source§type Error = ArrayRetrievalError
type Error = ArrayRetrievalError
Source§fn try_from(
value: RawSpectrum,
) -> Result<MultiLayerIonMobilityFrame<CFeat, DFeat>, <MultiLayerIonMobilityFrame<CFeat, DFeat> as TryFrom<RawSpectrum>>::Error>
fn try_from( value: RawSpectrum, ) -> Result<MultiLayerIonMobilityFrame<CFeat, DFeat>, <MultiLayerIonMobilityFrame<CFeat, DFeat> as TryFrom<RawSpectrum>>::Error>
Source§impl<C> TryFrom<RawSpectrum> for CentroidSpectrumType<C>where
C: CentroidLike + BuildFromArrayMap,
impl<C> TryFrom<RawSpectrum> for CentroidSpectrumType<C>where
C: CentroidLike + BuildFromArrayMap,
Source§type Error = SpectrumConversionError
type Error = SpectrumConversionError
Source§fn try_from(
spectrum: RawSpectrum,
) -> Result<CentroidSpectrumType<C>, <CentroidSpectrumType<C> as TryFrom<RawSpectrum>>::Error>
fn try_from( spectrum: RawSpectrum, ) -> Result<CentroidSpectrumType<C>, <CentroidSpectrumType<C> as TryFrom<RawSpectrum>>::Error>
Auto Trait Implementations§
impl Freeze for RawSpectrum
impl RefUnwindSafe for RawSpectrum
impl Send for RawSpectrum
impl Sync for RawSpectrum
impl Unpin for RawSpectrum
impl UnsafeUnpin for RawSpectrum
impl UnwindSafe for RawSpectrum
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.