OpenMS
Loading...
Searching...
No Matches
EGHTraceFitter Class Reference

A RT Profile fitter using an Exponential Gaussian Hybrid background model. More...

#include <OpenMS/FEATUREFINDER/EGHTraceFitter.h>

Inheritance diagram for EGHTraceFitter:
[legend]
Collaboration diagram for EGHTraceFitter:
[legend]

Classes

class  EGHTraceFunctor
 

Public Member Functions

 EGHTraceFitter ()
 
 EGHTraceFitter (const EGHTraceFitter &other)
 
EGHTraceFitteroperator= (const EGHTraceFitter &source)
 
 ~EGHTraceFitter () override
 
void fit (FeatureFinderAlgorithmPickedHelperStructs::MassTraces &traces) override
 Run the LM fit on traces.
 
double getLowerRTBound () const override
 Lower RT bound of the fitted RT model.
 
double getTau () const
 
double getUpperRTBound () const override
 Upper RT bound of the fitted RT model.
 
double getHeight () const override
 Height of the fitted RT model at its centre.
 
double getSigma () const
 
double getCenter () const override
 Centre of the fitted RT model.
 
bool checkMaximalRTSpan (const double max_rt_span) override
 Whether the fitted RT model stays within max_rt_span of the extended search area.
 
bool checkMinimalRTSpan (const std::pair< double, double > &rt_bounds, const double min_rt_span) override
 Whether the fitted RT model covers at least min_rt_span of the extended search area.
 
double getValue (double rt) const override
 Evaluate the fitted model at retention time rt.
 
double getArea () override
 Area under the fitted RT model.
 
double getFWHM () const override
 Full width at half maximum of the fitted RT model.
 
std::string getGnuplotFormula (const FeatureFinderAlgorithmPickedHelperStructs::MassTrace &trace, const char function_name, const double baseline, const double rt_shift) override
 Gnuplot expression of the fitted model for trace.
 
- Public Member Functions inherited from TraceFitter
 TraceFitter ()
 Default constructor; registers the "max_iteration" and "weighted" defaults on DefaultParamHandler.
 
 TraceFitter (const TraceFitter &source)
 Copy constructor.
 
TraceFitteroperator= (const TraceFitter &source)
 Assignment operator.
 
 ~TraceFitter () override
 Destructor.
 
double computeTheoretical (const FeatureFinderAlgorithmPickedHelperStructs::MassTrace &trace, Size k) const
 Evaluate the fitted model at the RT of the k-th peak of trace, scaled by the trace's theoretical intensity.
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const std::string &name)
 Constructor with name that is displayed in error messages.
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor.
 
virtual ~DefaultParamHandler ()
 Destructor.
 
DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator.
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator.
 
void setParameters (const Param &param)
 Sets the parameters.
 
const ParamgetParameters () const
 Non-mutable access to the parameters.
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters.
 
const std::string & getName () const
 Non-mutable access to the name.
 
void setName (const std::string &name)
 Mutable access to the name.
 
const std::vector< std::string > & getSubsections () const
 Non-mutable access to the registered subsections.
 

Protected Member Functions

std::pair< double, double > getAlphaBoundaries_ (const double alpha) const
 Return an ordered pair of the positions where the EGH reaches a height of alpha * height of the EGH.
 
void getOptimizedParameters_ (const std::vector< double > &x_init) override
 Subclass hook: copy the optimised parameter vector back into the subclass's model fields.
 
void setInitialParameters_ (FeatureFinderAlgorithmPickedHelperStructs::MassTraces &traces)
 
void updateMembers_ () override
 This method is used to update extra member variables at the end of the setParameters() method.
 
- Protected Member Functions inherited from TraceFitter
void updateMembers_ () override
 This method is used to update extra member variables at the end of the setParameters() method.
 
void optimize_ (std::vector< double > &x_init, GenericFunctor &functor)
 Run Levenberg-Marquardt on functor starting from x_init.
 
- Protected Member Functions inherited from DefaultParamHandler
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor.
 

Protected Attributes

double apex_rt_
 
double height_
 
double sigma_
 
double tau_
 
std::pair< double, double > sigma_5_bound_
 
double region_rt_span_
 
- Protected Attributes inherited from TraceFitter
SignedSize max_iterations_
 Maximum number of LM iterations; refreshed from "max_iteration" in updateMembers_.
 
bool weighted_
 Whether mass traces are weighted by theoretical intensity during fitting; refreshed from "weighted" in updateMembers_.
 
- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters.
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes!
 
std::vector< std::string > subsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes!
 
std::string error_name_
 Name that is displayed in error messages during the parameter checking.
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;.
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;.
 

Static Protected Attributes

static const double EPSILON_COEFS_ []
 Coefficients to calculate the proportionality factor for the peak area.
 
static const Size NUM_PARAMS_
 

Additional Inherited Members

- Static Public Member Functions inherited from DefaultParamHandler
static void writeParametersToMetaValues (const Param &write_this, MetaInfoInterface &write_here, const std::string &key_prefix="")
 Writes all parameters to meta values.
 

Detailed Description

A RT Profile fitter using an Exponential Gaussian Hybrid background model.

Lan K, Jorgenson JW. A hybrid of exponential and gaussian functions as a simple model of asymmetric chromatographic peaks. Journal of Chromatography A. 915 (1-2)p. 1-13. Available at: http://linkinghub.elsevier.com/retrieve/pii/S0021967301005945

Parameters of this class are:

NameTypeDefaultRestrictionsDescription
max_iteration int500  Maximum number of iterations used by the Levenberg-Marquardt algorithm.
weighted stringfalse true, falseWeight mass traces according to their theoretical intensities.

Note:
  • If a section name is documented, the documentation is displayed as tooltip.
  • Advanced parameter names are italic.
Experimental classes:
Needs further testing on real data. Note that the tests are currently also focused on testing the EGH as replacement for the gaussian.

Constructor & Destructor Documentation

◆ EGHTraceFitter() [1/2]

◆ EGHTraceFitter() [2/2]

EGHTraceFitter ( const EGHTraceFitter other)

◆ ~EGHTraceFitter()

~EGHTraceFitter ( )
override

Member Function Documentation

◆ checkMaximalRTSpan()

bool checkMaximalRTSpan ( const double  max_rt_span)
overridevirtual

Whether the fitted RT model stays within max_rt_span of the extended search area.

Parameters
[in]max_rt_spanMaximum allowed RT span of the fitted model relative to the extended search area, as a fraction.
Returns
true when the model does not exceed max_rt_span of the search area.

Implements TraceFitter.

◆ checkMinimalRTSpan()

bool checkMinimalRTSpan ( const std::pair< double, double > &  rt_bounds,
const double  min_rt_span 
)
overridevirtual

Whether the fitted RT model covers at least min_rt_span of the extended search area.

Parameters
[in]rt_boundsRT boundaries of the extended search area (lower, upper).
[in]min_rt_spanMinimum RT span the fitted model must cover relative to rt_bounds, as a fraction.
Returns
true when the model spans at least min_rt_span of the search area.

Implements TraceFitter.

◆ fit()

void fit ( FeatureFinderAlgorithmPickedHelperStructs::MassTraces traces)
overridevirtual

Run the LM fit on traces.

Subclasses fill the model parameters and (typically) call optimize_ on a problem-specific functor.

Parameters
[in,out]tracesMass traces to fit; subclasses may set additional bookkeeping on traces.

Implements TraceFitter.

◆ getAlphaBoundaries_()

std::pair< double, double > getAlphaBoundaries_ ( const double  alpha) const
protected

Return an ordered pair of the positions where the EGH reaches a height of alpha * height of the EGH.

Parameters
[in]alphaThe alpha at which the boundaries should be computed

◆ getArea()

double getArea ( )
overridevirtual

Area under the fitted RT model.

Returns
Integrated intensity of the fitted model.

Implements TraceFitter.

◆ getCenter()

double getCenter ( ) const
overridevirtual

Centre of the fitted RT model.

Returns
Centre retention time of the fitted model.

Implements TraceFitter.

◆ getFWHM()

double getFWHM ( ) const
overridevirtual

Full width at half maximum of the fitted RT model.

Returns
FWHM in retention-time units.

Implements TraceFitter.

◆ getGnuplotFormula()

std::string getGnuplotFormula ( const FeatureFinderAlgorithmPickedHelperStructs::MassTrace trace,
const char  function_name,
const double  baseline,
const double  rt_shift 
)
overridevirtual

Gnuplot expression of the fitted model for trace.

Parameters
[in]traceMass trace whose theoretical intensity scales the expression.
[in]function_nameName of the function in the resulting expression (e.g. 'f' for "f(x)").
[in]baselineIntensity of the plotted baseline.
[in]rt_shiftRT offset added to the expression so several traces can be plotted side by side (typically 0 for the first trace and incremented for subsequent traces).
Returns
Gnuplot expression as a String.

Implements TraceFitter.

◆ getHeight()

double getHeight ( ) const
overridevirtual

Height of the fitted RT model at its centre.

Returns
Model intensity at the centre RT.

Implements TraceFitter.

◆ getLowerRTBound()

double getLowerRTBound ( ) const
overridevirtual

Lower RT bound of the fitted RT model.

Returns
Lower RT bound (retention-time units).

Implements TraceFitter.

◆ getOptimizedParameters_()

void getOptimizedParameters_ ( const std::vector< double > &  s)
overrideprotectedvirtual

Subclass hook: copy the optimised parameter vector back into the subclass's model fields.

Called by optimize_ after the LM solver has converged.

Parameters
[in]sOptimised parameter vector (size matches the functor's inputs).

Implements TraceFitter.

◆ getSigma()

double getSigma ( ) const

◆ getTau()

double getTau ( ) const

◆ getUpperRTBound()

double getUpperRTBound ( ) const
overridevirtual

Upper RT bound of the fitted RT model.

Returns
Upper RT bound (retention-time units).

Implements TraceFitter.

◆ getValue()

double getValue ( double  rt) const
overridevirtual

Evaluate the fitted model at retention time rt.

Parameters
[in]rtRetention time at which to evaluate the model.
Returns
Model intensity at rt.

Implements TraceFitter.

◆ operator=()

EGHTraceFitter & operator= ( const EGHTraceFitter source)

◆ setInitialParameters_()

void setInitialParameters_ ( FeatureFinderAlgorithmPickedHelperStructs::MassTraces traces)
protected

◆ updateMembers_()

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

Member Data Documentation

◆ apex_rt_

double apex_rt_
protected

◆ EPSILON_COEFS_

const double EPSILON_COEFS_[]
staticprotected

Coefficients to calculate the proportionality factor for the peak area.

◆ height_

double height_
protected

◆ NUM_PARAMS_

const Size NUM_PARAMS_
staticprotected

◆ region_rt_span_

double region_rt_span_
protected

◆ sigma_

double sigma_
protected

◆ sigma_5_bound_

std::pair<double, double> sigma_5_bound_
protected

◆ tau_

double tau_
protected