OpenMS
|
Extracts chromatographic peaks from a mass trace. More...
#include <OpenMS/FEATUREFINDER/ElutionPeakDetection.h>
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) const |
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... | |
DefaultParamHandler & | operator= (const DefaultParamHandler &rhs) |
Assignment operator. More... | |
virtual bool | operator== (const DefaultParamHandler &rhs) const |
Equality operator. More... | |
void | setParameters (const Param ¶m) |
Sets the parameters. More... | |
const Param & | getParameters () const |
Non-mutable access to the parameters. More... | |
const Param & | getDefaults () const |
Non-mutable access to the default parameters. More... | |
const String & | getName () 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... | |
ProgressLogger & | operator= (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 | setLogger (ProgressLoggerImpl *logger) |
Sets the logger to be used for progress logging. 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 (UInt64 bytes_processed=0) const |
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 &key_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< String > | subsections_ |
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_ |
ProgressLoggerImpl * | current_logger_ |
Static Protected Attributes inherited from ProgressLogger | |
static int | recursion_depth_ |
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.
Parameters of this class are:Name | Type | Default | Restrictions | Description |
---|---|---|---|---|
chrom_fwhm | float | 5.0 | Expected full-width-at-half-maximum of chromatographic peaks (in seconds). | |
chrom_peak_snr | float | 3.0 | Minimum signal-to-noise a mass trace should have. | |
width_filtering | string | fixed | off, fixed, auto | Enable filtering of unlikely peak widths. The fixed setting filters out mass traces outside the [min_fwhm, max_fwhm] interval (set parameters accordingly!). The auto setting filters with the 5 and 95% quantiles of the peak width distribution. |
min_fwhm | float | 1.0 | Minimum full-width-at-half-maximum of chromatographic peaks (in seconds). Ignored if parameter width_filtering is off or auto. | |
max_fwhm | float | 60.0 | Maximum full-width-at-half-maximum of chromatographic peaks (in seconds). Ignored if parameter width_filtering is off or auto. | |
masstrace_snr_filtering | string | false | true, false | Apply post-filtering by signal-to-noise ratio after smoothing. |
Default Constructor.
|
override |
Destructor.
double computeApexSNR | ( | const MassTrace & | ) |
Compute the signal to noise ratio at the apex (estimated by computeMassTraceNoise)
double computeMassTraceNoise | ( | const MassTrace & | ) |
Compute noise level (as RMSE of the actual signal and the smoothed signal)
double computeMassTraceSNR | ( | const MassTrace & | ) |
Compute the signal to noise ratio (estimated by computeMassTraceNoise)
Main function to do the work.
Extracts chromatographic peaks from a single MassTrace and stores the resulting split traces in a vector of new mass traces.
mt_vec
mt | Input mass trace |
single_mtraces | Output single mass traces (detected peaks) |
Extracts chromatographic peaks from multiple MassTraces and stores the resulting split traces in a vector of new mass traces.
mt_vec
mt_vec | Input mass traces |
single_mtraces | Output single mass traces (detected peaks) |
Filter out mass traces below lower 5 % quartile and above upper 95 % quartile.
void findLocalExtrema | ( | const MassTrace & | tr, |
const Size & | num_neighboring_peaks, | ||
std::vector< Size > & | chrom_maxes, | ||
std::vector< Size > & | chrom_mins | ||
) | const |
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.
tr | Input mass trace |
num_neighboring_peaks | How 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_maxes | Output of maxima (gets cleared) |
chrom_mins | Output 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).
void smoothData | ( | MassTrace & | mt, |
int | win_size | ||
) | const |
adds smoothed_intensities to internal data of mt
|
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.
|
private |
|
private |
|
private |
|
private |
|
private |
Whether to apply S/N filtering.
|
private |
Type of width filtering.