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 31)
28    fn new() -> Self {
29        let meta = RunMetadata {
30            source_file_name: "sample.raw".into(),
31            source_file_format: CvTerm::new("MS:1000563", "Thermo RAW format"),
32            native_id_format: CvTerm::new("MS:1000768", "Thermo nativeID format"),
33            instrument: CvTerm::new("MS:1001911", "Q Exactive"),
34            instrument_serial_number: Some("SN-EXAMPLE-001".into()),
35            software_name: "openmassspec-core-sample".into(),
36            software_version: env!("CARGO_PKG_VERSION").into(),
37            // Exercises the second `<software>` entry / `<softwareList
38            // count="2">` path so it is schema-checked without a vendor
39            // file.
40            acquisition_software_name: Some("Xcalibur".into()),
41            acquisition_software_version: Some("4.4.16.14".into()),
42            // Exercises the `startTimeStamp` attribute path so it is
43            // schema-checked without a vendor file.
44            start_timestamp: Some("2026-06-01T14:30:00Z".into()),
45            mobility_array_kind: Some(MobilityArrayKind::InverseReducedVsPerCm2),
46            // Exercises the per-spectrum `instrumentConfigurationRef` path:
47            // the FTMS (Orbitrap) spectra below get one instrumentConfiguration
48            // and the TOFMS one gets another, so it is schema-checked without
49            // a vendor file.
50            analyzers: vec![Analyzer::FTMS, Analyzer::TOFMS],
51        };
52        let ms1 = SpectrumRecord {
53            index: 0,
54            scan_number: 1,
55            native_id: "controllerType=0 controllerNumber=1 scan=1".into(),
56            ms_level: MsPower::Ms1.ms_level(),
57            polarity: Some(Polarity::Positive),
58            scan_mode: Some(ScanMode::Centroid),
59            analyzer: Some(Analyzer::FTMS),
60            filter: Some("FTMS + p ESI Full ms".into()),
61            retention_time_sec: 0.123 * 60.0,
62            total_ion_current: None,
63            base_peak_mz: None,
64            base_peak_intensity: None,
65            low_mz: None,
66            high_mz: None,
67            ion_injection_time_ms: Some(20.0),
68            inv_mobility: None,
69            faims_cv: None,
70            precursor: None,
71            mz: vec![100.0, 200.0, 300.0],
72            intensity: vec![1.0, 5.0, 2.0],
73            inv_mobility_per_peak: None,
74        };
75        let ms2 = SpectrumRecord {
76            index: 1,
77            scan_number: 2,
78            native_id: "controllerType=0 controllerNumber=1 scan=2".into(),
79            ms_level: MsPower::Ms2.ms_level(),
80            polarity: Some(Polarity::Positive),
81            scan_mode: Some(ScanMode::Centroid),
82            analyzer: Some(Analyzer::FTMS),
83            filter: Some("FTMS + p ESI d Full ms2 200.00@hcd28.00".into()),
84            retention_time_sec: 0.5 * 60.0,
85            total_ion_current: Some(123.45),
86            base_peak_mz: Some(150.5),
87            base_peak_intensity: Some(99.0),
88            low_mz: Some(100.0),
89            high_mz: Some(180.0),
90            ion_injection_time_ms: Some(50.0),
91            inv_mobility: None,
92            faims_cv: Some(-45.0),
93            precursor: Some(PrecursorInfo {
94                target_mz: Some(200.0),
95                selected_mz: Some(200.001),
96                isolation_width: Some(2.0),
97                charge: Some(2),
98                intensity: None,
99                collision_energy: Some(28.0),
100                ce_is_nce: true,
101                precursor_native_id: Some("controllerType=0 controllerNumber=1 scan=1".into()),
102                activation: Some(Activation::CID),
103                analyzer: Some(Analyzer::FTMS),
104                // Exercises the `collisional cross sectional area` selectedIon
105                // cvParam path so it is schema-checked without a vendor file.
106                ccs: Some(153.4),
107            }),
108            mz: vec![150.5, 160.0],
109            intensity: vec![99.0, 50.0],
110            inv_mobility_per_peak: None,
111        };
112        // A frame-collapsed ion-mobility MS1 (the Bruker timsTOF shape):
113        // scalar 1/K0 plus a per-peak inverse-reduced-mobility array, which
114        // the writer emits as a third binary data array. Exercises the
115        // ion-mobility CV path so it is schema-checked without a vendor file.
116        let ms1_mobility = SpectrumRecord {
117            index: 2,
118            scan_number: 3,
119            native_id: "frame=1 scan=0".into(),
120            ms_level: MsPower::Ms1.ms_level(),
121            polarity: Some(Polarity::Positive),
122            scan_mode: Some(ScanMode::Centroid),
123            analyzer: Some(Analyzer::TOFMS),
124            filter: None,
125            retention_time_sec: 0.75 * 60.0,
126            total_ion_current: None,
127            base_peak_mz: None,
128            base_peak_intensity: None,
129            low_mz: None,
130            high_mz: None,
131            ion_injection_time_ms: None,
132            inv_mobility: Some(0.95),
133            faims_cv: None,
134            precursor: None,
135            mz: vec![120.0, 240.0, 360.0],
136            intensity: vec![3.0, 7.0, 4.0],
137            inv_mobility_per_peak: Some(vec![0.92, 0.95, 0.98]),
138        };
139        // A TIC and a SRM/MRM transition chromatogram. Exercises the
140        // `chromatogramList` path (plain + indexed) so it is schema-checked
141        // without a vendor file.
142        let tic = ChromatogramRecord {
143            index: 0,
144            id: "TIC".into(),
145            chromatogram_type: Some(CvTerm::new("MS:1000235", "total ion current chromatogram")),
146            precursor_mz: None,
147            product_mz: None,
148            time_sec: vec![0.0, 30.0, 45.0],
149            intensity: vec![120.0, 340.0, 210.0],
150        };
151        let srm = ChromatogramRecord {
152            index: 1,
153            id: "SRM SIC Q1=524.3 Q3=136.1".into(),
154            chromatogram_type: Some(CvTerm::new(
155                "MS:1001473",
156                "selected reaction monitoring chromatogram",
157            )),
158            precursor_mz: Some(524.3),
159            product_mz: Some(136.1),
160            time_sec: vec![0.0, 30.0],
161            intensity: vec![50.0, 80.0],
162        };
163        Self {
164            meta,
165            spectra: vec![ms1, ms2, ms1_mobility],
166            chroms: vec![tic, srm],
167            cursor: 0,
168        }
169    }

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.