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 |
| Raw data iterator type. | |
| typedef MSSpectrum::const_iterator | ConstPeakIterator |
| Const raw data iterator type. | |
Public Member Functions | |
| PeakPickerCWT () | |
| Constructor. | |
| virtual | ~PeakPickerCWT () |
| Destructor. | |
| void | pick (const MSSpectrum<> &input, MSSpectrum<> &output) |
| Applies the peak picking algorithm to a single spectrum. | |
| void | pickExperiment (const MSExperiment<> &input, MSExperiment<> &output) |
| Picks the peaks in an MSExperiment. | |
| DoubleReal | estimatePeakWidth (const MSExperiment<> &input) |
| Estimates average peak width that can then be used for peak picking. | |
Protected Member Functions | |
| void | updateMembers_ () |
| void | init_ () |
| Initializes the members and parses the parameter object. | |
| void | getPeakArea_ (const PeakArea_ &area, double &area_left, double &area_right) |
| Computes the peak's left and right area. | |
| PeakShape | fitPeakShape_ (const PeakArea_ &area, bool enable_centroid_fit) |
| Returns the best fitting peakshape. | |
| double | correlate_ (const PeakShape &peak, const PeakArea_ &area, Int direction=0) const |
| Returns the squared pearson coefficient. | |
| bool | getMaxPosition_ (PeakIterator first, PeakIterator last, const ContinuousWaveletTransform &wt, PeakArea_ &area, Int distance_from_scan_border, Int ms_level, DoubleReal peak_bound_cwt, DoubleReal peak_bound_ms2_level_cwt, Int direction=1) |
| Finds the next maximum position in the wavelet transform wt. | |
| bool | getPeakEndPoints_ (PeakIterator first, PeakIterator last, PeakArea_ &area, Int distance_from_scan_border, Int &peak_left_index, Int &peak_right_index, ContinuousWaveletTransformNumIntegration &wt) |
| Determines a peaks's endpoints. | |
| void | getPeakCentroid_ (PeakArea_ &area) |
| Estimates a peak's centroid position. | |
| double | lorentz_ (double height, double lambda, double pos, double x) |
| Computes the value of a theroretical lorentz peak at position x. | |
| void | initializeWT_ (ContinuousWaveletTransformNumIntegration &wt, DoubleReal &peak_bound_cwt, DoubleReal &peak_bound_ms2_level_cwt) |
| Computes the threshold for the peak height in the wavelet transform and initializes the wavelet transform. | |
Methods needed for separation of overlapping peaks | |
| bool | deconvolutePeak_ (PeakShape &shape, std::vector< PeakShape > &peak_shapes, DoubleReal peak_bound_cwt) |
| Separates overlapping peaks. | |
| Int | getNumberOfPeaks_ (ConstPeakIterator first, ConstPeakIterator last, std::vector< double > &peak_values, Int direction, DoubleReal resolution, ContinuousWaveletTransformNumIntegration &wt, DoubleReal peak_bound_cwt) |
| Determines the number of peaks in the given mass range using the cwt. | |
| Int | determineChargeState_ (std::vector< double > &peak_values) |
| Estimate the charge state of the peaks. | |
| void | addPeak_ (std::vector< PeakShape > &peaks_DC, PeakArea_ &area, double left_width, double right_width, OptimizePeakDeconvolution::Data &data) |
| Add a peak. | |
Protected Attributes | |
| float | peak_bound_ |
| Threshold for the peak height in the MS 1 level. | |
| float | peak_bound_ms2_level_ |
| Threshold for the peak height in the MS 2 level. | |
| float | signal_to_noise_ |
| Signal to noise threshold. | |
| float | fwhm_bound_ |
| The minimal full width at half maximum. | |
| UInt | radius_ |
| The search radius for the determination of a peak's maximum position. | |
| float | scale_ |
| The dilation of the wavelet. | |
| float | peak_corr_bound_ |
| The threshold for correlation. | |
| float | noise_level_ |
| The threshold for the noise level (TODO: Use the information of the signal to noise estimator). | |
| bool | optimization_ |
| Switch for the optimization of peak parameters. | |
| bool | deconvolution_ |
| Switch for the deconvolution of peak parameters. | |
| bool | two_d_optimization_ |
| Switch for the 2D optimization of peak parameters. | |
This class implements a peak picking algorithm using wavelet techniques.
The algorithm is descripted in detail in Lange et al. (2006) Proc. PSB-06.
This peak picking algorithm uses the continuous wavelet transform of a raw data signal to detect mass peaks. Afterwards a given asymmetric peak function is fitted to the raw data and important peak parameters (e.g. fwhm) are extracted. In an optional step these parameters can be optimized using a non-linear opimization 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 | min: 0 | Minimal signal to noise ratio for a peak to be picked. |
| centroid_percentage | float | 0.8 | min: 0 max: 1 | 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 | 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 | 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 | min: 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 | min: 0 | Minimal peak intensity. |
| thresholds:peak_bound_ms2_level | float | 10 | min: 0 | Minimal peak intensity for MS/MS peaks. |
| thresholds:correlation | float | 0.5 | min: 0 max: 1 | 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 | 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 | 0.001 | min: 0 | spacing of the cwt. |
| optimization:iterations | int | 15 | min: 1 | maximal number of iterations for the fitting step |
| optimization:delta_abs_error | float | 9.99999974737875e-05 | min: 0 | if the absolute error gets smaller than this value the fitting is stopped. |
| optimization:delta_rel_error | float | 9.99999974737875e-05 | min: 0 | if the relative error gets smaller than this value the fitting is stopped |
| optimization:penalties:position | float | 0 | min: 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 | min: 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 | min: 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 | min: 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 | mz tolerance for cluster construction |
| optimization:2d:max_peak_distance | float | 1.2 | min: 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 | 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 | min: 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 | min: 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 | Initial scaling of the cwt used in the seperation 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 | 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.99999974737875e-06 | min: 0 | if the absolute error gets smaller than this value the fitting is stopped. |
| deconvolution:fitting:eps_rel | float | 9.99999974737875e-06 | min: 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 | min: 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 | min: 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 | min: 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 | min: 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 | min: 0 max: 999 | 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 | min: 1 | window length in Thomson |
| SignalToNoiseEstimationParameter:bin_count | int | 30 | min: 3 | number of bins for intensity values |
| SignalToNoiseEstimationParameter:stdev_mp | float | 3 | min: 0.01 max: 999 | 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 | 1e+20 | noise value used for sparse windows |
| typedef MSSpectrum ::const_iterator ConstPeakIterator |
Const raw data iterator type.
| typedef MSSpectrum ::iterator PeakIterator |
Raw data iterator type.
| PeakPickerCWT | ( | ) |
Constructor.
| virtual ~PeakPickerCWT | ( | ) | [virtual] |
Destructor.
| void addPeak_ | ( | std::vector< PeakShape > & | peaks_DC, | |
| PeakArea_ & | area, | |||
| double | left_width, | |||
| double | right_width, | |||
| OptimizePeakDeconvolution::Data & | data | |||
| ) | [protected] |
Add a peak.
| double correlate_ | ( | const PeakShape & | peak, | |
| const PeakArea_ & | area, | |||
| Int | direction = 0 | |||
| ) | const [protected] |
Returns the squared pearson coefficient.
Computes the correlation of the peak and the original data given by the peak enpoints area.left and area.right. If the value is near 1, the fitted peakshape and the raw data are expected to be very similar.
| bool deconvolutePeak_ | ( | PeakShape & | shape, | |
| std::vector< PeakShape > & | peak_shapes, | |||
| DoubleReal | peak_bound_cwt | |||
| ) | [protected] |
Separates overlapping peaks.
It determines the number of peaks lying underneath the initial peak using the cwt with different scales. Then a nonlinear optimzation procedure is applied to optimize the peak parameters.
Estimate the charge state of the peaks.
| DoubleReal estimatePeakWidth | ( | const MSExperiment<> & | 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.
| bool getMaxPosition_ | ( | PeakIterator | first, | |
| PeakIterator | last, | |||
| const ContinuousWaveletTransform & | wt, | |||
| PeakArea_ & | area, | |||
| Int | distance_from_scan_border, | |||
| Int | ms_level, | |||
| DoubleReal | peak_bound_cwt, | |||
| DoubleReal | peak_bound_ms2_level_cwt, | |||
| Int | direction = 1 | |||
| ) | [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 raw 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.
| Int getNumberOfPeaks_ | ( | ConstPeakIterator | first, | |
| ConstPeakIterator | last, | |||
| std::vector< double > & | peak_values, | |||
| Int | direction, | |||
| DoubleReal | resolution, | |||
| ContinuousWaveletTransformNumIntegration & | wt, | |||
| DoubleReal | peak_bound_cwt | |||
| ) | [protected] |
Determines the number of peaks in the given mass range using the cwt.
Computes the peak's left and right area.
| void getPeakCentroid_ | ( | PeakArea_ & | area | ) | [protected] |
Estimates a peak's centroid position.
Computes the centroid position of the peak using all raw data points which are greater than 60% of the most intensive raw data point.
| bool getPeakEndPoints_ | ( | PeakIterator | first, | |
| PeakIterator | last, | |||
| PeakArea_ & | area, | |||
| Int | distance_from_scan_border, | |||
| Int & | peak_left_index, | |||
| Int & | peak_right_index, | |||
| ContinuousWaveletTransformNumIntegration & | wt | |||
| ) | [protected] |
Determines a peaks's endpoints.
The algorithm does the following:
| void init_ | ( | ) | [protected] |
Initializes the members and parses the parameter object.
| void initializeWT_ | ( | ContinuousWaveletTransformNumIntegration & | wt, | |
| DoubleReal & | peak_bound_cwt, | |||
| DoubleReal & | peak_bound_ms2_level_cwt | |||
| ) | [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 continious 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.
Computes the value of a theroretical lorentz peak at position x.
| void pick | ( | const MSSpectrum<> & | input, | |
| MSSpectrum<> & | output | |||
| ) |
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.
| void pickExperiment | ( | const MSExperiment<> & | input, | |
| MSExperiment<> & | output | |||
| ) |
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) |
Referenced by TOFCalibration::pickAndCalibrate().
| void updateMembers_ | ( | ) | [protected] |
bool deconvolution_ [protected] |
Switch for the deconvolution of peak parameters.
float fwhm_bound_ [protected] |
The minimal full width at half maximum.
float noise_level_ [protected] |
The threshold for the noise level (TODO: Use the information of the signal to noise estimator).
bool optimization_ [protected] |
Switch for the optimization of peak parameters.
float peak_bound_ [protected] |
Threshold for the peak height in the MS 1 level.
float peak_bound_ms2_level_ [protected] |
Threshold for the peak height in the MS 2 level.
float peak_corr_bound_ [protected] |
The threshold for correlation.
float scale_ [protected] |
The dilation of the wavelet.
float signal_to_noise_ [protected] |
Signal to noise threshold.
bool two_d_optimization_ [protected] |
Switch for the 2D optimization of peak parameters.
| OpenMS / TOPP release 1.10.0 | Documentation generated on Thu Mar 7 2013 09:42:57 using doxygen 1.7.1 |