Skip to main content

CvTerm

Struct CvTerm 

Source
pub struct CvTerm {
    pub accession: &'static str,
    pub name: String,
}
Expand description

A PSI-MS controlled-vocabulary term.

accession is a stable identifier (MS:NNNNNNN or UO:NNNNNNN); name is the human-readable term. mzML output writes these verbatim.

Fields§

§accession: &'static str§name: String

Implementations§

Source§

impl CvTerm

Source

pub fn new(accession: &'static str, name: impl Into<String>) -> Self

Examples found in repository?
examples/emit_sample_mzml.rs (line 29)
26    fn new() -> Self {
27        let meta = RunMetadata {
28            source_file_name: "sample.raw".into(),
29            source_file_format: CvTerm::new("MS:1000563", "Thermo RAW format"),
30            native_id_format: CvTerm::new("MS:1000768", "Thermo nativeID format"),
31            instrument: CvTerm::new("MS:1001911", "Q Exactive"),
32            software_name: "openmassspec-core-sample".into(),
33            software_version: env!("CARGO_PKG_VERSION").into(),
34            start_timestamp: None,
35            mobility_array_kind: Some(MobilityArrayKind::InverseReducedVsPerCm2),
36        };
37        let ms1 = SpectrumRecord {
38            index: 0,
39            scan_number: 1,
40            native_id: "controllerType=0 controllerNumber=1 scan=1".into(),
41            ms_level: MsPower::Ms1.ms_level(),
42            polarity: Some(Polarity::Positive),
43            scan_mode: Some(ScanMode::Centroid),
44            analyzer: Some(Analyzer::FTMS),
45            filter: Some("FTMS + p ESI Full ms".into()),
46            retention_time_sec: 0.123 * 60.0,
47            total_ion_current: None,
48            base_peak_mz: None,
49            base_peak_intensity: None,
50            low_mz: None,
51            high_mz: None,
52            ion_injection_time_ms: Some(20.0),
53            inv_mobility: None,
54            precursor: None,
55            mz: vec![100.0, 200.0, 300.0],
56            intensity: vec![1.0, 5.0, 2.0],
57            inv_mobility_per_peak: None,
58        };
59        let ms2 = SpectrumRecord {
60            index: 1,
61            scan_number: 2,
62            native_id: "controllerType=0 controllerNumber=1 scan=2".into(),
63            ms_level: MsPower::Ms2.ms_level(),
64            polarity: Some(Polarity::Positive),
65            scan_mode: Some(ScanMode::Centroid),
66            analyzer: Some(Analyzer::FTMS),
67            filter: Some("FTMS + p ESI d Full ms2 200.00@hcd28.00".into()),
68            retention_time_sec: 0.5 * 60.0,
69            total_ion_current: Some(123.45),
70            base_peak_mz: Some(150.5),
71            base_peak_intensity: Some(99.0),
72            low_mz: Some(100.0),
73            high_mz: Some(180.0),
74            ion_injection_time_ms: Some(50.0),
75            inv_mobility: None,
76            precursor: Some(PrecursorInfo {
77                target_mz: Some(200.0),
78                selected_mz: Some(200.001),
79                isolation_width: Some(2.0),
80                charge: Some(2),
81                intensity: None,
82                collision_energy: Some(28.0),
83                ce_is_nce: true,
84                precursor_native_id: Some("controllerType=0 controllerNumber=1 scan=1".into()),
85                activation: Some(Activation::CID),
86                analyzer: Some(Analyzer::FTMS),
87            }),
88            mz: vec![150.5, 160.0],
89            intensity: vec![99.0, 50.0],
90            inv_mobility_per_peak: None,
91        };
92        // A frame-collapsed ion-mobility MS1 (the Bruker timsTOF shape):
93        // scalar 1/K0 plus a per-peak inverse-reduced-mobility array, which
94        // the writer emits as a third binary data array. Exercises the
95        // ion-mobility CV path so it is schema-checked without a vendor file.
96        let ms1_mobility = SpectrumRecord {
97            index: 2,
98            scan_number: 3,
99            native_id: "frame=1 scan=0".into(),
100            ms_level: MsPower::Ms1.ms_level(),
101            polarity: Some(Polarity::Positive),
102            scan_mode: Some(ScanMode::Centroid),
103            analyzer: Some(Analyzer::TOFMS),
104            filter: None,
105            retention_time_sec: 0.75 * 60.0,
106            total_ion_current: None,
107            base_peak_mz: None,
108            base_peak_intensity: None,
109            low_mz: None,
110            high_mz: None,
111            ion_injection_time_ms: None,
112            inv_mobility: Some(0.95),
113            precursor: None,
114            mz: vec![120.0, 240.0, 360.0],
115            intensity: vec![3.0, 7.0, 4.0],
116            inv_mobility_per_peak: Some(vec![0.92, 0.95, 0.98]),
117        };
118        Self {
119            meta,
120            spectra: vec![ms1, ms2, ms1_mobility],
121            cursor: 0,
122        }
123    }

Trait Implementations§

Source§

impl Clone for CvTerm

Source§

fn clone(&self) -> CvTerm

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 CvTerm

Source§

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

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

impl Eq for CvTerm

Source§

impl PartialEq for CvTerm

Source§

fn eq(&self, other: &CvTerm) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CvTerm

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.