OpenMS  2.7.0
Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
PeakIntegrator Class Reference

Compute the area, background and shape metrics of a peak. More...

#include <OpenMS/ANALYSIS/OPENSWATH/PeakIntegrator.h>

Inheritance diagram for PeakIntegrator:
[legend]
Collaboration diagram for PeakIntegrator:
[legend]

Classes

struct  PeakArea
 
struct  PeakBackground
 
struct  PeakShapeMetrics
 

Public Member Functions

 PeakIntegrator ()
 Constructor. More...
 
virtual ~PeakIntegrator ()
 Destructor. More...
 
PeakArea integratePeak (const MSChromatogram &chromatogram, const double left, const double right) const
 Compute the area of a peak contained in a MSChromatogram. More...
 
PeakArea integratePeak (const MSChromatogram &chromatogram, MSChromatogram::ConstIterator &left, MSChromatogram::ConstIterator &right) const
 Compute the area of a peak contained in a MSChromatogram. More...
 
PeakArea integratePeak (const MSSpectrum &spectrum, const double left, const double right) const
 Compute the area of a peak contained in a MSSpectrum. More...
 
PeakArea integratePeak (const MSSpectrum &spectrum, MSSpectrum::ConstIterator &left, MSSpectrum::ConstIterator &right) const
 Compute the area of a peak contained in a MSSpectrum. More...
 
PeakBackground estimateBackground (const MSChromatogram &chromatogram, const double left, const double right, const double peak_apex_pos) const
 Estimate the background of a peak contained in a MSChromatogram. More...
 
PeakBackground estimateBackground (const MSChromatogram &chromatogram, MSChromatogram::ConstIterator &left, MSChromatogram::ConstIterator &right, const double peak_apex_pos) const
 Estimate the background of a peak contained in a MSChromatogram. More...
 
PeakBackground estimateBackground (const MSSpectrum &spectrum, const double left, const double right, const double peak_apex_pos) const
 Estimate the background of a peak contained in a MSSpectrum. More...
 
PeakBackground estimateBackground (const MSSpectrum &spectrum, MSSpectrum::ConstIterator &left, MSSpectrum::ConstIterator &right, const double peak_apex_pos) const
 Estimate the background of a peak contained in a MSSpectrum. More...
 
PeakShapeMetrics calculatePeakShapeMetrics (const MSChromatogram &chromatogram, const double left, const double right, const double peak_height, const double peak_apex_pos) const
 Calculate peak's shape metrics. More...
 
PeakShapeMetrics calculatePeakShapeMetrics (const MSChromatogram &chromatogram, MSChromatogram::ConstIterator &left, MSChromatogram::ConstIterator &right, const double peak_height, const double peak_apex_pos) const
 Calculate peak's shape metrics. More...
 
PeakShapeMetrics calculatePeakShapeMetrics (const MSSpectrum &spectrum, const double left, const double right, const double peak_height, const double peak_apex_pos) const
 Calculate peak's shape metrics. More...
 
PeakShapeMetrics calculatePeakShapeMetrics (const MSSpectrum &spectrum, MSSpectrum::ConstIterator &left, MSSpectrum::ConstIterator &right, const double peak_height, const double peak_apex_pos) const
 Calculate peak's shape metrics. More...
 
void getDefaultParameters (Param &params)
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const String &name)
 Constructor with name that is displayed in error messages. More...
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor. More...
 
virtual ~DefaultParamHandler ()
 Destructor. More...
 
virtual DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator. More...
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator. More...
 
void setParameters (const Param &param)
 Sets the parameters. More...
 
const ParamgetParameters () const
 Non-mutable access to the parameters. More...
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters. More...
 
const StringgetName () const
 Non-mutable access to the name. More...
 
void setName (const String &name)
 Mutable access to the name. More...
 
const std::vector< String > & getSubsections () const
 Non-mutable access to the registered subsections. More...
 

Static Public Attributes

Constant expressions for parameters

Constants expressions used throughout the code and tests to set the integration and baseline types.

static constexpr const char * INTEGRATION_TYPE_INTENSITYSUM = "intensity_sum"
 
static constexpr const char * INTEGRATION_TYPE_TRAPEZOID = "trapezoid"
 Integration type: trapezoid. More...
 
static constexpr const char * INTEGRATION_TYPE_SIMPSON = "simpson"
 Integration type: simpson. More...
 
static constexpr const char * BASELINE_TYPE_BASETOBASE = "base_to_base"
 Baseline type: base to base. More...
 
static constexpr const char * BASELINE_TYPE_VERTICALDIVISION = "vertical_division"
 Baseline type: vertical division (min of end points; only for backwards compatibility) More...
 
static constexpr const char * BASELINE_TYPE_VERTICALDIVISION_MIN = "vertical_division_min"
 Baseline type: vertical division (min of end points) More...
 
static constexpr const char * BASELINE_TYPE_VERTICALDIVISION_MAX = "vertical_division_max"
 Baseline type: vertical division (max of end points) More...
 

Protected Member Functions

void updateMembers_ ()
 This method is used to update extra member variables at the end of the setParameters() method. More...
 
template<typename PeakContainerT >
PeakArea integratePeak_ (const PeakContainerT &pc, double left, double right) const
 
template<typename PeakContainerT >
PeakBackground estimateBackground_ (const PeakContainerT &pc, double left, double right, const double peak_apex_pos) const
 
template<typename PeakContainerConstIteratorT >
double simpson_ (PeakContainerConstIteratorT it_begin, PeakContainerConstIteratorT it_end) const
 Simpson's rule algorithm. More...
 
template<typename PeakContainerT >
PeakShapeMetrics calculatePeakShapeMetrics_ (const PeakContainerT &pc, double left, double right, const double peak_height, const double peak_apex_pos) const
 
template<typename PeakContainerConstIteratorT >
double findPosAtPeakHeightPercent_ (PeakContainerConstIteratorT it_left, PeakContainerConstIteratorT it_right, PeakContainerConstIteratorT it_end, const double peak_height, const double percent, const bool is_left_half) const
 Find the position (RT/MZ) at a given percentage of peak's height. More...
 
- Protected Member Functions inherited from DefaultParamHandler
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. More...
 

Private Member Functions

template<typename PeakContainerT >
const PeakContainerT & EMGPreProcess_ (const PeakContainerT &pc, PeakContainerT &emg_pc, double &left, double &right) const
 Fit the peak to the EMG model. More...
 

Private Attributes

bool fit_EMG_
 Enable/disable EMG peak model fitting. More...
 
EmgGradientDescent emg_
 
Parameters

The user is supposed to select a value for these parameters. By default, the integration_type_ is "intensity_sum" and the baseline_type_ is "base_to_base".

String integration_type_ = INTEGRATION_TYPE_INTENSITYSUM
 
String baseline_type_ = BASELINE_TYPE_BASETOBASE
 

Additional Inherited Members

- Static Public Member Functions inherited from DefaultParamHandler
static void writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const String &prefix="")
 Writes all parameters to meta values. More...
 
- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters. More...
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes! More...
 
std::vector< Stringsubsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes! More...
 
String error_name_
 Name that is displayed in error messages during the parameter checking. More...
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;. More...
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;. More...
 

Detailed Description

Compute the area, background and shape metrics of a peak.

The area computation is performed in integratePeak() and it supports integration by simple sum of the intensity, integration by Simpson's rule implementations for an odd number of unequally spaced points or integration by the trapezoid rule.

The background computation is performed in estimateBackground() and it supports three different approaches to baseline correction, namely computing a rectangular shape under the peak based on the minimum value of the peak borders (vertical_division_min), a rectangular shape based on the maximum value of the beak borders (vertical_division_max) or a trapezoidal shape based on a straight line between the peak borders (base_to_base).

Peak shape metrics are computed in calculatePeakShapeMetrics() and multiple metrics are supported.

The containers supported by the methods are MSChromatogram and MSSpectrum.

Warning
integratePeak() using Simpson's rule can result in negative areas despite strictly positive intensities in the input dataset. An example is given in the class test (see area = -665788.77).

Class Documentation

◆ OpenMS::PeakIntegrator::PeakArea

struct OpenMS::PeakIntegrator::PeakArea
Collaboration diagram for PeakIntegrator::PeakArea:
[legend]
Class Members
double apex_pos

The position of the point with highest intensity

double area

The peak's computed area

double height

The peak's highest intensity

PointArrayType hull_points

The peak's hull points

◆ OpenMS::PeakIntegrator::PeakBackground

struct OpenMS::PeakIntegrator::PeakBackground
Collaboration diagram for PeakIntegrator::PeakBackground:
[legend]
Class Members
double area

The background area estimation

double height

The background height

◆ OpenMS::PeakIntegrator::PeakShapeMetrics

struct OpenMS::PeakIntegrator::PeakShapeMetrics
Collaboration diagram for PeakIntegrator::PeakShapeMetrics:
[legend]
Class Members
double asymmetry_factor

The asymmetry factor is a measure of peak tailing. It is defined as the distance from the center line of the peak to the back slope divided by the distance from the center line of the peak to the front slope, with all measurements made at 10% of the maximum peak height. asymmetry_factor = As = b/a where a is min width to peak maximum at 10% max peak height b is max width to peak maximum at 10% max peak height

double baseline_delta_2_height

The change in baseline divided by the height is a way of comparing the influence of the change of baseline on the peak height.

double end_position_at_10

The end position at which the intensity is 10% the peak's height.

double end_position_at_5

The end position at which the intensity is 5% the peak's height.

double end_position_at_50

The end position at which the intensity is 50% the peak's height.

Int points_across_baseline

The number of points across the baseline.

Int points_across_half_height

The number of points across half the peak's height.

double slope_of_baseline

The slope of the baseline is a measure of slope change. It is approximated as the difference in baselines between the peak start and peak end.

double start_position_at_10

The start position at which the intensity is 10% the peak's height.

double start_position_at_5

The start position at which the intensity is 5% the peak's height.

double start_position_at_50

The start position at which the intensity is 50% the peak's height.

double tailing_factor

The tailing factor is a measure of peak tailing. It is defined as the distance from the front slope of the peak to the back slope divided by twice the distance from the center line of the peak to the front slope, with all measurements made at 5% of the maximum peak height. tailing_factor = Tf = W0.05/2a where W0.05 is peak width at 5% max peak height a = min width to peak maximum at 5% max peak height b = max width to peak maximum at 5% max peak height 0.9 < Tf < 1.2 front Tf < 0.9 tailing Tf > 1.2

double total_width

The peak's total width.

double width_at_10

The width of the peak at 10% the peak's height.

double width_at_5

The width of the peak at 5% the peak's height.

double width_at_50

The width of the peak at 50% the peak's height.

Constructor & Destructor Documentation

◆ PeakIntegrator()

Constructor.

◆ ~PeakIntegrator()

virtual ~PeakIntegrator ( )
virtual

Destructor.

Member Function Documentation

◆ calculatePeakShapeMetrics() [1/4]

PeakShapeMetrics calculatePeakShapeMetrics ( const MSChromatogram chromatogram,
const double  left,
const double  right,
const double  peak_height,
const double  peak_apex_pos 
) const

Calculate peak's shape metrics.

The calculated characteristics are the start and end times at 0.05, 0.10 and 0.5 the peak's height. Also the widths at those positions are calculated. Other values: the peak's total width, its tailing factor, asymmetry factor, baseline delta to height and the slope of the baseline. The number of points across the baseline and also at half height are saved.

Note
Make sure the chromatogram is sorted with respect to retention time.
Parameters
[in]chromatogramThe chromatogram which contains the peak
[in]leftThe left retention time boundary
[in]rightThe right retention time boundary
[in]peak_heightThe peak's highest intensity
[in]peak_apex_posThe position of the point with highest intensity
Returns
A struct containing the calculated peak shape metrics

◆ calculatePeakShapeMetrics() [2/4]

PeakShapeMetrics calculatePeakShapeMetrics ( const MSChromatogram chromatogram,
MSChromatogram::ConstIterator left,
MSChromatogram::ConstIterator right,
const double  peak_height,
const double  peak_apex_pos 
) const

Calculate peak's shape metrics.

The calculated characteristics are the start and end times at 0.05, 0.10 and 0.5 the peak's height. Also the widths at those positions are calculated. Other values: the peak's total width, its tailing factor, asymmetry factor, baseline delta to height and the slope of the baseline. The number of points across the baseline and also at half height are saved.

Note
Make sure the chromatogram is sorted with respect to retention time.
Parameters
[in]chromatogramThe chromatogram which contains the peak
[in]leftThe iterator to the first point
[in]rightThe iterator to the last point
[in]peak_heightThe peak's highest intensity
[in]peak_apex_posThe position of the point with highest intensity
Returns
A struct containing the calculated peak shape metrics

◆ calculatePeakShapeMetrics() [3/4]

PeakShapeMetrics calculatePeakShapeMetrics ( const MSSpectrum spectrum,
const double  left,
const double  right,
const double  peak_height,
const double  peak_apex_pos 
) const

Calculate peak's shape metrics.

The calculated characteristics are the start and end positions at 0.05, 0.10 and 0.5 the peak's height. Also the widths at those positions are calculated. Other values: the peak's total width, its tailing factor, asymmetry factor, baseline delta to height and the slope of the baseline. The number of points across the baseline and also at half height are saved.

Note
Make sure the spectrum is sorted with respect to mass-to-charge ratio.
Parameters
[in]spectrumThe spectrum which contains the peak
[in]leftThe left mass-to-charge ratio boundary
[in]rightThe right mass-to-charge ratio boundary
[in]peak_heightThe peak's highest intensity
[in]peak_apex_posThe position of the point with highest intensity
Returns
A struct containing the calculated peak shape metrics

◆ calculatePeakShapeMetrics() [4/4]

PeakShapeMetrics calculatePeakShapeMetrics ( const MSSpectrum spectrum,
MSSpectrum::ConstIterator left,
MSSpectrum::ConstIterator right,
const double  peak_height,
const double  peak_apex_pos 
) const

Calculate peak's shape metrics.

The calculated characteristics are the start and end positions at 0.05, 0.10 and 0.5 the peak's height. Also the widths at those positions are calculated. Other values: the peak's total width, its tailing factor, asymmetry factor, baseline delta to height and the slope of the baseline. The number of points across the baseline and also at half height are saved.

Note
Make sure the spectrum is sorted with respect to mass-to-charge ratio.
Parameters
[in]spectrumThe spectrum which contains the peak
[in]leftThe iterator to the first point
[in]rightThe iterator to the last point
[in]peak_heightThe peak's highest intensity
[in]peak_apex_posThe position of the point with highest intensity
Returns
A struct containing the calculated peak shape metrics

◆ calculatePeakShapeMetrics_()

PeakShapeMetrics calculatePeakShapeMetrics_ ( const PeakContainerT &  pc,
double  left,
double  right,
const double  peak_height,
const double  peak_apex_pos 
) const
inlineprotected

◆ EMGPreProcess_()

const PeakContainerT& EMGPreProcess_ ( const PeakContainerT &  pc,
PeakContainerT &  emg_pc,
double &  left,
double &  right 
) const
inlineprivate

Fit the peak to the EMG model.

The fitting process happens only if `fit_EMG_` is true. `left` and `right` are updated accordingly.

Template Parameters
PeakContainerTEither a MSChromatogram or a MSSpectrum
Parameters
[in]pcInput peak
[out]emg_pcWill possibly contain the processed peak
[in]leftRT or MZ value of the first point of interest
[in]rightRT or MZ value of the first point of interest
Returns
A const reference to `emg_pc` if the fitting is executed, `pc` otherwise.

References EmgGradientDescent::fitEMGPeakModel().

◆ estimateBackground() [1/4]

PeakBackground estimateBackground ( const MSChromatogram chromatogram,
const double  left,
const double  right,
const double  peak_apex_pos 
) const

Estimate the background of a peak contained in a MSChromatogram.

The user can choose to compute one of two background types: "vertical_sum" and "base_to_base". For the former case, the area is computed as a rectangle with delta RT being the base and the minimum intensity on boundaries as the height. For the latter case, the area is computed as a rectangle trapezoid. Similar to the "vertical_sum" solution, this technique also takes into account the area between the intensities on boundaries.

For both cases, the parameter integration_type_ decides which formula to use to compute the area. The user should make sure to use the same integration_type between calls of estimateBackground() and integratePeak().

Note
Make sure the chromatogram is sorted with respect to retention time.
Exceptions
Exception::InvalidParameterfor class parameter `baseline_type`.
Parameters
[in]chromatogramThe chromatogram which contains the peak
[in]leftThe left retention time boundary
[in]rightThe right retention time boundary
[in]peak_apex_posThe position of the point with highest intensity
Returns
A struct containing the informations about the peak's background area and height

◆ estimateBackground() [2/4]

PeakBackground estimateBackground ( const MSChromatogram chromatogram,
MSChromatogram::ConstIterator left,
MSChromatogram::ConstIterator right,
const double  peak_apex_pos 
) const

Estimate the background of a peak contained in a MSChromatogram.

The user can choose to compute one of two background types: "vertical_sum" and "base_to_base". For the former case, the area is computed as a rectangle with delta RT being the base and the minimum intensity on boundaries as the height. For the latter case, the area is computed as a rectangle trapezoid. Similar to the "vertical_sum" solution, this technique also takes into account the area between the intensities on boundaries.

For both cases, the parameter integration_type_ decides which formula to use to compute the area. The user should make sure to use the same integration_type between calls of estimateBackground() and integratePeak().

Note
Make sure the chromatogram is sorted with respect to retention time.
Exceptions
Exception::InvalidParameterfor class parameter `baseline_type`.
Parameters
[in]chromatogramThe chromatogram which contains the peak
[in]leftThe iterator to the first point
[in]rightThe iterator to the last point
[in]peak_apex_posThe position of the point with highest intensity
Returns
A struct containing the informations about the peak's background area and height

◆ estimateBackground() [3/4]

PeakBackground estimateBackground ( const MSSpectrum spectrum,
const double  left,
const double  right,
const double  peak_apex_pos 
) const

Estimate the background of a peak contained in a MSSpectrum.

The user can choose to compute one of two background types: "vertical_sum" and "base_to_base". For the former case, the area is computed as a rectangle with delta MZ being the base and the minimum intensity on boundaries as the height. For the latter case, the area is computed as a rectangle trapezoid. Similar to the "vertical_sum" solution, this technique also takes into account the area between the intensities on boundaries.

For both cases, the parameter integration_type_ decides which formula to use to compute the area. The user should make sure to use the same integration_type between calls of estimateBackground() and integratePeak().

Note
Make sure the spectrum is sorted with respect to mass-to-charge ratio.
Exceptions
Exception::InvalidParameterfor class parameter `baseline_type`.
Parameters
[in]spectrumThe spectrum which contains the peak
[in]leftThe left mass-to-charge ratio boundary
[in]rightThe right mass-to-charge ratio boundary
[in]peak_apex_posThe position of the point with highest intensity
Returns
A struct containing the informations about the peak's background area and height

◆ estimateBackground() [4/4]

PeakBackground estimateBackground ( const MSSpectrum spectrum,
MSSpectrum::ConstIterator left,
MSSpectrum::ConstIterator right,
const double  peak_apex_pos 
) const

Estimate the background of a peak contained in a MSSpectrum.

The user can choose to compute one of two background types: "vertical_sum" and "base_to_base". For the former case, the area is computed as a rectangle with delta MZ being the base and the minimum intensity on boundaries as the height. For the latter case, the area is computed as a rectangle trapezoid. Similar to the "vertical_sum" solution, this technique also takes into account the area between the intensities on boundaries.

For both cases, the parameter integration_type_ decides which formula to use to compute the area. The user should make sure to use the same integration_type between calls of estimateBackground() and integratePeak().

Note
Make sure the spectrum is sorted with respect to mass-to-charge ratio.
Exceptions
Exception::InvalidParameterfor class parameter `baseline_type`.
Parameters
[in]spectrumThe spectrum which contains the peak
[in]leftThe iterator to the first point
[in]rightThe iterator to the last point
[in]peak_apex_posThe position of the point with highest intensity
Returns
A struct containing the informations about the peak's background area and height

◆ estimateBackground_()

PeakBackground estimateBackground_ ( const PeakContainerT &  pc,
double  left,
double  right,
const double  peak_apex_pos 
) const
inlineprotected

◆ findPosAtPeakHeightPercent_()

double findPosAtPeakHeightPercent_ ( PeakContainerConstIteratorT  it_left,
PeakContainerConstIteratorT  it_right,
PeakContainerConstIteratorT  it_end,
const double  peak_height,
const double  percent,
const bool  is_left_half 
) const
inlineprotected

Find the position (RT/MZ) at a given percentage of peak's height.

Note
The method expects that the iterators span half of the peak's width. Examples:
  • Left half case: the range would be [leftMostPt, peakApexPos)
  • Right half case: the range would be [peakApexPos + 1, rightMostPt + 1)
The method assumes a convex peak. If 5%, 10%, or 50% peak heights are not found on either side of the peak, the closest left (for left peak height percentages) and closest right (for right peak height percentages) will be used.
Parameters
[in]it_leftThe iterator to the first point (must not be past the end)
[in]it_rightThe iterator to the last point (might be past the end)
[in]it_endThe end-iterator of the container
[in]peak_heightThe peak's height
[in]percentAt which percentage of the peak height we want to find the position (common values: 0.05, 0.1, 0.5)
[in]is_left_halfAccording to which half of the peak, the algorithm proceeds to the correct direction
Returns
The position found

◆ getDefaultParameters()

void getDefaultParameters ( Param params)

◆ integratePeak() [1/4]

PeakArea integratePeak ( const MSChromatogram chromatogram,
const double  left,
const double  right 
) const

Compute the area of a peak contained in a MSChromatogram.

The value of integration_type_ decides which integration technique to use:

  • "trapezoid" for the trapezoidal rule
  • "simpson" for the Simpson's rule (for unequally spaced points, Shklov, 1960)
  • "intensity_sum" for the simple sum of the intensities
Note
Make sure the chromatogram is sorted with respect to retention time.
Exceptions
Exception::InvalidParameterfor class parameter `integration_type`.
Parameters
[in]chromatogramThe chromatogram which contains the peak
[in]leftThe left retention time boundary
[in]rightThe right retention time boundary
Returns
A struct containing the informations about the peak's area, height and position

◆ integratePeak() [2/4]

PeakArea integratePeak ( const MSChromatogram chromatogram,
MSChromatogram::ConstIterator left,
MSChromatogram::ConstIterator right 
) const

Compute the area of a peak contained in a MSChromatogram.

The value of integration_type_ decides which integration technique to use:

  • "trapezoid" for the trapezoidal rule
  • "simpson" for the Simpson's rule (for unequally spaced points, Shklov, 1960)
  • "intensity_sum" for the simple sum of the intensities
Note
Make sure the chromatogram is sorted with respect to retention time.
Exceptions
Exception::InvalidParameterfor class parameter `integration_type`.
Parameters
[in]chromatogramThe chromatogram which contains the peak
[in]leftThe iterator to the first point
[in]rightThe iterator to the last point
Returns
A struct containing the informations about the peak's area, height and position

◆ integratePeak() [3/4]

PeakArea integratePeak ( const MSSpectrum spectrum,
const double  left,
const double  right 
) const

Compute the area of a peak contained in a MSSpectrum.

The value of integration_type_ decides which integration technique to use:

  • "trapezoid" for the trapezoidal rule
  • "simpson" for the Simpson's rule (for unequally spaced points, Shklov, 1960)
  • "intensity_sum" for the simple sum of the intensities
Note
Make sure the spectrum is sorted with respect to mass-to-charge ratio.
Exceptions
Exception::InvalidParameterfor class parameter `integration_type`.
Parameters
[in]spectrumThe spectrum which contains the peak
[in]leftThe left mass-to-charge ratio boundary
[in]rightThe right mass-to-charge ratio boundary
Returns
A struct containing the informations about the peak's area, height and position

◆ integratePeak() [4/4]

PeakArea integratePeak ( const MSSpectrum spectrum,
MSSpectrum::ConstIterator left,
MSSpectrum::ConstIterator right 
) const

Compute the area of a peak contained in a MSSpectrum.

The value of integration_type_ decides which integration technique to use:

  • "trapezoid" for the trapezoidal rule
  • "simpson" for the Simpson's rule (for unequally spaced points, Shklov, 1960)
  • "intensity_sum" for the simple sum of the intensities
Note
Make sure the spectrum is sorted with respect to mass-to-charge ratio.
Exceptions
Exception::InvalidParameterfor class parameter `integration_type`.
Parameters
[in]spectrumThe spectrum which contains the peak
[in]leftThe iterator to the first point
[in]rightThe iterator to the last point
Returns
A struct containing the informations about the peak's area, height and position

◆ integratePeak_()

PeakArea integratePeak_ ( const PeakContainerT &  pc,
double  left,
double  right 
) const
inlineprotected

◆ simpson_()

double simpson_ ( PeakContainerConstIteratorT  it_begin,
PeakContainerConstIteratorT  it_end 
) const
inlineprotected

Simpson's rule algorithm.

This implementation expects an odd number of points. The formula used supports unequally spaced points.

Note
Make sure the container (chromatogram or spectrum) is sorted with respect to position (RT or m/z).
Warning
An odd number of points is expected!
Parameters
[in]it_beginThe iterator to the first point
[in]it_endThe iterator to the past-the-last point
Returns
The computed area

References OpenMS::Constants::h, and OpenMS::Constants::k.

◆ updateMembers_()

void updateMembers_ ( )
protectedvirtual

This method is used to update extra member variables at the end of the setParameters() method.

Also call it at the end of the derived classes' copy constructor and assignment operator.

The default implementation is empty.

Reimplemented from DefaultParamHandler.

Member Data Documentation

◆ baseline_type_

String baseline_type_ = BASELINE_TYPE_BASETOBASE
private

The baseline type to use in estimateBackground(). Possible values are: "vertical_division_max", "vertical_division_min", "base_to_base".

◆ BASELINE_TYPE_BASETOBASE

constexpr const char* BASELINE_TYPE_BASETOBASE = "base_to_base"
staticconstexpr

Baseline type: base to base.

◆ BASELINE_TYPE_VERTICALDIVISION

constexpr const char* BASELINE_TYPE_VERTICALDIVISION = "vertical_division"
staticconstexpr

Baseline type: vertical division (min of end points; only for backwards compatibility)

◆ BASELINE_TYPE_VERTICALDIVISION_MAX

constexpr const char* BASELINE_TYPE_VERTICALDIVISION_MAX = "vertical_division_max"
staticconstexpr

Baseline type: vertical division (max of end points)

◆ BASELINE_TYPE_VERTICALDIVISION_MIN

constexpr const char* BASELINE_TYPE_VERTICALDIVISION_MIN = "vertical_division_min"
staticconstexpr

Baseline type: vertical division (min of end points)

◆ emg_

EmgGradientDescent emg_
private

◆ fit_EMG_

bool fit_EMG_
private

Enable/disable EMG peak model fitting.

◆ integration_type_

String integration_type_ = INTEGRATION_TYPE_INTENSITYSUM
private

The integration technique to use in integratePeak() and estimateBackground(). Possible values are: "trapezoid", "simpson", "intensity_sum".

◆ INTEGRATION_TYPE_INTENSITYSUM

constexpr const char* INTEGRATION_TYPE_INTENSITYSUM = "intensity_sum"
staticconstexpr

Integration type: intensity sum

◆ INTEGRATION_TYPE_SIMPSON

constexpr const char* INTEGRATION_TYPE_SIMPSON = "simpson"
staticconstexpr

Integration type: simpson.

◆ INTEGRATION_TYPE_TRAPEZOID

constexpr const char* INTEGRATION_TYPE_TRAPEZOID = "trapezoid"
staticconstexpr

Integration type: trapezoid.