OpenMS
ChromatogramPeak.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: Timo Sachsenberg $
6 // $Authors: Andreas Bertsch $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/CONCEPT/Types.h>
13 
14 #include <iosfwd>
15 #include <functional>
16 
17 namespace OpenMS
18 {
19 
27  class OPENMS_DLLAPI ChromatogramPeak
28  {
29 public:
35  enum {DIMENSION = 1};
37  typedef double IntensityType;
41  typedef double CoordinateType;
43 
49  inline ChromatogramPeak() :
50  position_(),
51  intensity_(0)
52  {}
53 
55  ChromatogramPeak(const ChromatogramPeak & p) = default;
56 
58  inline ChromatogramPeak(const PositionType retention_time, const IntensityType intensity) :
59  position_(retention_time),
60  intensity_(intensity)
61  {}
62 
72  {}
74 
79 
81  inline IntensityType getIntensity() const { return intensity_; }
83  inline void setIntensity(IntensityType intensity) { intensity_ = intensity; }
84 
86  inline CoordinateType getRT() const
87  {
88  return position_[0];
89  }
90 
92  inline void setRT(CoordinateType rt)
93  {
94  position_[0] = rt;
95  }
96 
98  inline CoordinateType getPos() const
99  {
100  return position_[0];
101  }
102 
104  inline void setPos(CoordinateType pos)
105  {
106  position_[0] = pos;
107  }
108 
110  inline PositionType const & getPosition() const
111  {
112  return position_;
113  }
114 
117  {
118  return position_;
119  }
120 
122  inline void setPosition(PositionType const & position)
123  {
124  position_ = position;
125  }
126 
128 
130  ChromatogramPeak & operator=(const ChromatogramPeak & rhs) = default;
131 
133  inline bool operator==(const ChromatogramPeak& rhs) const = default;
134 
136  inline bool operator!=(const ChromatogramPeak & rhs) const
137  {
138  return !(operator==(rhs));
139  }
140 
150  {
151  inline bool operator()(ChromatogramPeak const & left, ChromatogramPeak const & right) const
152  {
153  return left.getIntensity() < right.getIntensity();
154  }
155 
156  inline bool operator()(ChromatogramPeak const & left, IntensityType right) const
157  {
158  return left.getIntensity() < right;
159  }
160 
161  inline bool operator()(IntensityType left, ChromatogramPeak const & right) const
162  {
163  return left < right.getIntensity();
164  }
165 
166  inline bool operator()(IntensityType left, IntensityType right) const
167  {
168  return left < right;
169  }
170 
171  };
172 
174  struct RTLess
175  {
176  inline bool operator()(const ChromatogramPeak & left, const ChromatogramPeak & right) const
177  {
178  return left.getRT() < right.getPos();
179  }
180 
181  inline bool operator()(ChromatogramPeak const & left, CoordinateType right) const
182  {
183  return left.getRT() < right;
184  }
185 
186  inline bool operator()(CoordinateType left, ChromatogramPeak const & right) const
187  {
188  return left < right.getRT();
189  }
190 
191  inline bool operator()(CoordinateType left, CoordinateType right) const
192  {
193  return left < right;
194  }
195 
196  };
197 
200  {
201  inline bool operator()(const ChromatogramPeak & left, const ChromatogramPeak & right) const
202  {
203  return left.getPosition() < right.getPosition();
204  }
205 
206  inline bool operator()(const ChromatogramPeak & left, const PositionType & right) const
207  {
208  return left.getPosition() < right;
209  }
210 
211  inline bool operator()(const PositionType & left, const ChromatogramPeak & right) const
212  {
213  return left < right.getPosition();
214  }
215 
216  inline bool operator()(const PositionType & left, const PositionType & right) const
217  {
218  return left < right;
219  }
220  };
222 protected:
227  };
228 
230  OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const ChromatogramPeak & point);
231 
232 } // namespace OpenMS
233 
A 1-dimensional raw data point or peak for chromatograms.
Definition: ChromatogramPeak.h:28
PositionType const & getPosition() const
Non-mutable access to the position.
Definition: ChromatogramPeak.h:110
ChromatogramPeak(const ChromatogramPeak &p)=default
Copy constructor.
DPosition< 1 > PositionType
Position type.
Definition: ChromatogramPeak.h:39
ChromatogramPeak(const PositionType retention_time, const IntensityType intensity)
Constructor with position and intensity.
Definition: ChromatogramPeak.h:58
double CoordinateType
Coordinate type.
Definition: ChromatogramPeak.h:41
PositionType position_
The data point position.
Definition: ChromatogramPeak.h:224
~ChromatogramPeak()
Destructor.
Definition: ChromatogramPeak.h:71
CoordinateType getPos() const
Alias for getRT()
Definition: ChromatogramPeak.h:98
IntensityType getIntensity() const
Non-mutable access to the data point intensity (height)
Definition: ChromatogramPeak.h:81
void setRT(CoordinateType rt)
Mutable access to RT.
Definition: ChromatogramPeak.h:92
bool operator!=(const ChromatogramPeak &rhs) const
Equality operator.
Definition: ChromatogramPeak.h:136
bool operator==(const ChromatogramPeak &rhs) const =default
Equality operator.
void setIntensity(IntensityType intensity)
Mutable access to the data point intensity (height)
Definition: ChromatogramPeak.h:83
double IntensityType
Intensity type.
Definition: ChromatogramPeak.h:37
void setPosition(PositionType const &position)
Mutable access to the position.
Definition: ChromatogramPeak.h:122
void setPos(CoordinateType pos)
Alias for setRT()
Definition: ChromatogramPeak.h:104
IntensityType intensity_
The data point intensity.
Definition: ChromatogramPeak.h:226
ChromatogramPeak()
Default constructor.
Definition: ChromatogramPeak.h:49
PositionType & getPosition()
Mutable access to the position.
Definition: ChromatogramPeak.h:116
CoordinateType getRT() const
Non-mutable access to RT.
Definition: ChromatogramPeak.h:86
ChromatogramPeak & operator=(const ChromatogramPeak &rhs)=default
Assignment operator.
bool operator==(const IDBoostGraph::ProteinGroup &lhs, const IDBoostGraph::ProteinGroup &rhs)
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
Comparator by intensity.
Definition: ChromatogramPeak.h:150
bool operator()(ChromatogramPeak const &left, ChromatogramPeak const &right) const
Definition: ChromatogramPeak.h:151
bool operator()(ChromatogramPeak const &left, IntensityType right) const
Definition: ChromatogramPeak.h:156
bool operator()(IntensityType left, ChromatogramPeak const &right) const
Definition: ChromatogramPeak.h:161
bool operator()(IntensityType left, IntensityType right) const
Definition: ChromatogramPeak.h:166
Comparator by position. As this class has dimension 1, this is basically an alias for RTLess.
Definition: ChromatogramPeak.h:200
bool operator()(const PositionType &left, const PositionType &right) const
Definition: ChromatogramPeak.h:216
bool operator()(const ChromatogramPeak &left, const ChromatogramPeak &right) const
Definition: ChromatogramPeak.h:201
bool operator()(const PositionType &left, const ChromatogramPeak &right) const
Definition: ChromatogramPeak.h:211
bool operator()(const ChromatogramPeak &left, const PositionType &right) const
Definition: ChromatogramPeak.h:206
Comparator by RT position.
Definition: ChromatogramPeak.h:175
bool operator()(CoordinateType left, CoordinateType right) const
Definition: ChromatogramPeak.h:191
bool operator()(ChromatogramPeak const &left, CoordinateType right) const
Definition: ChromatogramPeak.h:181
bool operator()(const ChromatogramPeak &left, const ChromatogramPeak &right) const
Definition: ChromatogramPeak.h:176
bool operator()(CoordinateType left, ChromatogramPeak const &right) const
Definition: ChromatogramPeak.h:186