openproteo_core/enums.rs
1//! Shared enums and types used across the open mass-spec parsers.
2//!
3//! These mirror the enums historically defined in `opentfraw::types` (which is
4//! where the vocabulary first lived) but are intentionally **vendor neutral**:
5//! anything Thermo-specific (e.g. firmware byte codes, scan-filter symbols)
6//! stays in the vendor crate.
7
8/// Detector / mass analyzer family.
9///
10/// The variants follow Thermo's preamble encoding (the most detailed source
11/// available across vendors); other vendors map their detector class onto the
12/// closest equivalent.
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub enum Analyzer {
15 /// Ion trap.
16 ITMS,
17 /// Triple quadrupole.
18 TQMS,
19 /// Single quadrupole.
20 SQMS,
21 /// Time-of-flight.
22 TOFMS,
23 /// Fourier-transform (Orbitrap, FT-ICR).
24 FTMS,
25 /// Magnetic sector.
26 Sector,
27}
28
29/// Scan polarity.
30#[derive(Debug, Clone, Copy, PartialEq, Eq)]
31pub enum Polarity {
32 Negative,
33 Positive,
34}
35
36/// Whether a spectrum holds centroided peak picks or the raw profile signal.
37#[derive(Debug, Clone, Copy, PartialEq, Eq)]
38pub enum ScanMode {
39 Centroid,
40 Profile,
41}
42
43/// MSn order (MS1, MS2, ...).
44#[derive(Debug, Clone, Copy, PartialEq, Eq)]
45pub enum MsPower {
46 Undefined,
47 Ms1,
48 Ms2,
49 Ms3,
50 Ms4,
51 Ms5,
52 Ms6,
53 Ms7,
54 Ms8,
55}
56
57/// Activation method used for MSn fragmentation.
58#[derive(Debug, Clone, Copy, PartialEq, Eq)]
59pub enum Activation {
60 /// Higher-energy collisional dissociation (Q Exactive style).
61 HCD,
62 /// Multi-photon induced dissociation.
63 MPID,
64 /// Electron transfer dissociation.
65 ETD,
66 /// Collision-induced dissociation. On FTMS analyzers this is
67 /// conventionally rendered as beam-type CID (HCD-equivalent) in mzML.
68 CID,
69 /// Electron-capture dissociation.
70 ECD,
71 /// Infrared multiphoton dissociation.
72 IRMPD,
73 /// Proton-transfer / activated-ion variant.
74 PD,
75 /// Pulsed q dissociation.
76 PQD,
77 /// Ultraviolet photodissociation.
78 UVPD,
79 /// Surface-induced dissociation.
80 SID,
81 /// ETD with supplemental HCD.
82 EThcD,
83}
84
85/// Unit + meaning of a per-peak ion mobility array.
86///
87/// Selects the CV term and unit emitted by the mzML writer when a
88/// [`crate::SpectrumRecord::inv_mobility_per_peak`] array is present.
89#[derive(Debug, Clone, Copy, PartialEq, Eq)]
90pub enum MobilityArrayKind {
91 /// Bruker TIMS convention: per-peak 1/K0 in volt-second per square
92 /// centimeter. Emitted as MS:1003008 "raw inverse reduced ion mobility
93 /// array" with unit MS:1002814.
94 InverseReducedVsPerCm2,
95 /// Waters traveling-wave IMS convention: per-peak drift time in
96 /// milliseconds. Emitted as MS:1003007 "raw ion mobility array" with
97 /// unit UO:0000028 "millisecond".
98 DriftTimeMilliseconds,
99}
100
101impl MsPower {
102 /// Numeric MS level (1 for MS1, 2 for MS2, ...). Returns 1 for `Undefined`,
103 /// matching the convention used in mzML output.
104 pub fn ms_level(self) -> u32 {
105 match self {
106 Self::Undefined | Self::Ms1 => 1,
107 Self::Ms2 => 2,
108 Self::Ms3 => 3,
109 Self::Ms4 => 4,
110 Self::Ms5 => 5,
111 Self::Ms6 => 6,
112 Self::Ms7 => 7,
113 Self::Ms8 => 8,
114 }
115 }
116}