Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
PeakIntegrator.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: Douglas McCloskey, Pasquale Domenico Colaianni $
32 // $Authors: Douglas McCloskey, Pasquale Domenico Colaianni $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 #include <OpenMS/config.h> // OPENMS_DLLAPI
44 
45 namespace OpenMS
46 {
47 
68  class OPENMS_DLLAPI PeakIntegrator :
69  public DefaultParamHandler
70  {
71 public:
75  virtual ~PeakIntegrator();
76 
80  struct PeakArea
82  {
86  double area = 0.0;
90  double height = 0.0;
94  double apex_pos = 0.0;
99  };
101 
105  struct PeakBackground
107  {
111  double area = 0.0;
115  double height = 0.0;
116  };
118 
123  struct PeakShapeMetrics
125  {
129  double width_at_5 = 0.0;
133  double width_at_10 = 0.0;
137  double width_at_50 = 0.0;
141  double start_position_at_5 = 0.0;
145  double start_position_at_10 = 0.0;
149  double start_position_at_50 = 0.0;
153  double end_position_at_5 = 0.0;
157  double end_position_at_10 = 0.0;
161  double end_position_at_50 = 0.0;
165  double total_width = 0.0;
179  double tailing_factor = 0.0;
189  double asymmetry_factor = 0.0;
194  double slope_of_baseline = 0.0;
199  double baseline_delta_2_height = 0.0;
203  Int points_across_baseline = 0;
207  Int points_across_half_height = 0;
208  };
210 
216  static constexpr const char* INTEGRATION_TYPE_INTENSITYSUM = "intensity_sum";
220  static constexpr const char* INTEGRATION_TYPE_TRAPEZOID = "trapezoid";
222  static constexpr const char* INTEGRATION_TYPE_SIMPSON = "simpson";
224  static constexpr const char* BASELINE_TYPE_BASETOBASE = "base_to_base";
226  static constexpr const char* BASELINE_TYPE_VERTICALDIVISION = "vertical_division";
228  static constexpr const char* BASELINE_TYPE_VERTICALDIVISION_MIN = "vertical_division_min";
230  static constexpr const char* BASELINE_TYPE_VERTICALDIVISION_MAX = "vertical_division_max";
232 
249  PeakArea integratePeak(
250  const MSChromatogram& chromatogram, const double left, const double right
251  ) const;
252 
269  PeakArea integratePeak(
271  ) const;
272 
289  PeakArea integratePeak(
290  const MSSpectrum& spectrum, const double left, const double right
291  ) const;
292 
309  PeakArea integratePeak(
310  const MSSpectrum& spectrum, MSSpectrum::ConstIterator& left, MSSpectrum::ConstIterator& right
311  ) const;
312 
335  PeakBackground estimateBackground(
336  const MSChromatogram& chromatogram, const double left, const double right,
337  const double peak_apex_pos
338  ) const;
339 
362  PeakBackground estimateBackground(
364  const double peak_apex_pos
365  ) const;
366 
389  PeakBackground estimateBackground(
390  const MSSpectrum& spectrum, const double left, const double right,
391  const double peak_apex_pos
392  ) const;
393 
416  PeakBackground estimateBackground(
417  const MSSpectrum& spectrum, MSSpectrum::ConstIterator& left, MSSpectrum::ConstIterator& right,
418  const double peak_apex_pos
419  ) const;
420 
440  PeakShapeMetrics calculatePeakShapeMetrics(
441  const MSChromatogram& chromatogram, const double left, const double right,
442  const double peak_height, const double peak_apex_pos
443  ) const;
444 
464  PeakShapeMetrics calculatePeakShapeMetrics(
466  const double peak_height, const double peak_apex_pos
467  ) const;
468 
488  PeakShapeMetrics calculatePeakShapeMetrics(
489  const MSSpectrum& spectrum, const double left, const double right,
490  const double peak_height, const double peak_apex_pos
491  ) const;
492 
512  PeakShapeMetrics calculatePeakShapeMetrics(
513  const MSSpectrum& spectrum, MSSpectrum::ConstIterator& left, MSSpectrum::ConstIterator& right,
514  const double peak_height, const double peak_apex_pos
515  ) const;
516 
517  void getDefaultParameters(Param& params);
518 
519 protected:
520  void updateMembers_();
521 
522  template <typename PeakContainerT>
523  PeakArea integratePeak_(
524  const PeakContainerT& p, const double left, const double right
525  ) const;
526 
527  template <typename PeakContainerT>
528  PeakBackground estimateBackground_(
529  const PeakContainerT& p, const double left, const double right,
530  const double peak_apex_pos
531  ) const;
532 
533  template <typename PeakContainerConstIteratorT>
534  double simpson_(PeakContainerConstIteratorT it_begin, PeakContainerConstIteratorT it_end) const;
535 
536  template <typename PeakContainerT>
537  PeakShapeMetrics calculatePeakShapeMetrics_(
538  const PeakContainerT& p, const double left, const double right,
539  const double peak_height, const double peak_apex_pos
540  ) const;
541 
561  template <typename PeakContainerConstIteratorT>
562  double findPosAtPeakHeightPercent_(
563  PeakContainerConstIteratorT it_begin,
564  PeakContainerConstIteratorT it_end,
565  const double peak_height,
566  const double percent,
567  const bool is_left_half
568  ) const;
569 
570 private:
571 
576 
581  String integration_type_ = INTEGRATION_TYPE_INTENSITYSUM;
586  String baseline_type_ = BASELINE_TYPE_BASETOBASE;
588 
592 
608  double simpson(MSChromatogram::ConstIterator it_begin, MSChromatogram::ConstIterator it_end) const;
609 
624  double simpson(MSSpectrum::ConstIterator it_begin, MSSpectrum::ConstIterator it_end) const;
626  };
627 }
628 
A more convenient string class.
Definition: String.h:57
The representation of a chromatogram.
Definition: MSChromatogram.h:54
std::vector< PointType > PointArrayType
Definition: ConvexHull2D.h:76
Definition: PeakIntegrator.h:106
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:103
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSChromatogram.h:93
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
ConvexHull2D::PointArrayType hull_points
Definition: PeakIntegrator.h:98
Management and storage of parameters / INI files.
Definition: Param.h:74
Definition: PeakIntegrator.h:124
Compute the area, background and shape metrics of a peak.
Definition: PeakIntegrator.h:68
Definition: PeakIntegrator.h:81
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
int Int
Signed integer type.
Definition: Types.h:102

OpenMS / TOPP release 2.3.0 Documentation generated on Wed Apr 18 2018 19:29:07 using doxygen 1.8.14