Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
PeakPickerCWT.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-2017.
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: Eva Lange, Alexandra Zerck $
33 // --------------------------------------------------------------------------
34 //
35 #ifndef OPENMS_TRANSFORMATIONS_RAW2PEAK_PEAKPICKERCWT_H
36 #define OPENMS_TRANSFORMATIONS_RAW2PEAK_PEAKPICKERCWT_H
37 
45 
46 //#define DEBUG_PEAK_PICKING
47 #undef DEBUG_PEAK_PICKING
48 //#define DEBUG_DECONV
49 namespace OpenMS
50 {
51  class PeakShape;
52 
79  class OPENMS_DLLAPI PeakPickerCWT :
80  public DefaultParamHandler,
81  public ProgressLogger
82  {
83 public:
85  typedef MSSpectrum::iterator PeakIterator;
87  typedef MSSpectrum::const_iterator ConstPeakIterator;
88 
90  PeakPickerCWT();
91 
93  virtual ~PeakPickerCWT();
94 
100  void pick(const MSSpectrum & input, MSSpectrum & output) const;
101 
109  void pickExperiment(const PeakMap & input, PeakMap & output);
110 
121  double estimatePeakWidth(const PeakMap & input);
122 
123 protected:
124 
126  float peak_bound_;
127 
130 
133 
135  float fwhm_bound_;
136 
139 
141  float scale_;
142 
145 
148 
151 
154 
157 
158 
159  void updateMembers_();
160 
171  struct OPENMS_DLLAPI PeakArea_
172  {
173  typedef MSSpectrum::iterator PeakIterator;
174  PeakIterator left; //< iterator to the leftmost valid point
175  PeakIterator max; //< iterator to the maximum position
176  PeakIterator right; //< iterator to the rightmost valid point (inclusive)
177  DPosition<1> centroid_position; //< The estimated centroid position in m/z
178  };
179 
181  void getPeakArea_(const PeakArea_ & area, double & area_left, double & area_right) const;
182 
184  PeakShape fitPeakShape_(const PeakArea_ & area) const;
185 
192  double correlate_(const PeakShape & peak, const PeakArea_ & area, Int direction = 0) const;
193 
194 
203  bool getMaxPosition_(const PeakIterator first, const PeakIterator last, const ContinuousWaveletTransform & wt,
204  PeakArea_ & area, const Int distance_from_scan_border,
205  const double peak_bound_cwt, const double peak_bound_ms2_level_cwt, const Int direction = 1) const;
206 
207 
227  bool getPeakEndPoints_(PeakIterator first, PeakIterator last, PeakArea_ & area, Int distance_from_scan_border,
228  Int & peak_left_index, Int & peak_right_index, ContinuousWaveletTransformNumIntegration & wt) const;
229 
230 
237  void getPeakCentroid_(PeakArea_ & area) const;
238 
240  inline double lorentz_(const double height, const double lambda, const double pos, const double x) const
241  {
242  const double x2 = lambda * (x - pos);
243  return height / (1 + x2*x2);
244  }
245 
255  void initializeWT_(ContinuousWaveletTransformNumIntegration& wt, const double peak_bound_in, double& peak_bound_ms_cwt) const;
256 
260 
267  bool deconvolutePeak_(PeakShape & shape, std::vector<PeakShape> & peak_shapes, double peak_bound_cwt) const;
268 
270  Int getNumberOfPeaks_(ConstPeakIterator first, ConstPeakIterator last, std::vector<double> & peak_values,
271  Int direction, double resolution, ContinuousWaveletTransformNumIntegration & wt, double peak_bound_cwt) const;
272 
274  Int determineChargeState_(std::vector<double> & peak_values) const;
275 
277  void addPeak_(std::vector<PeakShape> & peaks_DC, PeakArea_ & area, double left_width, double right_width, OptimizePeakDeconvolution::Data & data) const;
279  }; // end PeakPickerCWT
280 
281 } // namespace OpenMS
282 
283 #endif
PeakIterator right
Definition: PeakPickerCWT.h:176
float signal_to_noise_
Signal to noise threshold.
Definition: PeakPickerCWT.h:132
MSSpectrum::iterator PeakIterator
Raw data iterator type.
Definition: PeakPickerCWT.h:85
PeakIterator left
Definition: PeakPickerCWT.h:174
bool two_d_optimization_
Switch for the 2D optimization of peak parameters.
Definition: PeakPickerCWT.h:156
This class implements a peak picking algorithm using wavelet techniques.
Definition: PeakPickerCWT.h:79
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
MSSpectrum::const_iterator ConstPeakIterator
Const raw data iterator type.
Definition: PeakPickerCWT.h:87
float peak_bound_ms2_level_
Threshold for the peak height in the MS 2 level.
Definition: PeakPickerCWT.h:129
DPosition< 1 > centroid_position
Definition: PeakPickerCWT.h:177
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
This class is the base class of the continuous wavelet transformation.
Definition: ContinuousWaveletTransform.h:47
This class computes the continuous wavelet transformation using a marr wavelet.
Definition: ContinuousWaveletTransformNumIntegration.h:57
bool optimization_
Switch for the optimization of peak parameters.
Definition: PeakPickerCWT.h:150
float peak_bound_
Threshold for the peak height in the MS 1 level.
Definition: PeakPickerCWT.h:126
float noise_level_
The threshold for the noise level (TODO: Use the information of the signal to noise estimator) ...
Definition: PeakPickerCWT.h:147
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
Internal representation of a peak shape (used by the PeakPickerCWT)
Definition: PeakShape.h:51
MSSpectrum::iterator PeakIterator
Definition: PeakPickerCWT.h:173
UInt radius_
The search radius for the determination of a peak&#39;s maximum position.
Definition: PeakPickerCWT.h:138
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:82
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:55
PeakIterator max
Definition: PeakPickerCWT.h:175
Class containing the data needed for optimization.
Definition: OptimizePeakDeconvolution.h:111
double lorentz_(const double height, const double lambda, const double pos, const double x) const
Computes the value of a theoretical Lorentz peak at position x.
Definition: PeakPickerCWT.h:240
float fwhm_bound_
The minimal full width at half maximum.
Definition: PeakPickerCWT.h:135
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
float peak_corr_bound_
The threshold for correlation.
Definition: PeakPickerCWT.h:144
bool deconvolution_
Switch for the deconvolution of peak parameters.
Definition: PeakPickerCWT.h:153
float scale_
The dilation of the wavelet.
Definition: PeakPickerCWT.h:141
int Int
Signed integer type.
Definition: Types.h:103
Class for the internal peak representation.
Definition: PeakPickerCWT.h:171

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:03 using doxygen 1.8.13