OpenMS
Precursor.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Mathias Walzer $
6 // $Authors: Marc Sturm, Mathias Walzer $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/KERNEL/Peak1D.h>
15 
16 #include <set>
17 
18 namespace OpenMS
19 {
32  class OPENMS_DLLAPI Precursor :
33  public CVTermList,
34  public Peak1D
35  {
36 
37 public:
39  Precursor() = default;
41  Precursor(const Precursor&) = default;
42 
43  // note: we implement the move constructor ourselves due to a bug in MSVS
44  // 2015/2017 which cannot produce a default move constructor for classes
45  // that contain STL containers (other than vector).
46 
48  Precursor(Precursor&&) noexcept;
50  ~Precursor() override = default;
51 
53  Precursor& operator=(const Precursor&) = default;
55  Precursor& operator=(Precursor&&) & = default;
56 
59  {
60  CID,
61  PSD,
62  PD,
63  SID,
64  BIRD,
65  ECD,
66  IMD,
67  SORI,
68  HCID,
69  LCID,
70  PHD,
71  ETD,
74  PQD,
75  TRAP,
76  HCD,
78  LIFT,
79  SIZE_OF_ACTIVATIONMETHOD
80  };
82  static const std::string NamesOfActivationMethod[SIZE_OF_ACTIVATIONMETHOD];
83  static const std::string NamesOfActivationMethodShort[SIZE_OF_ACTIVATIONMETHOD];
84 
89 
91  bool operator==(const Precursor & rhs) const;
93  bool operator!=(const Precursor & rhs) const;
94 
96  const std::set<ActivationMethod>& getActivationMethods() const;
98  std::set<ActivationMethod>& getActivationMethods();
99 
104 
106  void setActivationMethods(const std::set<ActivationMethod> & activation_methods);
107 
109  double getActivationEnergy() const;
111  void setActivationEnergy(double activation_energy);
112 
125  void setIsolationWindowLowerOffset(double bound);
126 
139  void setIsolationWindowUpperOffset(double bound);
140 
148  double getDriftTime() const;
150  void setDriftTime(double drift_time);
151 
156 
161 
162 
175  void setDriftTimeWindowLowerOffset(double drift_time);
176 
189  void setDriftTimeWindowUpperOffset(double drift_time);
190 
192  Int getCharge() const;
194  void setCharge(Int charge);
195 
197  std::vector<Int>& getPossibleChargeStates();
199  const std::vector<Int>& getPossibleChargeStates() const;
201  void setPossibleChargeStates(const std::vector<Int> & possible_charge_states);
202 
204  inline double getUnchargedMass() const
205  {
206  int c = charge_;
207  (c == 0) ? c = 2 : c = charge_;
208  return getMZ() * c - c * Constants::PROTON_MASS_U;
209  }
210 
211 protected:
212 
213  std::set<ActivationMethod> activation_methods_;
214  double activation_energy_{};
215  double window_low_{};
216  double window_up_{};
217  double drift_time_{-1};
218  double drift_window_low_{};
219  double drift_window_up_{};
221  Int charge_{};
222  std::vector<Int> possible_charge_states_;
223  };
224 } // namespace OpenMS
225 
Representation of controlled vocabulary term list.
Definition: CVTermList.h:28
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:28
Precursor meta information.
Definition: Precursor.h:35
void setActivationEnergy(double activation_energy)
sets the activation energy (in electronvolt)
Precursor(const Precursor &)=default
Copy constructor.
double getIsolationWindowLowerOffset() const
Returns the lower offset from the target m/z.
StringList getActivationMethodsAsString() const
Returns the full names (e.g., "Collision-induced dissociation") of the activation methods set on this...
double getDriftTimeWindowUpperOffset() const
Returns the upper offset from the target ion mobility in milliseconds.
std::vector< Int > & getPossibleChargeStates()
Mutable access to possible charge states.
const std::set< ActivationMethod > & getActivationMethods() const
returns a const reference to the activation methods
void setActivationMethods(const std::set< ActivationMethod > &activation_methods)
sets the activation methods
void setIsolationWindowUpperOffset(double bound)
sets the upper offset from the target m/z
bool operator==(const Precursor &rhs) const
Equality operator.
Precursor()=default
Constructor.
Precursor(Precursor &&) noexcept
Move constructor.
std::vector< Int > possible_charge_states_
Definition: Precursor.h:222
void setDriftTime(double drift_time)
sets the ion mobility drift time in milliseconds
StringList getActivationMethodsAsShortString() const
Returns the abbreviations (e.g., "CID") of the activation methods set on this instance.
void setDriftTimeUnit(DriftTimeUnit dt)
Sets the ion mobility drift time unit.
static StringList getAllShortNamesOfActivationMethods()
returns all activation method abbreviations (e.g., "CID") known to OpenMS
Int getCharge() const
Non-mutable access to the charge.
void setDriftTimeWindowUpperOffset(double drift_time)
sets the upper offset from the target ion mobility
bool operator!=(const Precursor &rhs) const
Equality operator.
double getIsolationWindowUpperOffset() const
Returns the upper offset from the target m/z.
DriftTimeUnit getDriftTimeUnit() const
Returns the ion mobility drift time unit.
static StringList getAllNamesOfActivationMethods()
returns all activation method full names (e.g., "Collision-induced dissociation") known to OpenMS
double getDriftTimeWindowLowerOffset() const
Returns the lower offset from the target ion mobility in milliseconds.
void setDriftTimeWindowLowerOffset(double drift_time)
sets the lower offset from the target ion mobility
std::set< ActivationMethod > activation_methods_
Definition: Precursor.h:213
double getUnchargedMass() const
Returns the uncharged mass of the precursor, if charge is unknown, i.e. 0, our best guess is doubly c...
Definition: Precursor.h:204
std::set< ActivationMethod > & getActivationMethods()
returns a mutable reference to the activation methods
void setIsolationWindowLowerOffset(double bound)
sets the lower offset from the target m/z
double getActivationEnergy() const
returns the activation energy (in electronvolt)
void setCharge(Int charge)
Mutable access to the charge.
ActivationMethod
Method of activation.
Definition: Precursor.h:59
@ LIFT
Bruker proprietary method (MS:1002000)
Definition: Precursor.h:78
@ SORI
Sustained off-resonance irradiation.
Definition: Precursor.h:67
@ EThcD
Electron transfer and higher-energy collision dissociation (MS:1002631)
Definition: Precursor.h:73
@ HCID
High-energy collision-induced dissociation.
Definition: Precursor.h:68
@ PQD
Pulsed q dissociation (MS:1000599)
Definition: Precursor.h:74
@ ECD
Electron capture dissociation (MS:1000250)
Definition: Precursor.h:65
@ ETciD
Electron transfer and collision-induced dissociation (MS:1003182)
Definition: Precursor.h:72
@ BIRD
Blackbody infrared radiative dissociation.
Definition: Precursor.h:64
@ PHD
Photodissociation.
Definition: Precursor.h:70
@ LCID
Low-energy collision-induced dissociation.
Definition: Precursor.h:69
@ ETD
Electron transfer dissociation.
Definition: Precursor.h:71
@ HCD
beam-type collision-induced dissociation (MS:1000422)
Definition: Precursor.h:76
@ PSD
Post-source decay.
Definition: Precursor.h:61
@ IMD
Infrared multiphoton dissociation.
Definition: Precursor.h:66
@ CID
Collision-induced dissociation (MS:1000133) (also CAD; parent term, but unless otherwise stated often...
Definition: Precursor.h:60
@ SID
Surface-induced dissociation.
Definition: Precursor.h:63
@ TRAP
trap-type collision-induced dissociation (MS:1002472)
Definition: Precursor.h:75
@ INSOURCE
in-source collision-induced dissociation (MS:1001880)
Definition: Precursor.h:77
@ PD
Plasma desorption.
Definition: Precursor.h:62
double getDriftTime() const
Returns the ion mobility drift time in milliseconds (-1 means it is not set)
const std::vector< Int > & getPossibleChargeStates() const
Non-mutable access to possible charge states.
void setPossibleChargeStates(const std::vector< Int > &possible_charge_states)
Sets the possible charge states.
int Int
Signed integer type.
Definition: Types.h:72
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:44
const double PROTON_MASS_U
Definition: Constants.h:90
const double c
Definition: Constants.h:188
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
DriftTimeUnit
Drift time unit for ion mobility.
Definition: IMTypes.h:23