OpenMS
IMSElement.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Anton Pervukhin <Anton.Pervukhin@CeBiTec.Uni-Bielefeld.DE> $
7 // --------------------------------------------------------------------------
8 //
9 
10 #pragma once
11 
12 #include <string>
13 #include <iosfwd>
15 
16 namespace OpenMS
17 {
18  namespace ims
19  {
20 
32  class OPENMS_DLLAPI IMSElement
33  {
34 public:
36  typedef std::string name_type;
37 
40 
43 
46 
49 
52 
55  {}
56 
58  IMSElement(const IMSElement & element) :
59  name_(element.name_),
60  sequence_(element.sequence_),
61  isotopes_(element.isotopes_)
62  {}
63 
65  IMSElement(const name_type & name,
66  const isotopes_type & isotopes) :
67  name_(name),
68  sequence_(name),
69  isotopes_(isotopes)
70  {}
71 
73  IMSElement(const name_type & name,
74  mass_type mass) :
75  name_(name),
76  sequence_(name),
77  isotopes_(mass)
78  {}
79 
81  IMSElement(const name_type & name,
82  nominal_mass_type nominal_mass = 0) :
83  name_(name),
84  sequence_(name),
85  isotopes_(nominal_mass)
86  {}
87 
94  const name_type & getName() const
95  {
96  return name_;
97  }
98 
105  void setName(const name_type & name)
106  {
107  this->name_ = name;
108  }
109 
115  const name_type & getSequence() const
116  {
117  return sequence_;
118  }
119 
125  void setSequence(const name_type & sequence)
126  {
127  this->sequence_ = sequence;
128  }
129 
136  {
137  return isotopes_.getNominalMass();
138  }
139 
146  mass_type getMass(size_type index = 0) const
147  {
148  return isotopes_.getMass(index);
149  }
150 
157  {
158  return isotopes_.getAverageMass();
159  }
160 
167  mass_type getIonMass(int electrons_number = 1) const
168  {
169  return this->getMass() - electrons_number * ELECTRON_MASS_IN_U;
170  }
171 
178  {
179  return isotopes_;
180  }
181 
188  {
189  this->isotopes_ = isotopes;
190  }
191 
198  IMSElement & operator=(const IMSElement & element);
199 
207  bool operator==(const IMSElement & element) const;
208 
216  bool operator!=(const IMSElement & element) const;
217 
219  virtual ~IMSElement() {}
220 
221 private:
224 
227 
230  };
231 
238  OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const IMSElement & element);
239 
240  } // namespace ims
241 } // namespace OpenMS
242 
Represents a chemical atom with name and isotope distribution.
Definition: IMSElement.h:33
isotopes_type::mass_type mass_type
Type of isotope mass.
Definition: IMSElement.h:42
const name_type & getName() const
Definition: IMSElement.h:94
IMSElement(const name_type &name, nominal_mass_type nominal_mass=0)
Constructor with name and nominal mass.
Definition: IMSElement.h:81
IMSElement(const name_type &name, const isotopes_type &isotopes)
Constructor with name and isotope distribution.
Definition: IMSElement.h:65
void setName(const name_type &name)
Definition: IMSElement.h:105
isotopes_type::size_type size_type
Type of isotopes size.
Definition: IMSElement.h:48
mass_type getIonMass(int electrons_number=1) const
Definition: IMSElement.h:167
nominal_mass_type getNominalMass() const
Definition: IMSElement.h:135
void setIsotopeDistribution(const IMSIsotopeDistribution &isotopes)
Definition: IMSElement.h:187
name_type name_
Element's name.
Definition: IMSElement.h:223
mass_type getAverageMass() const
Definition: IMSElement.h:156
IMSElement()
Empty constructor.
Definition: IMSElement.h:54
IMSElement & operator=(const IMSElement &element)
isotopes_type::nominal_mass_type nominal_mass_type
Type of distribution nominal mass.
Definition: IMSElement.h:45
void setSequence(const name_type &sequence)
Definition: IMSElement.h:125
std::string name_type
Type of element's name.
Definition: IMSElement.h:36
bool operator!=(const IMSElement &element) const
IMSElement(const name_type &name, mass_type mass)
Constructor with name and mass of single isotope.
Definition: IMSElement.h:73
virtual ~IMSElement()
Default destructor.
Definition: IMSElement.h:219
const IMSIsotopeDistribution & getIsotopeDistribution() const
Definition: IMSElement.h:177
IMSElement(const IMSElement &element)
Copy constructor.
Definition: IMSElement.h:58
const name_type & getSequence() const
Definition: IMSElement.h:115
bool operator==(const IMSElement &element) const
name_type sequence_
Element's sequence.
Definition: IMSElement.h:226
IMSIsotopeDistribution isotopes_type
Type of element's isotope distribution.
Definition: IMSElement.h:39
static const mass_type ELECTRON_MASS_IN_U
Mass of electron.
Definition: IMSElement.h:51
isotopes_type isotopes_
Element's isotope distribution.
Definition: IMSElement.h:229
mass_type getMass(size_type index=0) const
Definition: IMSElement.h:146
Represents a distribution of isotopes restricted to the first K elements.
Definition: IMSIsotopeDistribution.h:62
peaks_container::size_type size_type
Type of peaks container's size.
Definition: IMSIsotopeDistribution.h:106
double mass_type
Type of isotope mass.
Definition: IMSIsotopeDistribution.h:66
unsigned int nominal_mass_type
Type of isotope nominal mass.
Definition: IMSIsotopeDistribution.h:72
std::ostream & operator<<(std::ostream &os, const IMSAlphabet &alphabet)
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22