Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PeakPickerCWT Class Reference

This class implements a peak picking algorithm using wavelet techniques. More...

#include <OpenMS/TRANSFORMATIONS/RAW2PEAK/PeakPickerCWT.h>

Inheritance diagram for PeakPickerCWT:
DefaultParamHandler ProgressLogger

Classes

struct  PeakArea_
 Class for the internal peak representation. More...
 

Public Types

typedef MSSpectrum::iterator PeakIterator
 Raw data iterator type. More...
 
typedef MSSpectrum::const_iterator ConstPeakIterator
 Const raw data iterator type. More...
 
- Public Types inherited from ProgressLogger
enum  LogType { CMD, GUI, NONE }
 Possible log types. More...
 

Public Member Functions

 PeakPickerCWT ()
 Constructor. More...
 
virtual ~PeakPickerCWT ()
 Destructor. More...
 
void pick (const MSSpectrum<> &input, MSSpectrum<> &output) const
 Applies the peak picking algorithm to a single spectrum. More...
 
void pickExperiment (const MSExperiment<> &input, MSExperiment<> &output)
 Picks the peaks in an MSExperiment. More...
 
double estimatePeakWidth (const MSExperiment<> &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 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...
 
 ~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...
 

Protected Member Functions

void updateMembers_ ()
 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< 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_
 

Additional Inherited Members

- 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_
 

Detailed Description

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 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 optimization method.

The peak parameters are stored in the meta data arrays of the spectra (see MSSpectrum) in this order:

Note
The peaks must be sorted according to ascending m/z!

Member Typedef Documentation

typedef MSSpectrum ::const_iterator ConstPeakIterator

Const raw data iterator type.

typedef MSSpectrum ::iterator PeakIterator

Raw data iterator type.

Constructor & Destructor Documentation

Constructor.

virtual ~PeakPickerCWT ( )
virtual

Destructor.

Member Function Documentation

void addPeak_ ( std::vector< PeakShape > &  peaks_DC,
PeakArea_ area,
double  left_width,
double  right_width,
OptimizePeakDeconvolution::Data data 
) const
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 endpoints 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,
double  peak_bound_cwt 
) const
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.

Int determineChargeState_ ( std::vector< double > &  peak_values) const
protected

Estimate the charge state of the peaks.

double 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.

PeakShape fitPeakShape_ ( const PeakArea_ area) const
protected

Returns the best fitting peakshape.

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
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,
double  resolution,
ContinuousWaveletTransformNumIntegration wt,
double  peak_bound_cwt 
) const
protected

Determines the number of peaks in the given mass range using the cwt.

void getPeakArea_ ( const PeakArea_ area,
double area_left,
double area_right 
) const
protected

Computes the peak's left and right area.

void getPeakCentroid_ ( PeakArea_ area) const
protected

Estimates a peak's centroid position.

Computes the centroid position of the peak using all raw data points which are greater than 'centroid_percentage' (user-param) 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 
) const
protected

Determines a peaks's endpoints.

The algorithm does the following:

  • let x_m be the position of the maximum in the data and let (x_l, x_r) be the left and right neighbours
  • (1) starting from x_l', walk left until one of the following happens
  • the new point is lower than the original bound => we found our left endpoint
  • the new point is larger than the last, but the point left from the new point is smaller. In that case, we either ran into another peak, or we encounter some noise. Therefore we now look in the cwt at the position corresponding to this value. If the cwt here is monotonous, we consider the point as noise and continue further to the left. Otherwise, we probably found the beginning of a new peak and therefore stop here.
  • (2) analogous procedure to the right of x_r
void initializeWT_ ( ContinuousWaveletTransformNumIntegration wt,
const double  peak_bound_in,
double peak_bound_ms_cwt 
) const
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.

double lorentz_ ( const double  height,
const double  lambda,
const double  pos,
const double  x 
) const
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.

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.

Exceptions
Exception::UnableToFit()if peak width cannot be determined (if estimation is set to auto)

Referenced by TOFCalibration::pickAndCalibrate().

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

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.

UInt radius_
protected

The search radius for the determination of a peak's maximum position.

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 2.0.0 Documentation generated on Wed Mar 30 2016 12:49:29 using doxygen 1.8.11