This class provides the two-dimensional optimization of the picked peak parameters. More...
#include <OpenMS/TRANSFORMATIONS/RAW2PEAK/TwoDOptimization.h>
Classes | |
| struct | Data |
| Helper struct (contains the size of an area and a raw data container). More... | |
Public Member Functions | |
| TwoDOptimization () | |
| Constructor. | |
| TwoDOptimization (const TwoDOptimization &opt) | |
| Copy constructor. | |
| virtual | ~TwoDOptimization () |
| Destructor. | |
| TwoDOptimization & | operator= (const TwoDOptimization &opt) |
| Assignment operator. | |
| DoubleReal | getMZTolerance () const |
| Non-mutable access to the matching epsilon. | |
| void | setMZTolerance (DoubleReal tolerance_mz) |
| Mutable access to the matching epsilon. | |
| DoubleReal | getMaxPeakDistance () const |
| Non-mutable access to the maximal peak distance in a cluster. | |
| void | setMaxPeakDistance (DoubleReal max_peak_distance) |
| Mutable access to the maximal peak distance in a cluster. | |
| DoubleReal | getMaxAbsError () const |
| Non-mutable access to the maximal absolute error. | |
| void | setMaxAbsError (DoubleReal eps_abs) |
| Mutable access to the maximal absolute error. | |
| DoubleReal | getMaxRelError () const |
| Non-mutable access to the maximal relative error. | |
| void | setMaxRelError (DoubleReal eps_rel) |
| Mutable access to the maximal relative error. | |
| UInt | getMaxIterations () const |
| Non-mutable access to the maximal number of iterations. | |
| void | setMaxIterations (UInt max_iteration) |
| Mutable access to the maximal number of iterations. | |
| const OptimizationFunctions::PenaltyFactorsIntensity & | getPenalties () const |
| Non-mutable access to the minimal number of adjacent scans. | |
| void | setPenalties (OptimizationFunctions::PenaltyFactorsIntensity &penalties) |
| Mutable access to the minimal number of adjacent scans. | |
| template<typename InputSpectrumIterator , typename OutputPeakType > | |
| void | optimize (InputSpectrumIterator first, InputSpectrumIterator last, MSExperiment< OutputPeakType > &ms_exp, bool real2D=true) |
| Find two dimensional peak clusters and optimize their peak parameters. | |
Protected Member Functions | |
| void | updateMembers_ () |
| update members method from DefaultParamHandler to update the members | |
Auxiliary Functions for the search of matching regions | |
| std::vector< DoubleReal >::iterator | searchInScan_ (std::vector< DoubleReal >::iterator scan_begin, std::vector< DoubleReal >::iterator scan_end, DoubleReal current_mz) |
| template<typename InputSpectrumIterator , typename OutputPeakType > | |
| void | optimizeRegions_ (InputSpectrumIterator &first, InputSpectrumIterator &last, MSExperiment< OutputPeakType > &ms_exp) |
| template<typename InputSpectrumIterator , typename OutputPeakType > | |
| void | optimizeRegionsScanwise_ (InputSpectrumIterator &first, InputSpectrumIterator &last, MSExperiment< OutputPeakType > &ms_exp) |
| template<typename InputSpectrumIterator , typename OutputPeakType > | |
| void | getRegionEndpoints_ (MSExperiment< OutputPeakType > &exp, InputSpectrumIterator &first, InputSpectrumIterator &last, Size iso_map_idx, DoubleReal noise_level, TwoDOptimization::Data &d) |
| Get the indices of the first and last raw data point of this region. | |
| void | findMatchingPeaks_ (std::multimap< DoubleReal, IsotopeCluster >::iterator &it, MSExperiment<> &ms_exp) |
| Identify matching peak in a peak cluster. | |
Static Protected Member Functions | |
Functions provided to the gsl Levenberg-Marquardt | |
| static Int | residual2D_ (const gsl_vector *x, void *params, gsl_vector *f) |
| Function computing estimated signal and its deviation to the experimental signal*/. | |
| static Int | jacobian2D_ (const gsl_vector *x, void *params, gsl_matrix *J) |
| Function computing the Jacobian */. | |
| static Int | evaluate2D_ (const gsl_vector *x, void *params, gsl_vector *f, gsl_matrix *J) |
| Function that calls residual2D and jacobian2D*/. | |
Protected Attributes | |
| std::multimap< DoubleReal, IsotopeCluster > | iso_map_ |
| stores the retention time of each isotopic cluster | |
| std::multimap< DoubleReal, IsotopeCluster > ::const_iterator | curr_region_ |
| Pointer to the current region. | |
| DoubleReal | max_peak_distance_ |
| upper bound for distance between two peaks belonging to the same region | |
| DoubleReal | tolerance_mz_ |
| threshold for the difference in the peak position of two matching peaks | |
| std::map< Int, std::vector < PeakIndex > > | matching_peaks_ |
| Indices of peaks in the adjacent scans matching peaks in the scan with no. ref_scan. | |
| DoubleReal | eps_abs_ |
| Convergence Parameter: Maximal absolute error. | |
| DoubleReal | eps_rel_ |
| Convergence Parameter: Maximal relative error. | |
| UInt | max_iteration_ |
| Convergence Parameter: Maximal number of iterations. | |
| bool | real_2D_ |
| Optimization considering all scans of a cluster or optimization of each scan separately. | |
| OptimizationFunctions::PenaltyFactorsIntensity | penalties_ |
| Penalty factors for some parameters in the optimization. | |
This class provides the two-dimensional optimization of the picked peak parameters.
Given the picked peaks, this class optimizes the peak parameters of each isotope pattern using a non-linear optimization. The peaks of adjacent scans are adjusted to achieve that a peak occuring in several scans has always the same m/z position. For the optimization the Levenberg-Marquardt algorithm provided from the GSL is used. The optimized parameters are the m/z values, the left and right width, which shall be equal for a peak in all scans, and the peaks' heights.
| Name | Type | Default | Restrictions | Description |
|---|---|---|---|---|
| delta_abs_error | float | 9.99999974737875e-06 | if the absolute error gets smaller than this value the fitting is stopped. | |
| delta_rel_error | float | 9.99999974737875e-06 | if the relative error gets smaller than this value the fitting is stopped. | |
| iterations | int | 10 | maximal number of iterations for the fitting step | |
| penalties:position | float | 0 | If the position changes more than 0.2Da during the fitting it can be penalized | |
| penalties:height | float | 1 | penalty term for the fitting of the intensity:If it gets negative during the fitting it can be penalized. | |
| penalties:left_width | float | 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. | |
| penalties:right_width | float | 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. | |
| 2d:tolerance_mz | float | 2.2 | mz tolerance for cluster construction | |
| 2d:max_peak_distance | float | 1.2 | maximal peak distance in mz in a cluster |
| TwoDOptimization | ( | ) |
Constructor.
| TwoDOptimization | ( | const TwoDOptimization & | opt | ) |
Copy constructor.
| virtual ~TwoDOptimization | ( | ) | [inline, virtual] |
Destructor.
| static Int evaluate2D_ | ( | const gsl_vector * | x, | |
| void * | params, | |||
| gsl_vector * | f, | |||
| gsl_matrix * | J | |||
| ) | [static, protected] |
Function that calls residual2D and jacobian2D*/.
| void findMatchingPeaks_ | ( | std::multimap< DoubleReal, IsotopeCluster >::iterator & | it, | |
| MSExperiment<> & | ms_exp | |||
| ) | [protected] |
Identify matching peak in a peak cluster.
Referenced by TwoDOptimization::optimizeRegions_().
| DoubleReal getMaxAbsError | ( | ) | const [inline] |
Non-mutable access to the maximal absolute error.
| UInt getMaxIterations | ( | ) | const [inline] |
Non-mutable access to the maximal number of iterations.
| DoubleReal getMaxPeakDistance | ( | ) | const [inline] |
Non-mutable access to the maximal peak distance in a cluster.
| DoubleReal getMaxRelError | ( | ) | const [inline] |
Non-mutable access to the maximal relative error.
| DoubleReal getMZTolerance | ( | ) | const [inline] |
Non-mutable access to the matching epsilon.
| const OptimizationFunctions::PenaltyFactorsIntensity& getPenalties | ( | ) | const [inline] |
Non-mutable access to the minimal number of adjacent scans.
| void getRegionEndpoints_ | ( | MSExperiment< OutputPeakType > & | exp, | |
| InputSpectrumIterator & | first, | |||
| InputSpectrumIterator & | last, | |||
| Size | iso_map_idx, | |||
| DoubleReal | noise_level, | |||
| TwoDOptimization::Data & | d | |||
| ) | [protected] |
Get the indices of the first and last raw data point of this region.
References TwoDOptimization::iso_map_, MSExperiment< PeakT, ChromatogramPeakT >::RTBegin(), MSSpectrum< PeakT >::setRT(), and TwoDOptimization::Data::signal2D.
Referenced by TwoDOptimization::optimizeRegions_(), and TwoDOptimization::optimizeRegionsScanwise_().
| static Int jacobian2D_ | ( | const gsl_vector * | x, | |
| void * | params, | |||
| gsl_matrix * | J | |||
| ) | [static, protected] |
Function computing the Jacobian */.
| TwoDOptimization& operator= | ( | const TwoDOptimization & | opt | ) |
Assignment operator.
| void optimize | ( | InputSpectrumIterator | first, | |
| InputSpectrumIterator | last, | |||
| MSExperiment< OutputPeakType > & | ms_exp, | |||
| bool | real2D = true | |||
| ) |
Find two dimensional peak clusters and optimize their peak parameters.
| first | begin of the raw data spectra iterator range | |
| last | end of the raw data spectra interator range | |
| ms_exp | peak map corresponding to the raw data in the range from first to last | |
| real2D | flag if the optimization should be two dimensional or on each scan separately |
| Exception::IllegalArgument | is thrown if required meta information from peak picking is missing (area, shape, left width, right width) or if the input data is invalid in some other way |
References TwoDOptimization::curr_region_, Param::getValue(), TwoDOptimization::iso_map_, TwoDOptimization::max_peak_distance_, TwoDOptimization::optimizeRegions_(), TwoDOptimization::optimizeRegionsScanwise_(), DefaultParamHandler::param_, IsotopeCluster::peaks, TwoDOptimization::real_2D_, IsotopeCluster::scans, TwoDOptimization::searchInScan_(), and MSSpectrum< PeakT >::setRT().
| void optimizeRegions_ | ( | InputSpectrumIterator & | first, | |
| InputSpectrumIterator & | last, | |||
| MSExperiment< OutputPeakType > & | ms_exp | |||
| ) | [protected] |
Performs 2D optimization of all regions
References TwoDOptimization::eps_abs_, TwoDOptimization::eps_rel_, TwoDOptimization::findMatchingPeaks_(), TwoDOptimization::getRegionEndpoints_(), TwoDOptimization::iso_map_, TwoDOptimization::Data::iso_map_iter, OpenMS::Constants::k, TwoDOptimization::Data::matching_peaks, TwoDOptimization::matching_peaks_, TwoDOptimization::max_iteration_, TwoDOptimization::Data::penalties, TwoDOptimization::penalties_, TwoDOptimization::Data::picked_peaks, TwoDOptimization::Data::raw_data_first, TwoDOptimization::Data::signal2D, and TwoDOptimization::Data::total_nr_peaks.
Referenced by TwoDOptimization::optimize().
| void optimizeRegionsScanwise_ | ( | InputSpectrumIterator & | first, | |
| InputSpectrumIterator & | last, | |||
| MSExperiment< OutputPeakType > & | ms_exp | |||
| ) | [protected] |
Performs an optimization of all regions by calling OptimizePick
References MSSpectrum< PeakT >::clear(), MSSpectrum< PeakT >::getFloatDataArrays(), TwoDOptimization::getRegionEndpoints_(), Param::getValue(), PeakShape::height, TwoDOptimization::iso_map_, TwoDOptimization::Data::iso_map_iter, PeakShape::left_width, PeakShape::LORENTZ_PEAK, PenaltyFactors::lWidth, PeakShape::mz_position, OptimizePick::optimize(), DefaultParamHandler::param_, TwoDOptimization::Data::picked_peaks, PenaltyFactors::pos, OptimizePick::Data::positions, TwoDOptimization::Data::raw_data_first, PeakShape::right_width, PenaltyFactors::rWidth, OptimizePick::Data::signal, and TwoDOptimization::Data::signal2D.
Referenced by TwoDOptimization::optimize().
| static Int residual2D_ | ( | const gsl_vector * | x, | |
| void * | params, | |||
| gsl_vector * | f | |||
| ) | [static, protected] |
Function computing estimated signal and its deviation to the experimental signal*/.
| std::vector<DoubleReal>::iterator searchInScan_ | ( | std::vector< DoubleReal >::iterator | scan_begin, | |
| std::vector< DoubleReal >::iterator | scan_end, | |||
| DoubleReal | current_mz | |||
| ) | [protected] |
Referenced by TwoDOptimization::optimize().
| void setMaxAbsError | ( | DoubleReal | eps_abs | ) | [inline] |
Mutable access to the maximal absolute error.
| void setMaxIterations | ( | UInt | max_iteration | ) | [inline] |
Mutable access to the maximal number of iterations.
| void setMaxPeakDistance | ( | DoubleReal | max_peak_distance | ) | [inline] |
Mutable access to the maximal peak distance in a cluster.
| void setMaxRelError | ( | DoubleReal | eps_rel | ) | [inline] |
Mutable access to the maximal relative error.
| void setMZTolerance | ( | DoubleReal | tolerance_mz | ) | [inline] |
Mutable access to the matching epsilon.
| void setPenalties | ( | OptimizationFunctions::PenaltyFactorsIntensity & | penalties | ) | [inline] |
Mutable access to the minimal number of adjacent scans.
References PenaltyFactorsIntensity::height, PenaltyFactors::lWidth, PenaltyFactors::pos, and PenaltyFactors::rWidth.
| void updateMembers_ | ( | ) | [protected, virtual] |
update members method from DefaultParamHandler to update the members
Reimplemented from DefaultParamHandler.
std::multimap<DoubleReal, IsotopeCluster>::const_iterator curr_region_ [protected] |
Pointer to the current region.
Referenced by TwoDOptimization::optimize().
DoubleReal eps_abs_ [protected] |
Convergence Parameter: Maximal absolute error.
Referenced by TwoDOptimization::optimizeRegions_().
DoubleReal eps_rel_ [protected] |
Convergence Parameter: Maximal relative error.
Referenced by TwoDOptimization::optimizeRegions_().
std::multimap<DoubleReal, IsotopeCluster> iso_map_ [protected] |
stores the retention time of each isotopic cluster
Referenced by TwoDOptimization::getRegionEndpoints_(), TwoDOptimization::optimize(), TwoDOptimization::optimizeRegions_(), and TwoDOptimization::optimizeRegionsScanwise_().
std::map<Int, std::vector<PeakIndex> > matching_peaks_ [protected] |
Indices of peaks in the adjacent scans matching peaks in the scan with no. ref_scan.
Referenced by TwoDOptimization::optimizeRegions_().
UInt max_iteration_ [protected] |
Convergence Parameter: Maximal number of iterations.
Referenced by TwoDOptimization::optimizeRegions_().
DoubleReal max_peak_distance_ [protected] |
upper bound for distance between two peaks belonging to the same region
Referenced by TwoDOptimization::optimize().
Penalty factors for some parameters in the optimization.
Referenced by TwoDOptimization::optimizeRegions_().
bool real_2D_ [protected] |
Optimization considering all scans of a cluster or optimization of each scan separately.
Referenced by TwoDOptimization::optimize().
DoubleReal tolerance_mz_ [protected] |
threshold for the difference in the peak position of two matching peaks
| OpenMS / TOPP release 1.10.0 | Documentation generated on Thu Mar 7 2013 09:42:57 using doxygen 1.7.1 |