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