Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
OptimizePeakDeconvolution.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-2013.
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: Alexandra Zerck $
32 // $Authors: $
33 // --------------------------------------------------------------------------
34 //
35 
36 #ifndef OPENMS_TRANSFORMATIONS_RAW2PEAK_OPTIMIZEPEAKDECONVOLUTION_H
37 #define OPENMS_TRANSFORMATIONS_RAW2PEAK_OPTIMIZEPEAKDECONVOLUTION_H
38 
41 #include <gsl/gsl_vector.h>
42 #include <gsl/gsl_multifit_nlin.h>
43 #include <gsl/gsl_blas.h>
45 
46 //#define DEBUG_DECONV
47 #include <iostream>
48 #ifdef DEBUG_DECONV
49 #include <iostream>
50 #include <fstream>
51 #endif
52 #include <vector>
53 
54 namespace OpenMS
55 {
56 
57  namespace OptimizationFunctions
58  {
59 
66  struct OPENMS_DLLAPI PenaltyFactorsIntensity :
67  public PenaltyFactors
68  {
70  PenaltyFactors(), height(0){}
72  PenaltyFactors(p), height(p.height) {}
74  {
75  height = p.height;
76  pos = p.pos;
77  lWidth = p.lWidth;
78  rWidth = p.rWidth;
79 
80  return *this;
81  }
82 
84 
86 
87 
88  };
89 
90 
91 
92  } //namespace OptimizationFunctions
93 
105  class OPENMS_DLLAPI OptimizePeakDeconvolution :
106  public DefaultParamHandler
107  {
108 public:
112  typedef std::vector<Peak1D> RawDataVector;
113  typedef RawDataVector::iterator PeakIterator;
115 
119  struct Data
120  {
121  std::vector<PeakShape> peaks;
122  std::vector<DoubleReal> positions;
123  std::vector<DoubleReal> signal;
126  };
127 
128 
129 
135 
138  DefaultParamHandler(opt),
139  penalties_(opt.penalties_),
140  charge_(opt.charge_){}
141 
145 
150  {
152  penalties_ = opt.penalties_;
153  charge_ = opt.charge_;
154 
155  return *this;
156  }
157 
159 
160 
164  inline const OptimizationFunctions::PenaltyFactorsIntensity & getPenalties() const { return penalties_; }
168  {
169  penalties_ = penalties;
170  param_.setValue("penalties:left_width", penalties_.lWidth);
171  param_.setValue("penalties:right_width", penalties_.rWidth);
172  param_.setValue("penalties:height", penalties_.height);
173  param_.setValue("penalties:position", penalties_.pos);
174  }
175 
177  inline Int getCharge() const { return charge_; }
179  inline void setCharge(const Int charge) { charge_ = charge; }
181 
182 
184  bool optimize(std::vector<PeakShape> & peaks, Data & data);
185 
186 protected:
187  // Penalty factors for some parameter in the optimization
189 
192 
194  static const DoubleReal dist_;
195 
197  Size getNumberOfPeaks_(Int charge, std::vector<PeakShape> & temp_shapes, Data & data);
198 
199  // After each iteration the fwhm of all peaks is checked whether it isn't too large
200  bool checkFWHM_(std::vector<PeakShape> & peaks, gsl_multifit_fdfsolver * & fit);
201 
202  void updateMembers_();
203  }; // class
204 
205 } // namespace OpenMS
206 
207 
208 #endif
This class provides the deconvolution of peak regions using non-linear optimization.
Definition: OptimizePeakDeconvolution.h:105
~PenaltyFactorsIntensity()
Definition: OptimizePeakDeconvolution.h:83
OptimizePeakDeconvolution & operator=(const OptimizePeakDeconvolution &opt)
Definition: OptimizePeakDeconvolution.h:149
RawDataVector::iterator PeakIterator
Definition: OptimizePeakDeconvolution.h:113
void setPenalties(const OptimizationFunctions::PenaltyFactorsIntensity &penalties)
Mutable access to the penalty parameter.
Definition: OptimizePeakDeconvolution.h:167
OptimizationFunctions::PenaltyFactorsIntensity penalties
Definition: OptimizePeakDeconvolution.h:124
double lWidth
Penalty factor for the peak shape&#39;s left width parameter.
Definition: OptimizePick.h:91
std::vector< Peak1D > RawDataVector
Definition: OptimizePeakDeconvolution.h:112
void setCharge(const Int charge)
Mutable access to the charge.
Definition: OptimizePeakDeconvolution.h:179
std::vector< PeakShape > peaks
Definition: OptimizePeakDeconvolution.h:121
double pos
Penalty factor for the peak shape&#39;s position.
Definition: OptimizePick.h:89
double rWidth
Penalty factor for the peak shape&#39;s right width parameter.
Definition: OptimizePick.h:93
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
Class containing the data needed for optimization.
Definition: OptimizePeakDeconvolution.h:119
Class for the penalty factors used during the optimization.
Definition: OptimizePick.h:71
virtual ~OptimizePeakDeconvolution()
Destructor.
Definition: OptimizePeakDeconvolution.h:143
virtual DefaultParamHandler & operator=(const DefaultParamHandler &rhs)
Assignment operator.
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:90
static const DoubleReal dist_
distance between two isotopic peaks
Definition: OptimizePeakDeconvolution.h:194
Int charge
Definition: OptimizePeakDeconvolution.h:125
OptimizePeakDeconvolution(const OptimizePeakDeconvolution &opt)
Copy-Constructor.
Definition: OptimizePeakDeconvolution.h:137
Int charge_
Charge state of the current isotope pattern.
Definition: OptimizePeakDeconvolution.h:191
PenaltyFactorsIntensity & operator=(const PenaltyFactorsIntensity &p)
Definition: OptimizePeakDeconvolution.h:73
std::vector< DoubleReal > signal
Definition: OptimizePeakDeconvolution.h:123
DoubleReal height
Definition: OptimizePeakDeconvolution.h:85
int Int
Signed integer type.
Definition: Types.h:100
OptimizationFunctions::PenaltyFactorsIntensity penalties_
Definition: OptimizePeakDeconvolution.h:188
Int getCharge() const
Non-mutable access to the charge.
Definition: OptimizePeakDeconvolution.h:177
std::vector< DoubleReal > positions
Definition: OptimizePeakDeconvolution.h:122
Class for the penalty factors used during the optimization.
Definition: OptimizePeakDeconvolution.h:66
PenaltyFactorsIntensity(const PenaltyFactorsIntensity &p)
Definition: OptimizePeakDeconvolution.h:71
PenaltyFactorsIntensity()
Definition: OptimizePeakDeconvolution.h:69

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:19 using doxygen 1.8.5