00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef OPENMS_TRANSFORMATIONS_RAW2PEAK_OPTIMIZEPEAKDECONVOLUTION_H
00029 #define OPENMS_TRANSFORMATIONS_RAW2PEAK_OPTIMIZEPEAKDECONVOLUTION_H
00030
00031 #include <OpenMS/TRANSFORMATIONS/RAW2PEAK/PeakShape.h>
00032 #include <OpenMS/DATASTRUCTURES/Param.h>
00033 #include <gsl/gsl_vector.h>
00034 #include <gsl/gsl_multifit_nlin.h>
00035 #include <gsl/gsl_blas.h>
00036 #include <OpenMS/TRANSFORMATIONS/RAW2PEAK/OptimizePick.h>
00037 #include <OpenMS/DATASTRUCTURES/DefaultParamHandler.h>
00038
00039
00040 #include <iostream>
00041 #ifdef DEBUG_DECONV
00042 #include <iostream>
00043 #include <fstream>
00044 #endif
00045 #include <vector>
00046
00047 namespace OpenMS
00048 {
00049
00050 namespace OptimizationFunctions
00051 {
00052 extern std::vector<PeakShape> peaks_DC_;
00053 extern std::vector<double> positions_DC_;
00054 extern std::vector<double> signal_DC_;
00055
00062 struct PenaltyFactorsIntensity : public PenaltyFactors
00063 {
00064 PenaltyFactorsIntensity():PenaltyFactors(),height(0){}
00065 PenaltyFactorsIntensity(const PenaltyFactorsIntensity& p) : PenaltyFactors(p), height(p.height) {}
00066 inline PenaltyFactorsIntensity& operator=(const PenaltyFactorsIntensity& p)
00067 {
00068 height=p.height;
00069 pos=p.pos;
00070 lWidth=p.lWidth;
00071 rWidth=p.rWidth;
00072
00073 return *this;
00074 }
00075 ~PenaltyFactorsIntensity(){}
00076
00077 double height;
00078
00079
00080 };
00081
00082
00083
00084 }
00085
00099 class OptimizePeakDeconvolution : public DefaultParamHandler
00100 {
00101 public:
00105 typedef std::vector<DRawDataPoint<1> > RawDataVector;
00106 typedef RawDataVector::iterator RawDataPointIterator;
00108
00109
00113
00114 OptimizePeakDeconvolution( );
00115
00117 OptimizePeakDeconvolution(const OptimizePeakDeconvolution& opt)
00118 :DefaultParamHandler(opt),
00119 penalties_(opt.penalties_),
00120 charge_(opt.charge_){}
00121
00123 virtual ~OptimizePeakDeconvolution(){}
00125
00129 inline OptimizePeakDeconvolution& operator=(const OptimizePeakDeconvolution& opt)
00130 {
00131 DefaultParamHandler::operator=(opt);
00132 penalties_=opt.penalties_;
00133 charge_=opt.charge_;
00134
00135 return *this;
00136 }
00138
00139
00143
00144 inline const OptimizationFunctions::PenaltyFactorsIntensity& getPenalties() const { return penalties_; }
00146 inline void setPenalties(const OptimizationFunctions::PenaltyFactorsIntensity& penalties)
00147 {
00148 penalties_ = penalties;
00149 param_.setValue("penalties:left_width",penalties_.lWidth);
00150 param_.setValue("penalties:right_width",penalties_.rWidth);
00151 param_.setValue("penalties:height",penalties_.height);
00152 param_.setValue("penalties:position",penalties_.pos);
00153 }
00154
00156 inline const int getCharge() const { return charge_; }
00158 inline void setCharge(const int charge) { charge_ = charge; }
00160
00161
00163 bool optimize(std::vector<PeakShape>& peaks,int failure);
00164
00165 protected:
00166
00167 OptimizationFunctions::PenaltyFactorsIntensity penalties_;
00168
00170 int charge_;
00171
00173 static const double dist_;
00174
00176 int getNumberOfPeaks_(int charge, std::vector<PeakShape>& temp_shapes);
00177
00178
00179 bool checkFWHM_(std::vector<PeakShape>& peaks,gsl_multifit_fdfsolver *& fit);
00180
00181 void updateMembers_();
00182 };
00183
00184 }
00185
00186
00187 #endif