Skip to main content

timsrust_core/
precursors.rs

1use crate::{Charge, FrameIndex, Im, Mz, Rt, ScanIndex};
2
3/// The MS1 precursor that got selected for fragmentation.
4#[derive(Clone, Debug, PartialEq)]
5pub struct Precursor {
6    mz: Mz,
7    rt: Rt,
8    im: Im,
9    scan_index: ScanIndex,
10    charge: Option<Charge>,
11    intensity: Option<f64>,
12    index: usize,
13    frame_index: FrameIndex,
14}
15
16impl Precursor {
17    #[allow(clippy::too_many_arguments)]
18    pub fn new(
19        mz: Mz,
20        im: Im,
21        rt: Rt,
22        scan_index: ScanIndex,
23        charge: Option<Charge>,
24        intensity: Option<f64>,
25        index: usize,
26        frame_index: FrameIndex,
27    ) -> Self {
28        Precursor {
29            mz,
30            rt,
31            im,
32            scan_index,
33            charge,
34            intensity,
35            index,
36            frame_index,
37        }
38    }
39}
40
41impl Precursor {
42    pub fn mz(&self) -> Mz {
43        self.mz
44    }
45
46    pub fn rt(&self) -> Rt {
47        self.rt
48    }
49
50    pub fn im(&self) -> Im {
51        self.im
52    }
53
54    pub fn scan_index(&self) -> ScanIndex {
55        self.scan_index
56    }
57
58    pub fn charge(&self) -> &Option<Charge> {
59        &self.charge
60    }
61
62    pub fn intensity(&self) -> &Option<f64> {
63        &self.intensity
64    }
65
66    pub fn index(&self) -> usize {
67        self.index
68    }
69
70    pub fn frame_index(&self) -> FrameIndex {
71        self.frame_index
72    }
73}