Skip to main content

SpectrumRecord

Struct SpectrumRecord 

Source
pub struct SpectrumRecord {
Show 20 fields pub index: usize, pub scan_number: u32, pub native_id: String, pub ms_level: u32, pub polarity: Option<Polarity>, pub scan_mode: Option<ScanMode>, pub analyzer: Option<Analyzer>, pub filter: Option<String>, pub retention_time_sec: f64, pub total_ion_current: Option<f64>, pub base_peak_mz: Option<f64>, pub base_peak_intensity: Option<f64>, pub low_mz: Option<f64>, pub high_mz: Option<f64>, pub ion_injection_time_ms: Option<f64>, pub inv_mobility: Option<f64>, pub precursor: Option<PrecursorInfo>, pub mz: Vec<f64>, pub intensity: Vec<f32>, pub inv_mobility_per_peak: Option<Vec<f32>>,
}
Expand description

One fully-decoded spectrum.

Retention time is stored in seconds (the mzML preferred unit). Vendors that natively store minutes (e.g. Thermo) convert at the boundary.

mz is f64 and intensity is f32 because that is what the PSI-MS CV 64-bit float / 32-bit float defaults are and what every downstream search engine expects. Vendors that decode lower-precision arrays should widen to these types.

Fields§

§index: usize

Zero-based position in the source file (used as mzML index=).

§scan_number: u32

One-based, source-stable scan number. For Bruker bundles this is a running counter assigned by the iterator (since PASEF frames produce many spectra per frame).

§native_id: String

Verbatim mzML native ID for this spectrum. Vendors populate this with the appropriate controllerType=..., frame=... scan=..., or function=... process=... scan=... literal.

§ms_level: u32§polarity: Option<Polarity>§scan_mode: Option<ScanMode>§analyzer: Option<Analyzer>§filter: Option<String>

Thermo-style scan filter (or vendor-equivalent). Optional; populated by parsers that have a meaningful filter string.

§retention_time_sec: f64

Retention time in seconds.

§total_ion_current: Option<f64>

Total ion current. If None, the mzML writer computes it from intensity.

§base_peak_mz: Option<f64>

Base-peak m/z. If None, the mzML writer computes it from mz / intensity.

§base_peak_intensity: Option<f64>

Base-peak intensity. If None, the mzML writer computes it from intensity.

§low_mz: Option<f64>

Lowest observed m/z. If None, the writer uses mz.first().

§high_mz: Option<f64>

Highest observed m/z. If None, the writer uses mz.last().

§ion_injection_time_ms: Option<f64>§inv_mobility: Option<f64>

Mean inverse reduced ion mobility (1/K0) for the spectrum, when applicable (Bruker timsTOF, Waters TWIMS).

§precursor: Option<PrecursorInfo>§mz: Vec<f64>§intensity: Vec<f32>§inv_mobility_per_peak: Option<Vec<f32>>

Per-peak inverse reduced ion mobility, parallel to mz / intensity, when an IMS-resolved parser opts to preserve it. Length must equal mz.len() when present.

Implementations§

Source§

impl SpectrumRecord

Source

pub fn effective_tic(&self) -> f64

Total ion current, computed from intensity when not pre-populated.

Source

pub fn effective_base_peak(&self) -> Option<(f64, f64)>

Base-peak (mz, intensity), computed from the arrays when not pre-populated. Returns None when the spectrum has no peaks.

Source

pub fn effective_mz_range(&self) -> Option<(f64, f64)>

(low_mz, high_mz), falling back to the first/last entries in mz when not pre-populated. Returns None for empty spectra.

Trait Implementations§

Source§

impl Clone for SpectrumRecord

Source§

fn clone(&self) -> SpectrumRecord

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 SpectrumRecord

Source§

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

Formats the value using the given formatter. Read more

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.