OpenMS  2.6.0
CentroidPeak.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: Markus Mueller $
33 // --------------------------------------------------------------------------
34 //
35 /*
36  * CentroidPeak.h
37  * PeakDetection
38  *
39  * Created by Markus Mueller on 10/19/06.
40  *
41  * Ported to OpenMS by Florian Zeller, florian.zeller@bsse.ethz.ch
42  * December 2010
43  *
44  */
45 
46 #pragma once
47 
48 #include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/SuperHirnConfig.h>
49 
50 #include <OpenMS/CONCEPT/Types.h>
51 
52 #include <iosfwd>
53 #include <string>
54 #include <cmath>
55 #include <vector>
56 
57 namespace OpenMS
58 {
59 
60  class SUPERHIRN_DLLAPI CentroidPeak
61  {
62 public:
63 
64 //static int sfCentroidWindowWidth;
65 
66  CentroidPeak();
67  CentroidPeak(double, double);
68  CentroidPeak(double, double, double);
69  CentroidPeak(const CentroidPeak &);
70  // Copy constructor
71  CentroidPeak(const CentroidPeak *);
72 
73  CentroidPeak & operator=(const CentroidPeak &);
74 
75  bool operator<(const CentroidPeak &);
76 
77  virtual ~CentroidPeak();
78 
79  // getters and setters
80  double getMass();
81  double getIntensity();
82  int getIsotopIdx();
83  double getSignalToNoise();
84  double getFittedIntensity();
85  double getOrgIntensity();
86  std::string getExtraPeakInfo();
87  double getRetentionTime();
88 
89  void setMass(double pMass);
90  void setIntensity(double pIntensity);
91  void setIsotopIdx(double pIsotopIdx);
92  void setSignalToNoise(double in);
93  void setFittedIntensity(double pFittedIntensity);
94  void setOrgIntensity(double pOrgIntensity);
95  void setExtraPeakInfo(std::string in);
96  void setRetentionTime(double in);
97 
98  void show_info();
99  void subtractIntensity(double);
100 
101 protected:
102 
104  double mass_;
105  double intensity_;
108  double tr_;
110  std::string extraPeakInfo_;
111  };
112 
113  // Class for deconvoluted isotopic patterns
114  class DeconvPeak :
115  public CentroidPeak
116  {
117 public:
118 
119  DeconvPeak();
120  DeconvPeak(double, double, int, int, double, double);
121  DeconvPeak(const DeconvPeak &);
122  DeconvPeak(const DeconvPeak *);
123 
124  DeconvPeak & operator=(const DeconvPeak &);
125 
126  ~DeconvPeak() override;
127 
128  // shows the info of the peak:
129  void show_info();
130 
131  // getters and setters
132  int getCharge();
133  int getNrIsotopes();
134  double getC13MassError();
135  double getScore();
136  std::vector<CentroidPeak> getIsotopicPeaks();
137 
138  void setCharge(int pCharge);
139  void setNrIsotopes(int pNrIsotopes);
140  void setC13MassError(double pC13MassError);
141  void setScore(double pScore);
142  void setIsotopicPeaks(std::vector<CentroidPeak> pIsotopicPeaks);
143 
144 protected:
145 
146  int charge_;
149  double score_;
150  std::vector<CentroidPeak> isotopicPeaks_;
151  };
152 
153  // stream operators
154  std::ostream & operator<<(std::ostream &, CentroidPeak &);
155  std::ostream & operator<<(std::ostream &, DeconvPeak &);
156 
157  // inline implementation of getters and setters
158 
159  inline double CentroidPeak::getMass()
160  {
161  return mass_;
162  }
163 
165  {
166  return intensity_;
167  }
168 
170  {
171  return isotopIdx_;
172  }
173 
175  {
176  return signalToNoise_;
177  }
178 
180  {
181  return fittedIntensity_;
182  }
183 
185  {
186  return orgIntensity_;
187  }
188 
189  inline std::string CentroidPeak::getExtraPeakInfo()
190  {
191  return extraPeakInfo_;
192  }
193 
195  {
196  return tr_;
197  }
198 
199  inline void CentroidPeak::setMass(double pMass)
200  {
201  mass_ = pMass;
202  }
203 
204  inline void CentroidPeak::setIntensity(double pIntensity)
205  {
206  intensity_ = pIntensity;
207  }
208 
209  inline void CentroidPeak::setIsotopIdx(double pIsotopIdx)
210  {
211  isotopIdx_ = (int) pIsotopIdx;
212  }
213 
214  inline void CentroidPeak::setSignalToNoise(double in)
215  {
216  signalToNoise_ = in;
217  }
218 
219  inline void CentroidPeak::setFittedIntensity(double pFittedIntensity)
220  {
221  fittedIntensity_ = pFittedIntensity;
222  }
223 
224  inline void CentroidPeak::setOrgIntensity(double pOrgIntensity)
225  {
226  orgIntensity_ = pOrgIntensity;
227  }
228 
229  inline void CentroidPeak::setExtraPeakInfo(std::string in)
230  {
231  extraPeakInfo_ = std::move(in);
232  }
233 
234  inline void CentroidPeak::setRetentionTime(double in)
235  {
236  tr_ = in;
237  }
238 
239  //
240 
242  {
243  return charge_;
244  }
245 
247  {
248  return nrIsotopes_;
249  }
250 
252  {
253  return c13MassError_;
254  }
255 
256  inline double DeconvPeak::getScore()
257  {
258  return score_;
259  }
260 
261  inline std::vector<CentroidPeak> DeconvPeak::getIsotopicPeaks()
262  {
263  return isotopicPeaks_;
264  }
265 
266  inline void DeconvPeak::setCharge(int pCharge)
267  {
268  charge_ = pCharge;
269  }
270 
271  inline void DeconvPeak::setC13MassError(double pC13MassError)
272  {
273  c13MassError_ = pC13MassError;
274  }
275 
276  inline void DeconvPeak::setNrIsotopes(int pNrIsotopes)
277  {
278  nrIsotopes_ = pNrIsotopes;
279  }
280 
281  inline void DeconvPeak::setScore(double pScore)
282  {
283  score_ = pScore;
284  }
285 
286  inline void DeconvPeak::setIsotopicPeaks(std::vector<CentroidPeak> pIsotopicPeaks)
287  {
288  isotopicPeaks_ = pIsotopicPeaks;
289  }
290 
291 } // ns
292 
OpenMS::DeconvPeak::DeconvPeak
DeconvPeak()
OpenMS::CentroidPeak::setSignalToNoise
void setSignalToNoise(double in)
Definition: CentroidPeak.h:214
OpenMS::DeconvPeak::c13MassError_
double c13MassError_
Definition: CentroidPeak.h:148
OpenMS::DeconvPeak::getNrIsotopes
int getNrIsotopes()
Definition: CentroidPeak.h:246
OpenMS::CentroidPeak::setFittedIntensity
void setFittedIntensity(double pFittedIntensity)
Definition: CentroidPeak.h:219
Types.h
OpenMS::DeconvPeak::setScore
void setScore(double pScore)
Definition: CentroidPeak.h:281
OpenMS::DeconvPeak::setNrIsotopes
void setNrIsotopes(int pNrIsotopes)
Definition: CentroidPeak.h:276
OpenMS::CentroidPeak::getExtraPeakInfo
std::string getExtraPeakInfo()
Definition: CentroidPeak.h:189
OpenMS::CentroidPeak::setExtraPeakInfo
void setExtraPeakInfo(std::string in)
Definition: CentroidPeak.h:229
OpenMS::CentroidPeak::signalToNoise_
double signalToNoise_
Definition: CentroidPeak.h:109
OpenMS::CentroidPeak::getOrgIntensity
double getOrgIntensity()
Definition: CentroidPeak.h:184
OpenMS::operator<
bool operator<(const QTCluster &q1, const QTCluster &q2)
OpenMS::DeconvPeak::show_info
void show_info()
OpenMS::CentroidPeak::setIntensity
void setIntensity(double pIntensity)
Definition: CentroidPeak.h:204
OpenMS::DeconvPeak::setIsotopicPeaks
void setIsotopicPeaks(std::vector< CentroidPeak > pIsotopicPeaks)
Definition: CentroidPeak.h:286
OpenMS::CentroidPeak::setMass
void setMass(double pMass)
Definition: CentroidPeak.h:199
OpenMS::DeconvPeak::score_
double score_
Definition: CentroidPeak.h:149
OpenMS::CentroidPeak::getFittedIntensity
double getFittedIntensity()
Definition: CentroidPeak.h:179
OpenMS::CentroidPeak::mass_
double mass_
Definition: CentroidPeak.h:104
OpenMS::CentroidPeak::getIsotopIdx
int getIsotopIdx()
Definition: CentroidPeak.h:169
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::CentroidPeak::getIntensity
double getIntensity()
Definition: CentroidPeak.h:164
OpenMS::CentroidPeak::tr_
double tr_
Definition: CentroidPeak.h:108
OpenMS::CentroidPeak
Definition: CentroidPeak.h:60
OpenMS::DeconvPeak::getC13MassError
double getC13MassError()
Definition: CentroidPeak.h:251
int
OpenMS::CentroidPeak::getRetentionTime
double getRetentionTime()
Definition: CentroidPeak.h:194
OpenMS::DeconvPeak::getCharge
int getCharge()
Definition: CentroidPeak.h:241
OpenMS::DeconvPeak::~DeconvPeak
~DeconvPeak() override
OpenMS::DeconvPeak::isotopicPeaks_
std::vector< CentroidPeak > isotopicPeaks_
Definition: CentroidPeak.h:150
OpenMS::CentroidPeak::setRetentionTime
void setRetentionTime(double in)
Definition: CentroidPeak.h:234
OpenMS::CentroidPeak::setOrgIntensity
void setOrgIntensity(double pOrgIntensity)
Definition: CentroidPeak.h:224
OpenMS::DeconvPeak
Definition: CentroidPeak.h:114
OpenMS::DeconvPeak::operator=
DeconvPeak & operator=(const DeconvPeak &)
OpenMS::DeconvPeak::setC13MassError
void setC13MassError(double pC13MassError)
Definition: CentroidPeak.h:271
OpenMS::operator<<
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
OpenMS::DeconvPeak::nrIsotopes_
int nrIsotopes_
Definition: CentroidPeak.h:147
OpenMS::DeconvPeak::setCharge
void setCharge(int pCharge)
Definition: CentroidPeak.h:266
OpenMS::CentroidPeak::setIsotopIdx
void setIsotopIdx(double pIsotopIdx)
Definition: CentroidPeak.h:209
OpenMS::CentroidPeak::getSignalToNoise
double getSignalToNoise()
Definition: CentroidPeak.h:174
OpenMS::CentroidPeak::getMass
double getMass()
Definition: CentroidPeak.h:159
OpenMS::DeconvPeak::getIsotopicPeaks
std::vector< CentroidPeak > getIsotopicPeaks()
Definition: CentroidPeak.h:261
OpenMS::CentroidPeak::orgIntensity_
double orgIntensity_
Definition: CentroidPeak.h:107
OpenMS::CentroidPeak::intensity_
double intensity_
Definition: CentroidPeak.h:105
OpenMS::DeconvPeak::getScore
double getScore()
Definition: CentroidPeak.h:256
OpenMS::DeconvPeak::charge_
int charge_
Definition: CentroidPeak.h:146
OpenMS::CentroidPeak::fittedIntensity_
double fittedIntensity_
Definition: CentroidPeak.h:106
OpenMS::CentroidPeak::isotopIdx_
int isotopIdx_
Definition: CentroidPeak.h:103
OpenMS::CentroidPeak::extraPeakInfo_
std::string extraPeakInfo_
Definition: CentroidPeak.h:110