Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
ChromatogramPeak.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-2013.
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: Andreas Bertsch $
32 // $Authors: Andreas Bertsch $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_KERNEL_CHROMATOGRAMPEAK_H
36 #define OPENMS_KERNEL_CHROMATOGRAMPEAK_H
37 
38 #include <OpenMS/CONCEPT/Types.h>
40 
41 #include <ostream>
42 #include <functional>
43 
44 namespace OpenMS
45 {
46 
55  class OPENMS_DLLAPI ChromatogramPeak
56  {
57 public:
62  enum {DIMENSION = 1};
71 
76  inline ChromatogramPeak() :
78  position_(),
79  intensity_(0)
80  {}
81 
83  inline ChromatogramPeak(const ChromatogramPeak & p) :
84  position_(p.position_),
85  intensity_(p.intensity_)
86  {}
87 
97  {}
99 
104 
106  inline IntensityType getIntensity() const { return intensity_; }
108  inline void setIntensity(IntensityType intensity) { intensity_ = intensity; }
109 
111  inline CoordinateType getRT() const
112  {
113  return position_[0];
114  }
115 
117  inline void setRT(CoordinateType rt)
118  {
119  position_[0] = rt;
120  }
121 
123  inline CoordinateType getPos() const
124  {
125  return position_[0];
126  }
127 
129  inline void setPos(CoordinateType pos)
130  {
131  position_[0] = pos;
132  }
133 
135  inline CoordinateType getMZ() const
136  {
137  return position_[0];
138  }
139 
141  inline void setMZ(CoordinateType rt)
142  {
143  position_[0] = rt;
144  }
145 
147  inline PositionType const & getPosition() const
148  {
149  return position_;
150  }
151 
154  {
155  return position_;
156  }
157 
159  inline void setPosition(PositionType const & position)
160  {
161  position_ = position;
162  }
163 
165 
168  {
169  if (this == &rhs) return *this;
170 
171  intensity_ = rhs.intensity_;
172  position_ = rhs.position_;
173 
174  return *this;
175  }
176 
178  inline bool operator==(const ChromatogramPeak & rhs) const
179  {
180  return intensity_ == rhs.intensity_ && position_ == rhs.position_;
181  }
182 
184  inline bool operator!=(const ChromatogramPeak & rhs) const
185  {
186  return !(operator==(rhs));
187  }
188 
196  struct IntensityLess :
198  std::binary_function<ChromatogramPeak, ChromatogramPeak, bool>
199  {
200  inline bool operator()(ChromatogramPeak const & left, ChromatogramPeak const & right) const
201  {
202  return left.getIntensity() < right.getIntensity();
203  }
204 
205  inline bool operator()(ChromatogramPeak const & left, IntensityType right) const
206  {
207  return left.getIntensity() < right;
208  }
209 
210  inline bool operator()(IntensityType left, ChromatogramPeak const & right) const
211  {
212  return left < right.getIntensity();
213  }
214 
215  inline bool operator()(IntensityType left, IntensityType right) const
216  {
217  return left < right;
218  }
219 
220  };
221 
223  struct RTLess :
224  public std::binary_function<ChromatogramPeak, ChromatogramPeak, bool>
225  {
226  inline bool operator()(const ChromatogramPeak & left, const ChromatogramPeak & right) const
227  {
228  return left.getRT() < right.getPos();
229  }
230 
231  inline bool operator()(ChromatogramPeak const & left, CoordinateType right) const
232  {
233  return left.getRT() < right;
234  }
235 
236  inline bool operator()(CoordinateType left, ChromatogramPeak const & right) const
237  {
238  return left < right.getRT();
239  }
240 
241  inline bool operator()(CoordinateType left, CoordinateType right) const
242  {
243  return left < right;
244  }
245 
246  };
247 
249  struct PositionLess :
250  public std::binary_function<ChromatogramPeak, ChromatogramPeak, bool>
251  {
252  inline bool operator()(const ChromatogramPeak & left, const ChromatogramPeak & right) const
253  {
254  return left.getPosition() < right.getPosition();
255  }
256 
257  inline bool operator()(const ChromatogramPeak & left, const PositionType & right) const
258  {
259  return left.getPosition() < right;
260  }
261 
262  inline bool operator()(const PositionType & left, const ChromatogramPeak & right) const
263  {
264  return left < right.getPosition();
265  }
266 
267  inline bool operator()(const PositionType & left, const PositionType & right) const
268  {
269  return left < right;
270  }
271  };
273 protected:
278  };
279 
281  OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const ChromatogramPeak & point);
282 
283 } // namespace OpenMS
284 
285 #endif // OPENMS_KERNEL_CHROMATOGRAMPEAK_H
void setRT(CoordinateType rt)
Mutable access to RT.
Definition: ChromatogramPeak.h:117
bool operator()(ChromatogramPeak const &left, ChromatogramPeak const &right) const
Definition: ChromatogramPeak.h:200
ChromatogramPeak(const ChromatogramPeak &p)
Copy constructor.
Definition: ChromatogramPeak.h:83
void setPos(CoordinateType pos)
Alias for setRT()
Definition: ChromatogramPeak.h:129
CoordinateType getMZ() const
Alias for getRT()
Definition: ChromatogramPeak.h:135
bool operator!=(const ChromatogramPeak &rhs) const
Equality operator.
Definition: ChromatogramPeak.h:184
bool operator()(IntensityType left, IntensityType right) const
Definition: ChromatogramPeak.h:215
PositionType position_
The data point position.
Definition: ChromatogramPeak.h:275
bool operator()(const PositionType &left, const PositionType &right) const
Definition: ChromatogramPeak.h:267
std::ostream & operator<<(std::ostream &os, const ItraqQuantifier::ItraqQuantifierStats &stats)
bool operator()(ChromatogramPeak const &left, CoordinateType right) const
Definition: ChromatogramPeak.h:231
bool operator()(const ChromatogramPeak &left, const ChromatogramPeak &right) const
Definition: ChromatogramPeak.h:226
~ChromatogramPeak()
Destructor.
Definition: ChromatogramPeak.h:96
PositionType const & getPosition() const
Non-mutable access to the position.
Definition: ChromatogramPeak.h:147
bool operator()(CoordinateType left, ChromatogramPeak const &right) const
Definition: ChromatogramPeak.h:236
ChromatogramPeak & operator=(const ChromatogramPeak &rhs)
Assignment operator.
Definition: ChromatogramPeak.h:167
Comparator by position. As this class has dimension 1, this is basically an alias for RTLess...
Definition: ChromatogramPeak.h:249
DPosition< 1 > PositionType
Position type.
Definition: ChromatogramPeak.h:67
CoordinateType getRT() const
Non-mutable access to RT.
Definition: ChromatogramPeak.h:111
bool operator()(CoordinateType left, CoordinateType right) const
Definition: ChromatogramPeak.h:241
PositionType & getPosition()
Mutable access to the position.
Definition: ChromatogramPeak.h:153
bool operator()(IntensityType left, ChromatogramPeak const &right) const
Definition: ChromatogramPeak.h:210
DoubleReal IntensityType
Intensity type.
Definition: ChromatogramPeak.h:65
Comparator that allows to compare the indices of two peaks by their intensity.
Definition: FeaFiModule.h:56
bool operator()(const ChromatogramPeak &left, const PositionType &right) const
Definition: ChromatogramPeak.h:257
bool operator()(const PositionType &left, const ChromatogramPeak &right) const
Definition: ChromatogramPeak.h:262
void setIntensity(IntensityType intensity)
Mutable access to the data point intensity (height)
Definition: ChromatogramPeak.h:108
bool operator()(ChromatogramPeak const &left, IntensityType right) const
Definition: ChromatogramPeak.h:205
IntensityType getIntensity() const
Non-mutable access to the data point intensity (height)
Definition: ChromatogramPeak.h:106
A 1-dimensional raw data point or peak for chromatograms.
Definition: ChromatogramPeak.h:55
IntensityType intensity_
The data point intensity.
Definition: ChromatogramPeak.h:277
void setMZ(CoordinateType rt)
Alias for setRT()
Definition: ChromatogramPeak.h:141
bool operator==(const ChromatogramPeak &rhs) const
Equality operator.
Definition: ChromatogramPeak.h:178
DoubleReal CoordinateType
Coordinate type.
Definition: ChromatogramPeak.h:69
Comparator by RT position.
Definition: ChromatogramPeak.h:223
void setPosition(PositionType const &position)
Mutable access to the position.
Definition: ChromatogramPeak.h:159
CoordinateType getPos() const
Alias for getRT()
Definition: ChromatogramPeak.h:123
bool operator()(const ChromatogramPeak &left, const ChromatogramPeak &right) const
Definition: ChromatogramPeak.h:252

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:11 using doxygen 1.8.5