Skip to main content

RawSpectrum

Struct RawSpectrum 

Source
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: SpectrumDescription

The spectrum metadata describing acquisition conditions and details.

§arrays: BinaryArrayMap

The data arrays describing the m/z, intensity, and potentially other measured properties

Implementations§

Source§

impl<'transient, 'lifespan: 'transient> RawSpectrum

Source

pub fn new(description: SpectrumDescription, arrays: BinaryArrayMap) -> Self

Source

pub fn into_centroid<C>( self, ) -> Result<CentroidSpectrumType<C>, SpectrumConversionError>

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]

Source

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

Source

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

Source

pub fn mzs_mut(&mut self) -> Result<&mut [f64], ArrayRetrievalError>

Source

pub fn intensities_mut(&mut self) -> Result<&mut [f32], ArrayRetrievalError>

Source

pub fn decode_all_arrays(&mut self) -> Result<(), ArrayRetrievalError>

Explicitly decode any DataArray that is encoded or compressed still so that they are ready for use.

§See also

BinaryArrayMap::decode_all_arrays

Source

pub fn into_spectrum<C, D>( self, ) -> Result<MultiLayerSpectrum<C, D>, SpectrumConversionError>

Convert a spectrum into a MultiLayerSpectrum.

Source§

impl RawSpectrum

Source

pub fn description(&self) -> &SpectrumDescription

The method to access the spectrum description itself, which supplies the data for most other methods on this trait.

Source

pub fn description_mut(&mut self) -> &mut SpectrumDescription

The method to access the spectrum descript itself, mutably.

Source

pub fn acquisition(&self) -> &Acquisition

Access the acquisition information for this spectrum.

Source

pub fn precursor(&self) -> Option<&Precursor>

Access the precursor information, if it exists.

Source

pub fn precursor_iter(&self) -> impl Iterator<Item = &Precursor>

Iterate over all precursors of the spectrum

Source

pub fn precursor_mut(&mut self) -> Option<&mut Precursor>

Mutably access the (first) precursor information, if it exists

Source

pub fn precursor_iter_mut(&mut self) -> impl Iterator<Item = &mut Precursor>

Iterate over all precursors of the spectrum mutably

Source

pub fn start_time(&self) -> f64

A shortcut method to retrieve the scan start time of a spectrum

Source

pub fn ms_level(&self) -> u8

Access the MS exponentiation level

Source

pub fn id(&self) -> &str

Access the native ID string for the spectrum

Source

pub fn index(&self) -> usize

Access the index of the spectrum in the source file

Source

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.

Source

pub fn polarity(&self) -> ScanPolarity

Access a description of the spectrum polarity

Source

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.

Source

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.

Source

pub fn peaks(&self) -> RefPeakDataLevel<'_, CentroidPeak, DeconvolutedPeak>

Retrieve the most processed representation of the mass spectrum’s signal

Source

pub fn into_peaks_and_description( self, ) -> (PeakDataLevel<CentroidPeak, DeconvolutedPeak>, SpectrumDescription)

Source

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.

Source

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.

Source

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.

Uses RefPeakDataLevel::fetch_summaries

Trait Implementations§

Source§

impl Clone for RawSpectrum

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RawSpectrum

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RawSpectrum

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<C, D> From<MultiLayerSpectrum<C, D>> for RawSpectrum

Source§

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>

Source§

fn from(spectrum: RawSpectrum) -> MultiLayerSpectrum<C, D>

Converts to this type from the input type.
Source§

impl ParamDescribed for RawSpectrum

Source§

fn params(&self) -> &[Param]

Obtain an immutable slice over the encapsulated Param list
Source§

fn params_mut(&mut self) -> &mut ParamList

Obtain an mutable slice over the encapsulated Param list
Source§

fn add_param(&mut self, param: Param)

Add a new Param to the entity
Source§

fn extend_params(&mut self, it: impl IntoIterator<Item = Param>)

Add all parameters from an iterator of Param to the entity
Source§

fn remove_param(&mut self, index: usize) -> Param

Remove the ith Param from the entity.
Source§

fn get_param_by_name(&self, name: &str) -> Option<&Param>

Find the first Param whose name matches name
Source§

fn get_param_by_curie(&self, curie: &CURIE) -> Option<&Param>

Find the first Param whose CURIE matches curie
Source§

fn get_param_by_accession(&self, accession: &str) -> Option<&Param>

Find the first Param whose Param::accession matches accession Read more
Source§

fn iter_params(&self) -> Iter<'_, Param> ⓘ

Iterate over the encapsulated parameter list
Source§

fn iter_params_mut(&mut self) -> IterMut<'_, Param> ⓘ

Iterate mutably over the encapsulated parameter list
Source§

impl<C: CentroidLike, D: DeconvolutedCentroidLike> SpectrumLike<C, D> for RawSpectrum

Source§

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

The method to access the spectrum descript itself, mutably.
Source§

fn peaks(&self) -> RefPeakDataLevel<'_, C, D>

Retrieve the most processed representation of the mass spectrum’s signal
Source§

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.
Source§

fn into_peaks_and_description( self, ) -> (PeakDataLevel<C, D>, SpectrumDescription)

Consume the spectrum, decomposing it into the SpectrumDescription and an owning PeakDataLevel. Read more
Source§

fn acquisition(&self) -> &Acquisition

Access the acquisition information for this spectrum.
Source§

fn precursor(&self) -> Option<&Precursor>

Access the (first) precursor information, if it exists.
Source§

fn precursor_iter(&self) -> impl Iterator<Item = &Precursor> + ExactSizeIterator

Iterate over all precursors of the spectrum
Source§

fn precursor_count(&self) -> usize

The number of precursor levels recorded
Source§

fn precursor_mut(&mut self) -> Option<&mut Precursor>

Mutably access the (first) precursor information, if it exists
Source§

fn precursor_iter_mut( &mut self, ) -> impl Iterator<Item = &mut Precursor> + ExactSizeIterator

Iterate over all precursors of the spectrum mutably
Source§

fn add_precursor(&mut self, precursor: Precursor)

Add a precursor to the list of precursors for this spectrum. Read more
Source§

fn remove_precursor(&mut self, index: usize) -> Precursor

Remove the precursor entry at index in the precursor list. Read more
Source§

fn start_time(&self) -> f64

A shortcut method to retrieve the scan start time of a spectrum
Source§

fn ms_level(&self) -> u8

Access the MS exponentiation level
Source§

fn id(&self) -> &str

Access the native ID string for the spectrum
Source§

fn index(&self) -> usize

Access the index of the spectrum in the source file
Source§

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

Access a description of the spectrum polarity
Source§

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

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

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

A single point of entry for checking if ion mobility is present.
Source§

fn spectrum_type(&self) -> Option<SpectrumType>

Find the type of spectrum described. Read more
Source§

fn set_spectrum_type(&mut self, spectrum_type: SpectrumType)

Set the kind of spectrum represented.
Source§

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: FeatureLike<MZ, IonMobility> + BuildArrayMap3DFrom, D: FeatureLike<Mass, IonMobility> + KnownCharge + BuildArrayMap3DFrom> TryFrom<MultiLayerIonMobilityFrame<C, D>> for RawSpectrum

A MultiLayerIonMobilityFrame can be converted to RawSpectrum by flattening the feature data into a BinaryArrayMap.

Source§

type Error = ArrayRetrievalError

The type returned in the event of a conversion error.
Source§

fn try_from( value: MultiLayerIonMobilityFrame<C, D>, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<CFeat: FeatureLike<MZ, IonMobility>, DFeat: FeatureLike<Mass, IonMobility> + KnownCharge> 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

The type returned in the event of a conversion error.
Source§

fn try_from(value: RawSpectrum) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<C> TryFrom<RawSpectrum> for CentroidSpectrumType<C>

Source§

type Error = SpectrumConversionError

The type returned in the event of a conversion error.
Source§

fn try_from( spectrum: RawSpectrum, ) -> Result<CentroidSpectrumType<C>, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.