OpenMS
2.8.0
|
This class implements a peak picking algorithm using wavelet techniques. More...
#include <OpenMS/TRANSFORMATIONS/RAW2PEAK/PeakPickerCWT.h>
Classes | |
struct | PeakArea_ |
Class for the internal peak representation. More... | |
Public Types | |
typedef MSSpectrum::iterator | PeakIterator |
Profile data iterator type. More... | |
typedef MSSpectrum::const_iterator | ConstPeakIterator |
Const profile data iterator type. More... | |
Public Types inherited from ProgressLogger | |
enum | LogType { CMD , GUI , NONE } |
Possible log types. More... | |
Public Member Functions | |
PeakPickerCWT () | |
Constructor. More... | |
~PeakPickerCWT () override | |
Destructor. More... | |
void | pick (const MSSpectrum &input, MSSpectrum &output) const |
Applies the peak picking algorithm to a single spectrum. More... | |
void | pickExperiment (const PeakMap &input, PeakMap &output) |
Picks the peaks in an MSExperiment. More... | |
double | estimatePeakWidth (const PeakMap &input) |
Estimates average peak width that can then be used for peak picking. 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 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 | 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... | |
void | getPeakArea_ (const PeakArea_ &area, double &area_left, double &area_right) const |
Computes the peak's left and right area. More... | |
PeakShape | fitPeakShape_ (const PeakArea_ &area) const |
Returns the best fitting peakshape. More... | |
double | correlate_ (const PeakShape &peak, const PeakArea_ &area, Int direction=0) const |
Returns the squared Pearson coefficient. More... | |
bool | getMaxPosition_ (const PeakIterator first, const PeakIterator last, const ContinuousWaveletTransform &wt, PeakArea_ &area, const Int distance_from_scan_border, const double peak_bound_cwt, const double peak_bound_ms2_level_cwt, const Int direction=1) const |
Finds the next maximum position in the wavelet transform wt. More... | |
bool | getPeakEndPoints_ (PeakIterator first, PeakIterator last, PeakArea_ &area, Int distance_from_scan_border, Int &peak_left_index, Int &peak_right_index, ContinuousWaveletTransformNumIntegration &wt) const |
Determines a peaks's endpoints. More... | |
void | getPeakCentroid_ (PeakArea_ &area) const |
Estimates a peak's centroid position. More... | |
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. More... | |
void | initializeWT_ (ContinuousWaveletTransformNumIntegration &wt, const double peak_bound_in, double &peak_bound_ms_cwt) const |
Computes the threshold for the peak height in the wavelet transform and initializes the wavelet transform. More... | |
Methods needed for separation of overlapping peaks | |
bool | deconvolutePeak_ (PeakShape &shape, std::vector< PeakShape > &peak_shapes, double peak_bound_cwt) const |
Separates overlapping peaks. More... | |
Int | getNumberOfPeaks_ (ConstPeakIterator first, ConstPeakIterator last, std::vector< double > &peak_values, Int direction, double resolution, ContinuousWaveletTransformNumIntegration &wt, double peak_bound_cwt) const |
Determines the number of peaks in the given mass range using the cwt. More... | |
Int | determineChargeState_ (std::vector< double > &peak_values) const |
Estimate the charge state of the peaks. More... | |
void | addPeak_ (std::vector< PeakShape > &peaks_DC, PeakArea_ &area, double left_width, double right_width, OptimizePeakDeconvolution::Data &data) const |
Add a peak. More... | |
Protected Member Functions inherited from DefaultParamHandler | |
void | defaultsToParam_ () |
Updates the parameters after the defaults have been set in the constructor. More... | |
Protected Attributes | |
float | peak_bound_ |
Threshold for the peak height in the MS 1 level. More... | |
float | peak_bound_ms2_level_ |
Threshold for the peak height in the MS 2 level. More... | |
float | signal_to_noise_ |
Signal to noise threshold. More... | |
float | fwhm_bound_ |
The minimal full width at half maximum. More... | |
UInt | radius_ |
The search radius for the determination of a peak's maximum position. More... | |
float | scale_ |
The dilation of the wavelet. More... | |
float | peak_corr_bound_ |
The threshold for correlation. More... | |
float | noise_level_ |
The threshold for the noise level (TODO: Use the information of the signal to noise estimator) More... | |
bool | optimization_ |
Switch for the optimization of peak parameters. More... | |
bool | deconvolution_ |
Switch for the deconvolution of peak parameters. More... | |
bool | two_d_optimization_ |
Switch for the 2D optimization of peak parameters. 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_ |
Additional Inherited Members | |
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... | |
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... | |
Static Protected Attributes inherited from ProgressLogger | |
static int | recursion_depth_ |
This class implements a peak picking algorithm using wavelet techniques.
The algorithm is described in detail in Lange et al. (2006) Proc. PSB-06.
This peak picking algorithm uses the continuous wavelet transform of a profile data signal to detect mass peaks. Afterwards a given asymmetric peak function is fitted to the profile data and important peak parameters (e.g. fwhm) are extracted. In an optional step these parameters can be optimized using a non-linear optimization method.
The peak parameters are stored in the meta data arrays of the spectra (see MSSpectrum) in this order:
Name | Type | Default | Restrictions | Description |
---|---|---|---|---|
signal_to_noise | float | 1.0 | min: 0.0 | Minimal signal to noise ratio for a peak to be picked. |
centroid_percentage | float | 0.8 | min: 0.0 max: 1.0 | Percentage of the maximum height that the raw data points must exceed to be taken into account for the calculation of the centroid. If it is 1 the centroid position corresponds to the position of the highest intensity. |
peak_width | float | 0.15 | min: 0.0 | Approximate fwhm of the peaks. |
estimate_peak_width | string | false | true, false | Flag if the average peak width shall be estimated. Attention: when this flag is set, the peak_width is ignored. |
fwhm_lower_bound_factor | float | 0.7 | min: 0.0 | Factor that calculates the minimal fwhm value from the peak_width. All peaks with width smaller than fwhm_bound_factor * peak_width are discarded. |
fwhm_upper_bound_factor | float | 20.0 | min: 0.0 | Factor that calculates the maximal fwhm value from the peak_width. All peaks with width greater than fwhm_upper_bound_factor * peak_width are discarded. |
optimization | string | no | no, one_dimensional, two_dimensional | If the peak parameters position, intensity and left/right widthshall be optimized set optimization to one_dimensional or two_dimensional. |
thresholds:peak_bound | float | 10.0 | min: 0.0 | Minimal peak intensity. |
thresholds:peak_bound_ms2_level | float | 10.0 | min: 0.0 | Minimal peak intensity for MS/MS peaks. |
thresholds:correlation | float | 0.5 | min: 0.0 max: 1.0 | minimal correlation of a peak and the raw signal. If a peak has a lower correlation it is skipped. |
thresholds:noise_level | float | 0.1 | min: 0.0 | noise level for the search of the peak endpoints. |
thresholds:search_radius | int | 3 | min: 0 | search radius for the search of the maximum in the signal after a maximum in the cwt was found |
wavelet_transform:spacing | float | 1.0e-03 | min: 0.0 | Spacing of the CWT. Note that the accuracy of the picked peak's centroid position depends in the Raw data spacing, i.e., 50% of raw peak distance at most. |
optimization:iterations | int | 400 | min: 1 | maximal number of iterations for the fitting step |
optimization:penalties:position | float | 0.0 | min: 0.0 | penalty term for the fitting of the position:If it differs too much from the initial one it can be penalized |
optimization:penalties:left_width | float | 1.0 | min: 0.0 | penalty term for the fitting of the left width:If the left width differs too much from the initial one during the fitting it can be penalized. |
optimization:penalties:right_width | float | 1.0 | min: 0.0 | penalty term for the fitting of the right width:If the right width differs too much from the initial one during the fitting it can be penalized. |
optimization:penalties:height | float | 1.0 | min: 0.0 | penalty term for the fitting of the intensity (only used in 2D Optimization):If it gets negative during the fitting it can be penalized. |
optimization:2d:tolerance_mz | float | 2.2 | min: 0.0 | mz tolerance for cluster construction |
optimization:2d:max_peak_distance | float | 1.2 | min: 0.0 | maximal peak distance in mz in a cluster |
deconvolution:deconvolution | string | false | true, false | If you want heavily overlapping peaks to be separated set this value to "true" |
deconvolution:asym_threshold | float | 0.3 | min: 0.0 | If the symmetry of a peak is smaller than asym_thresholds it is assumed that it consists of more than one peak and the deconvolution procedure is started. |
deconvolution:left_width | float | 2.0 | min: 0.0 | 1/left_width is the initial value for the left width of the peaks found in the deconvolution step. |
deconvolution:right_width | float | 2.0 | min: 0.0 | 1/right_width is the initial value for the right width of the peaks found in the deconvolution step. |
deconvolution:scaling | float | 0.12 | min: 0.0 | Initial scaling of the cwt used in the separation of heavily overlapping peaks. The initial value is used for charge 1, for higher charges it is adapted to scaling/charge. |
deconvolution:fitting:fwhm_threshold | float | 0.7 | min: 0.0 | If the FWHM of a peak is higher than 'fwhm_thresholds' it is assumed that it consists of more than one peak and the deconvolution procedure is started. |
deconvolution:fitting:eps_abs | float | 9.999999747378752e-06 | min: 0.0 | if the absolute error gets smaller than this value the fitting is stopped. |
deconvolution:fitting:eps_rel | float | 9.999999747378752e-06 | min: 0.0 | if the relative error gets smaller than this value the fitting is stopped. |
deconvolution:fitting:max_iteration | int | 10 | min: 1 | maximal number of iterations for the fitting step |
deconvolution:fitting:penalties:position | float | 0.0 | min: 0.0 | penalty term for the fitting of the peak position:If the position changes more than 0.5Da during the fitting it can be penalized as well as discrepancies of the peptide mass rule. |
deconvolution:fitting:penalties:height | float | 1.0 | min: 0.0 | penalty term for the fitting of the intensity:If it gets negative during the fitting it can be penalized. |
deconvolution:fitting:penalties:left_width | float | 0.0 | min: 0.0 | penalty term for the fitting of the left width:If the left width gets too broad or negative during the fitting it can be penalized. |
deconvolution:fitting:penalties:right_width | float | 0.0 | min: 0.0 | penalty term for the fitting of the right width:If the right width gets too broad or negative during the fitting it can be penalized. |
SignalToNoiseEstimationParameter:max_intensity | int | -1 | min: -1 | maximal intensity considered for histogram construction. By default, it will be calculated automatically (see auto_mode). Only provide this parameter if you know what you are doing (and change 'auto_mode' to '-1')! All intensities EQUAL/ABOVE 'max_intensity' will not be added to the histogram. If you choose 'max_intensity' too small, the noise estimate might be too small as well. If chosen too big, the bins become quite large (which you could counter by increasing 'bin_count', which increases runtime). |
SignalToNoiseEstimationParameter:auto_max_stdev_factor | float | 3.0 | min: 0.0 max: 999.0 | parameter for 'max_intensity' estimation (if 'auto_mode' == 0): mean + 'auto_max_stdev_factor' * stdev |
SignalToNoiseEstimationParameter:auto_max_percentile | int | 95 | min: 0 max: 100 | parameter for 'max_intensity' estimation (if 'auto_mode' == 1): auto_max_percentile th percentile |
SignalToNoiseEstimationParameter:auto_mode | int | 0 | min: -1 max: 1 | method to use to determine maximal intensity: -1 --> use 'max_intensity'; 0 --> 'auto_max_stdev_factor' method (default); 1 --> 'auto_max_percentile' method |
SignalToNoiseEstimationParameter:win_len | float | 200.0 | min: 1.0 | window length in Thomson |
SignalToNoiseEstimationParameter:bin_count | int | 30 | min: 3 | number of bins for intensity values |
SignalToNoiseEstimationParameter:stdev_mp | float | 3.0 | min: 0.01 max: 999.0 | multiplier for stdev |
SignalToNoiseEstimationParameter:min_required_elements | int | 10 | min: 1 | minimum number of elements required in a window (otherwise it is considered sparse) |
SignalToNoiseEstimationParameter:noise_for_empty_window | float | 1.0e20 | noise value used for sparse windows |
struct OpenMS::PeakPickerCWT::PeakArea_ |
Class for the internal peak representation.
A regular Data-Object which contains some additional useful information for analyzing peaks and their properties The left and right iterators delimit a range in the profile data which represents a profile peak. They define the profile peak endpoints. max
points to the profile data point in [left, right] with the highest intensity, the maximum of the profile peak.
Class Members | ||
---|---|---|
typedef iterator | PeakIterator |
Class Members | ||
---|---|---|
DPosition< 1 > | centroid_position | The estimated centroid position in m/z. |
PeakIterator | left | iterator to the leftmost valid point |
PeakIterator | max | iterator to the maximum position |
PeakIterator | right | iterator to the rightmost valid point (inclusive) |
typedef MSSpectrum::const_iterator ConstPeakIterator |
Const profile data iterator type.
typedef MSSpectrum::iterator PeakIterator |
Profile data iterator type.
PeakPickerCWT | ( | ) |
Constructor.
|
override |
Destructor.
|
protected |
Add a peak.
|
protected |
Returns the squared Pearson coefficient.
Computes the correlation of the peak and the original data given by the peak endpoints area.left and area.right. If the value is near 1, the fitted peakshape and the profile data are expected to be very similar.
|
protected |
Separates overlapping peaks.
It determines the number of peaks lying underneath the initial peak using the cwt with different scales. Then a nonlinear optimization procedure is applied to optimize the peak parameters.
|
protected |
Estimate the charge state of the peaks.
double estimatePeakWidth | ( | const PeakMap & | input | ) |
Estimates average peak width that can then be used for peak picking.
The spectra with the highest TICs are used to estimate an average peak width that can be used as the peak_width parameter for picking the complete data set. Typically, the number of peaks increases with decreasing peak width until a plateau is reached. The beginning of this plateau is our estimate for the peak width. This estimate is averaged over several spectra.
Returns the best fitting peakshape.
|
protected |
Finds the next maximum position in the wavelet transform wt.
If the maximum is greater than peak_bound_cwt we search for the corresponding maximum in the profile data interval [first,last) given a predefined search radius radius. Only peaks with intensities greater than peak_bound_ are relevant. If no peak is detected the method return false. For direction=1, the method runs from first to last given direction=-1 it runs the other way around.
|
protected |
Determines the number of peaks in the given mass range using the cwt.
|
protected |
Computes the peak's left and right area.
|
protected |
Estimates a peak's centroid position.
Computes the centroid position of the peak using all profile data points which are greater than 'centroid_percentage' (user-param) of the most intensive profile data point.
|
protected |
Determines a peaks's endpoints.
The algorithm does the following:
|
protected |
Computes the threshold for the peak height in the wavelet transform and initializes the wavelet transform.
Given the threshold for the peak height a corresponding value peak_bound_cwt can be computed for the continuous wavelet transform. Therefore we compute a theoretical Lorentzian peakshape with height=peak_bound_ and a width which is similar to the width of the wavelet. Taking the maximum in the wavelet transform of the Lorentzian peak we have a peak bound in the wavelet transform.
|
inlineprotected |
Computes the value of a theoretical Lorentz peak at position x.
void pick | ( | const MSSpectrum & | input, |
MSSpectrum & | output | ||
) | const |
Applies the peak picking algorithm to a single spectrum.
Picks the peaks in the input spectrum and writes the resulting peaks to the output container.
Picks the peaks in an MSExperiment.
Picks the peaks successive in every scan in the spectrum range. The detected peaks are stored in the output MSExperiment.
Exception::UnableToFit() | if peak width cannot be determined (if estimation is set to auto) |
|
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.
|
protected |
Switch for the deconvolution of peak parameters.
|
protected |
The minimal full width at half maximum.
|
protected |
The threshold for the noise level (TODO: Use the information of the signal to noise estimator)
|
protected |
Switch for the optimization of peak parameters.
|
protected |
Threshold for the peak height in the MS 1 level.
|
protected |
Threshold for the peak height in the MS 2 level.
|
protected |
The threshold for correlation.
|
protected |
The search radius for the determination of a peak's maximum position.
|
protected |
The dilation of the wavelet.
|
protected |
Signal to noise threshold.
|
protected |
Switch for the 2D optimization of peak parameters.