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-2017.
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: $
33 // --------------------------------------------------------------------------
34 //
35 
36 #ifndef OPENMS_TRANSFORMATIONS_RAW2PEAK_OPTIMIZEPEAKDECONVOLUTION_H
37 #define OPENMS_TRANSFORMATIONS_RAW2PEAK_OPTIMIZEPEAKDECONVOLUTION_H
38 
42 
43 //#define DEBUG_DECONV
44 #include <vector>
45 
46 namespace OpenMS
47 {
48 
49  namespace OptimizationFunctions
50  {
51 
58  struct OPENMS_DLLAPI PenaltyFactorsIntensity :
59  public PenaltyFactors
60  {
62  PenaltyFactors(), height(0){}
64  PenaltyFactors(p), height(p.height) {}
66  {
67  height = p.height;
68  pos = p.pos;
69  lWidth = p.lWidth;
70  rWidth = p.rWidth;
71 
72  return *this;
73  }
74 
76 
77  double height;
78 
79 
80  };
81 
82 
83 
84  } //namespace OptimizationFunctions
85 
97  class OPENMS_DLLAPI OptimizePeakDeconvolution :
98  public DefaultParamHandler
99  {
100 public:
104  typedef std::vector<Peak1D> RawDataVector;
105  typedef RawDataVector::iterator PeakIterator;
107 
111  struct Data
112  {
113  std::vector<PeakShape> peaks;
114  std::vector<double> positions;
115  std::vector<double> signal;
118  };
119 
120 
121 
127 
130  DefaultParamHandler(opt),
131  penalties_(opt.penalties_),
132  charge_(opt.charge_){}
133 
137 
142  {
144  penalties_ = opt.penalties_;
145  charge_ = opt.charge_;
146 
147  return *this;
148  }
149 
151 
152 
156  inline const OptimizationFunctions::PenaltyFactorsIntensity & getPenalties() const { return penalties_; }
160  {
161  penalties_ = penalties;
162  param_.setValue("penalties:left_width", penalties_.lWidth);
163  param_.setValue("penalties:right_width", penalties_.rWidth);
164  param_.setValue("penalties:height", penalties_.height);
165  param_.setValue("penalties:position", penalties_.pos);
166  }
167 
169  inline Int getCharge() const { return charge_; }
171  inline void setCharge(const Int charge) { charge_ = charge; }
173 
174 
176  bool optimize(std::vector<PeakShape> & peaks, Data & data);
177  Size getNumberOfPeaks_(Int charge, std::vector<PeakShape> & temp_shapes, Data & data);
178 
179 protected:
180  // Penalty factors for some parameter in the optimization
182 
185 
187  static const double dist_;
188 
190  void setNumberOfPeaks_(Data & data, const std::vector<PeakShape> & temp_shapes, Int charge);
191 
192  void updateMembers_();
193  }; // class
194 
195 } // namespace OpenMS
196 
197 
198 #endif
This class provides the deconvolution of peak regions using non-linear optimization.
Definition: OptimizePeakDeconvolution.h:97
~PenaltyFactorsIntensity()
Definition: OptimizePeakDeconvolution.h:75
OptimizePeakDeconvolution & operator=(const OptimizePeakDeconvolution &opt)
Definition: OptimizePeakDeconvolution.h:141
Int getCharge() const
Non-mutable access to the charge.
Definition: OptimizePeakDeconvolution.h:169
RawDataVector::iterator PeakIterator
Definition: OptimizePeakDeconvolution.h:105
void setPenalties(const OptimizationFunctions::PenaltyFactorsIntensity &penalties)
Mutable access to the penalty parameter.
Definition: OptimizePeakDeconvolution.h:159
OptimizationFunctions::PenaltyFactorsIntensity penalties
Definition: OptimizePeakDeconvolution.h:116
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
double lWidth
Penalty factor for the peak shape&#39;s left width parameter.
Definition: OptimizePick.h:83
std::vector< Peak1D > RawDataVector
Definition: OptimizePeakDeconvolution.h:104
void setCharge(const Int charge)
Mutable access to the charge.
Definition: OptimizePeakDeconvolution.h:171
std::vector< double > signal
Definition: OptimizePeakDeconvolution.h:115
std::vector< PeakShape > peaks
Definition: OptimizePeakDeconvolution.h:113
double pos
Penalty factor for the peak shape&#39;s position.
Definition: OptimizePick.h:81
double rWidth
Penalty factor for the peak shape&#39;s right width parameter.
Definition: OptimizePick.h:85
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
Class containing the data needed for optimization.
Definition: OptimizePeakDeconvolution.h:111
Class for the penalty factors used during the optimization.
Definition: OptimizePick.h:63
virtual ~OptimizePeakDeconvolution()
Destructor.
Definition: OptimizePeakDeconvolution.h:135
virtual DefaultParamHandler & operator=(const DefaultParamHandler &rhs)
Assignment operator.
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
Int charge
Definition: OptimizePeakDeconvolution.h:117
OptimizePeakDeconvolution(const OptimizePeakDeconvolution &opt)
Copy-Constructor.
Definition: OptimizePeakDeconvolution.h:129
Int charge_
Charge state of the current isotope pattern.
Definition: OptimizePeakDeconvolution.h:184
PenaltyFactorsIntensity & operator=(const PenaltyFactorsIntensity &p)
Definition: OptimizePeakDeconvolution.h:65
int Int
Signed integer type.
Definition: Types.h:103
double height
Definition: OptimizePeakDeconvolution.h:77
std::vector< double > positions
Definition: OptimizePeakDeconvolution.h:114
static const double dist_
distance between two isotopic peaks
Definition: OptimizePeakDeconvolution.h:187
OptimizationFunctions::PenaltyFactorsIntensity penalties_
Definition: OptimizePeakDeconvolution.h:181
Class for the penalty factors used during the optimization.
Definition: OptimizePeakDeconvolution.h:58
PenaltyFactorsIntensity(const PenaltyFactorsIntensity &p)
Definition: OptimizePeakDeconvolution.h:63
PenaltyFactorsIntensity()
Definition: OptimizePeakDeconvolution.h:61

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:02 using doxygen 1.8.13