| OpenMS 2.5.0

EGHTraceFitter.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2020.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Stephan Aiche $
33 // --------------------------------------------------------------------------
34
35 #pragma once
36
37 #include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/TraceFitter.h>
38
39 namespace OpenMS
40 {
41
54 class OPENMS_DLLAPI EGHTraceFitter :
55 public TraceFitter
56 {
57 public:
59 class EGHTraceFunctor :
60 public TraceFitter::GenericFunctor
61 {
62 public:
63
64 EGHTraceFunctor(int dimensions,
65 const TraceFitter::ModelData* data);
66
67 ~EGHTraceFunctor() override;
68
69 int operator()(const Eigen::VectorXd& x, Eigen::VectorXd& fvec) override;
70
71 // compute Jacobian matrix for the different parameters
72 int df(const Eigen::VectorXd& x, Eigen::MatrixXd& J) override;
73
74 protected:
75 const TraceFitter::ModelData* m_data;
76 };
77
78 EGHTraceFitter();
79
80 EGHTraceFitter(const EGHTraceFitter& other);
81
82 EGHTraceFitter& operator=(const EGHTraceFitter& source);
83
84 ~EGHTraceFitter() override;
85
86 // override important methods
87 void fit(FeatureFinderAlgorithmPickedHelperStructs::MassTraces& traces) override;
88
89 double getLowerRTBound() const override;
90
91 double getTau() const;
92
93 double getUpperRTBound() const override;
94
95 double getHeight() const override;
96
97 double getSigma() const;
98
99 double getCenter() const override;
100
101 bool checkMaximalRTSpan(const double max_rt_span) override;
102
103 bool checkMinimalRTSpan(const std::pair<double, double>& rt_bounds, const double min_rt_span) override;
104
105 double getValue(double rt) const override;
106
107 double getArea() override;
108
109 double getFWHM() const override;
110
111 String getGnuplotFormula(const FeatureFinderAlgorithmPickedHelperStructs::MassTrace& trace, const char function_name, const double baseline, const double rt_shift) override;
112
113 protected:
114 double apex_rt_;
115 double height_;
116
117 double sigma_;
118 double tau_;
119
120 std::pair<double, double> sigma_5_bound_;
121
122 double region_rt_span_;
123
125 static const double EPSILON_COEFS_[];
126
127 static const Size NUM_PARAMS_;
128
134 std::pair<double, double> getAlphaBoundaries_(const double alpha) const;
135
136 void getOptimizedParameters_(const Eigen::VectorXd& x_init) override;
137
138 void setInitialParameters_(FeatureFinderAlgorithmPickedHelperStructs::MassTraces& traces);
139
140 void updateMembers_() override;
141 };
142
143 } // namespace OpenMS
144
OpenMS::FeatureFinderAlgorithmPickedHelperStructs::MassTraces
Helper struct for a collection of mass traces used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:109
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::EGHTraceFitter::EGHTraceFunctor::m_data
const TraceFitter::ModelData * m_data
Definition: EGHTraceFitter.h:75
OpenMS::EGHTraceFitter
A RT Profile fitter using an Exponential Gaussian Hybrid background model.
Definition: EGHTraceFitter.h:54
OpenMS::EGHTraceFitter::sigma_5_bound_
std::pair< double, double > sigma_5_bound_
Definition: EGHTraceFitter.h:120
OpenMS::EGHTraceFitter::tau_
double tau_
Definition: EGHTraceFitter.h:118
OpenMS::TraceFitter
Abstract fitter for RT profile fitting.
Definition: TraceFitter.h:55
OpenMS::FeatureFinderAlgorithmPickedHelperStructs::MassTrace
Helper struct for mass traces used in FeatureFinderAlgorithmPicked.
Definition: FeatureFinderAlgorithmPickedHelperStructs.h:79
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::EGHTraceFitter::EGHTraceFunctor
Definition: EGHTraceFitter.h:59
OpenMS::TraceFitter::ModelData
Definition: TraceFitter.h:167
OpenMS::EGHTraceFitter::region_rt_span_
double region_rt_span_
Definition: EGHTraceFitter.h:122
OpenMS::TraceFitter::GenericFunctor
Definition: TraceFitter.h:62
TraceFitter.h
OpenMS::EGHTraceFitter::sigma_
double sigma_
Definition: EGHTraceFitter.h:117
OpenMS::EGHTraceFitter::apex_rt_
double apex_rt_
Definition: EGHTraceFitter.h:114
OpenMS::EGHTraceFitter::NUM_PARAMS_
static const Size NUM_PARAMS_
Definition: EGHTraceFitter.h:127
OpenMS::EGHTraceFitter::height_
double height_
Definition: EGHTraceFitter.h:115
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127