| OpenMS 2.5.0

IMSElement.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2020.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Anton Pervukhin <Anton.Pervukhin@CeBiTec.Uni-Bielefeld.DE> $
33 // --------------------------------------------------------------------------
34 //
35
36 #pragma once
37
38 #include <string>
39 #include <iosfwd>
40 #include <OpenMS/CHEMISTRY/MASSDECOMPOSITION/IMS/IMSIsotopeDistribution.h>
41
42 namespace OpenMS
43 {
44 namespace ims
45 {
46
58 class OPENMS_DLLAPI IMSElement
59 {
60 public:
62 typedef std::string name_type;
63
65 typedef IMSIsotopeDistribution isotopes_type;
66
68 typedef isotopes_type::mass_type mass_type;
69
71 typedef isotopes_type::nominal_mass_type nominal_mass_type;
72
74 typedef isotopes_type::size_type size_type;
75
77 static const mass_type ELECTRON_MASS_IN_U;
78
80 IMSElement()
81 {}
82
84 IMSElement(const IMSElement & element) :
85 name_(element.name_),
86 sequence_(element.sequence_),
87 isotopes_(element.isotopes_)
88 {}
89
91 IMSElement(const name_type & name,
92 const isotopes_type & isotopes) :
93 name_(name),
94 sequence_(name),
95 isotopes_(isotopes)
96 {}
97
99 IMSElement(const name_type & name,
100 mass_type mass) :
101 name_(name),
102 sequence_(name),
103 isotopes_(mass)
104 {}
105
107 IMSElement(const name_type & name,
108 nominal_mass_type nominal_mass = 0) :
109 name_(name),
110 sequence_(name),
111 isotopes_(nominal_mass)
112 {}
113
120 const name_type & getName() const
121 {
122 return name_;
123 }
124
131 void setName(const name_type & name)
132 {
133 this->name_ = name;
134 }
135
141 const name_type & getSequence() const
142 {
143 return sequence_;
144 }
145
151 void setSequence(const name_type & sequence)
152 {
153 this->sequence_ = sequence;
154 }
155
161 nominal_mass_type getNominalMass() const
162 {
163 return isotopes_.getNominalMass();
164 }
165
172 mass_type getMass(size_type index = 0) const
173 {
174 return isotopes_.getMass(index);
175 }
176
182 mass_type getAverageMass() const
183 {
184 return isotopes_.getAverageMass();
185 }
186
193 mass_type getIonMass(int electrons_number = 1) const
194 {
195 return this->getMass() - electrons_number * ELECTRON_MASS_IN_U;
196 }
197
203 const IMSIsotopeDistribution & getIsotopeDistribution() const
204 {
205 return isotopes_;
206 }
207
213 void setIsotopeDistribution(const IMSIsotopeDistribution & isotopes)
214 {
215 this->isotopes_ = isotopes;
216 }
217
224 IMSElement & operator=(const IMSElement & element);
225
233 bool operator==(const IMSElement & element) const;
234
242 bool operator!=(const IMSElement & element) const;
243
245 virtual ~IMSElement() {}
246
247 private:
249 name_type name_;
250
252 name_type sequence_;
253
255 isotopes_type isotopes_;
256 };
257
264 OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const IMSElement & element);
265
266 } // namespace ims
267 } // namespace OpenMS
268
IMSIsotopeDistribution.h
OpenMS::ims::IMSElement::name_type
std::string name_type
Type of element&#39;s name.
Definition: IMSElement.h:62
OpenMS::ims::IMSElement::setIsotopeDistribution
void setIsotopeDistribution(const IMSIsotopeDistribution &isotopes)
Definition: IMSElement.h:213
OpenMS::ims::IMSElement::setName
void setName(const name_type &name)
Definition: IMSElement.h:131
OpenMS::ims::IMSElement::getIsotopeDistribution
const IMSIsotopeDistribution & getIsotopeDistribution() const
Definition: IMSElement.h:203
OpenMS::ims::IMSElement::~IMSElement
virtual ~IMSElement()
Default destructor.
Definition: IMSElement.h:245
OpenMS::ims::operator<<
std::ostream & operator<<(std::ostream &os, const IMSAlphabet &alphabet)
OpenMS::ims::IMSElement::getSequence
const name_type & getSequence() const
Definition: IMSElement.h:141
OpenMS::ims::IMSIsotopeDistribution::size_type
peaks_container::size_type size_type
Type of peaks container&#39;s size.
Definition: IMSIsotopeDistribution.h:132
OpenMS::ims::IMSElement::getNominalMass
nominal_mass_type getNominalMass() const
Definition: IMSElement.h:161
OpenMS::ims::IMSElement::name_
name_type name_
Element&#39;s name.
Definition: IMSElement.h:249
OpenMS::ims::IMSElement::getMass
mass_type getMass(size_type index=0) const
Definition: IMSElement.h:172
KDTree::operator!=
bool operator!=(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:824
OpenMS::ims::IMSElement::nominal_mass_type
isotopes_type::nominal_mass_type nominal_mass_type
Type of distribution nominal mass.
Definition: IMSElement.h:71
OpenMS::ims::IMSElement::getIonMass
mass_type getIonMass(int electrons_number=1) const
Definition: IMSElement.h:193
OpenMS::ims::IMSElement::isotopes_
isotopes_type isotopes_
Element&#39;s isotope distribution.
Definition: IMSElement.h:255
OpenMS::ims::IMSElement::IMSElement
IMSElement()
Empty constructor.
Definition: IMSElement.h:80
OpenMS::ims::IMSElement::getAverageMass
mass_type getAverageMass() const
Definition: IMSElement.h:182
OpenMS::ims::IMSIsotopeDistribution
Represents a distribution of isotopes restricted to the first K elements.
Definition: IMSIsotopeDistribution.h:87
OpenMS::ims::IMSElement::IMSElement
IMSElement(const name_type &name, const isotopes_type &isotopes)
Constructor with name and isotope distribution.
Definition: IMSElement.h:91
OpenMS::ims::IMSElement::IMSElement
IMSElement(const IMSElement &element)
Copy constructor.
Definition: IMSElement.h:84
OpenMS::ims::IMSElement::getName
const name_type & getName() const
Definition: IMSElement.h:120
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::ims::IMSElement
Represents a chemical atom with name and isotope distribution.
Definition: IMSElement.h:58
OpenMS::ims::IMSElement::IMSElement
IMSElement(const name_type &name, mass_type mass)
Constructor with name and mass of single isotope.
Definition: IMSElement.h:99
OpenMS::ims::IMSElement::ELECTRON_MASS_IN_U
static const mass_type ELECTRON_MASS_IN_U
Mass of electron.
Definition: IMSElement.h:77
double
OpenMS::ims::IMSElement::mass_type
isotopes_type::mass_type mass_type
Type of isotope mass.
Definition: IMSElement.h:68
OpenMS::ims::IMSElement::isotopes_type
IMSIsotopeDistribution isotopes_type
Type of element&#39;s isotope distribution.
Definition: IMSElement.h:65
OpenMS::ims::IMSElement::sequence_
name_type sequence_
Element&#39;s sequence.
Definition: IMSElement.h:252
OpenMS::ims::IMSElement::size_type
isotopes_type::size_type size_type
Type of isotopes size.
Definition: IMSElement.h:74
OpenMS::ims::IMSElement::setSequence
void setSequence(const name_type &sequence)
Definition: IMSElement.h:151
OpenMS::ims::IMSElement::IMSElement
IMSElement(const name_type &name, nominal_mass_type nominal_mass=0)
Constructor with name and nominal mass.
Definition: IMSElement.h:107
OpenMS::ims::IMSIsotopeDistribution::nominal_mass_type
unsigned int nominal_mass_type
Type of isotope nominal mass.
Definition: IMSIsotopeDistribution.h:98
KDTree::operator==
bool operator==(_Iterator< _Val, _Ref, _Ptr > const &, _Iterator< _Val, _Ref, _Ptr > const &)
Definition: KDTree.h:806