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

Extracts chromatographic peaks from a mass trace. More...

#include <OpenMS/FILTERING/DATAREDUCTION/ElutionPeakDetection.h>

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

Public Member Functions

 ElutionPeakDetection ()
 Default Constructor. More...
 
 ~ElutionPeakDetection () override
 Destructor. More...
 
void detectPeaks (MassTrace &mt, std::vector< MassTrace > &single_mtraces)
 Extracts chromatographic peaks from a single MassTrace and stores the resulting split traces in a vector of new mass traces. More...
 
void detectPeaks (std::vector< MassTrace > &mt_vec, std::vector< MassTrace > &single_mtraces)
 Extracts chromatographic peaks from multiple MassTraces and stores the resulting split traces in a vector of new mass traces. More...
 
void filterByPeakWidth (std::vector< MassTrace > &, std::vector< MassTrace > &)
 Filter out mass traces below lower 5 % quartile and above upper 95 % quartile. More...
 
double computeMassTraceNoise (const MassTrace &)
 Compute noise level (as RMSE of the actual signal and the smoothed signal) More...
 
double computeMassTraceSNR (const MassTrace &)
 Compute the signal to noise ratio (estimated by computeMassTraceNoise) More...
 
double computeApexSNR (const MassTrace &)
 Compute the signal to noise ratio at the apex (estimated by computeMassTraceNoise) More...
 
void findLocalExtrema (const MassTrace &tr, const Size &num_neighboring_peaks, std::vector< Size > &chrom_maxes, std::vector< Size > &chrom_mins)
 Computes local extrema on a mass trace. More...
 
void smoothData (MassTrace &mt, int win_size) const
 adds smoothed_intensities to internal data of mt More...
 
- 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...
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor. More...
 
virtual ~ProgressLogger ()
 Destructor. More...
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor. More...
 
ProgressLoggeroperator= (const ProgressLogger &other)
 Assignment Operator. More...
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE! More...
 
LogType getLogType () const
 Returns the type of progress log being used. More...
 
void startProgress (SignedSize begin, SignedSize end, const String &label) const
 Initializes the progress display. More...
 
void setProgress (SignedSize value) const
 Sets the current progress. More...
 
void endProgress () const
 Ends the progress display. More...
 
void nextProgress () const
 increment progress by 1 (according to range begin-end) More...
 

Protected Member Functions

void updateMembers_ () override
 This method is used to update extra member variables at the end of the setParameters() method. 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

void detectElutionPeaks_ (MassTrace &, std::vector< MassTrace > &)
 Main function to do the work. More...
 

Private Attributes

double chrom_fwhm_
 
double chrom_peak_snr_
 
double min_fwhm_
 
double max_fwhm_
 
String pw_filtering_
 Type of width filtering. More...
 
bool mt_snr_filtering_
 Whether to apply S/N filtering. More...
 

Additional Inherited Members

- Public Types inherited from ProgressLogger
enum  LogType { CMD , GUI , NONE }
 Possible log types. More...
 
- 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...
 
- Static Protected Member Functions inherited from ProgressLogger
static String logTypeToFactoryName_ (LogType type)
 Return the name of the factory product used for this log type. 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...
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

Extracts chromatographic peaks from a mass trace.

Mass traces may consist of several consecutively (partly overlapping) eluting peaks, e.g., stemming from (almost) isobaric compounds that are separated by retention time. Especially in metabolomics, isomeric compounds with exactly the same mass but different retentional behaviour may still be contained in the same mass trace.

This method first applies smoothing on the mass trace's intensities, then detects local minima/maxima in order to separate the chromatographic peaks from each other. Detection of maxima is performed on the smoothed intensities and uses a fixed peak width (given as parameter chrom_fwhm) within which only a single maximum is expected. Currently smoothing is done using SavitzkyGolay smoothing with a second order polynomial and a frame length of the fixed peak width.

Depending on the "width_filtering" parameters, mass traces are filtered by length in seconds ("fixed" filter) or by quantile.

The output of the algorithm is a set of chromatographic peaks for each mass trace, i.e. a vector of split mass traces (see ElutionPeakDetection parameters).

In general, a user would want to call the "detectPeaks" functions, potentially followed by the "filterByPeakWidth" function.

Constructor & Destructor Documentation

◆ ElutionPeakDetection()

Default Constructor.

◆ ~ElutionPeakDetection()

~ElutionPeakDetection ( )
override

Destructor.

Member Function Documentation

◆ computeApexSNR()

double computeApexSNR ( const MassTrace )

Compute the signal to noise ratio at the apex (estimated by computeMassTraceNoise)

◆ computeMassTraceNoise()

double computeMassTraceNoise ( const MassTrace )

Compute noise level (as RMSE of the actual signal and the smoothed signal)

◆ computeMassTraceSNR()

double computeMassTraceSNR ( const MassTrace )

Compute the signal to noise ratio (estimated by computeMassTraceNoise)

◆ detectElutionPeaks_()

void detectElutionPeaks_ ( MassTrace ,
std::vector< MassTrace > &   
)
private

Main function to do the work.

◆ detectPeaks() [1/2]

void detectPeaks ( MassTrace mt,
std::vector< MassTrace > &  single_mtraces 
)

Extracts chromatographic peaks from a single MassTrace and stores the resulting split traces in a vector of new mass traces.

Note
Smoothed intensities are added to mt_vec
Parameters
mtInput mass trace
single_mtracesOutput single mass traces (detected peaks)

◆ detectPeaks() [2/2]

void detectPeaks ( std::vector< MassTrace > &  mt_vec,
std::vector< MassTrace > &  single_mtraces 
)

Extracts chromatographic peaks from multiple MassTraces and stores the resulting split traces in a vector of new mass traces.

Note
Smoothed intensities are added to mt_vec
Parameters
mt_vecInput mass traces
single_mtracesOutput single mass traces (detected peaks)

◆ filterByPeakWidth()

void filterByPeakWidth ( std::vector< MassTrace > &  ,
std::vector< MassTrace > &   
)

Filter out mass traces below lower 5 % quartile and above upper 95 % quartile.

◆ findLocalExtrema()

void findLocalExtrema ( const MassTrace tr,
const Size num_neighboring_peaks,
std::vector< Size > &  chrom_maxes,
std::vector< Size > &  chrom_mins 
)

Computes local extrema on a mass trace.

This function computes local extrema on a given input mass trace. It works on the smoothed intensities which must be available at this step. Initially it identifies potential maxima as peaks that have maximum intensity within a range of peak +/- num_neighboring_peaks. All such maxima in the smoothed data get added to the list of maxima. Minima are found through bisection between the maxima.

Parameters
trInput mass trace
num_neighboring_peaksHow many data points are expected to belong to a peak, i.e. the expected peak width (this is used to split traces and find maxima)
chrom_maxesOutput of maxima (gets cleared)
chrom_minsOutput of minima (gets cleared)

Returns a vector of indices where a maxima may occur (chrom_maxes) and a vector of indices where a minima may occur (chrom_mins).

Note
this expects that the input mass trace has been smoothed before and the smoothed intensities are available through tr.getSmoothedIntensities().

◆ smoothData()

void smoothData ( MassTrace mt,
int  win_size 
) const

adds smoothed_intensities to internal data of mt

◆ updateMembers_()

void updateMembers_ ( )
overrideprotectedvirtual

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

◆ chrom_fwhm_

double chrom_fwhm_
private

◆ chrom_peak_snr_

double chrom_peak_snr_
private

◆ max_fwhm_

double max_fwhm_
private

◆ min_fwhm_

double min_fwhm_
private

◆ mt_snr_filtering_

bool mt_snr_filtering_
private

Whether to apply S/N filtering.

◆ pw_filtering_

String pw_filtering_
private

Type of width filtering.