1 #ifndef _SIMPLE_PEAK_DETECTOR_HH_
2 #define _SIMPLE_PEAK_DETECTOR_HH_
3 #include <math.h>
4 #include <vector>
5 #include <map>
6 #include "PeakDetectorParameters.hh"
7 #include "PeakDetector.hh"
8 
9 using namespace std;
10 
11 class SimplePeakDetector : public PeakDetector {
12   map<double, double> data;
13   double minCoverage, maxCoverage, binWidth;
14   double snRatio;
15   void initializeCounts();
16   void setCounts( MetaGraph* graph );
17   double getNoiseCutoff() const;
18   double searchFirstValley() const;
setCount(double binVal,double count)19   void setCount( double binVal, double count ){ data.insert( map<double, double>::value_type(binVal, count) ); }
getCount(double binVal) const20   double getCount( double binVal ) const { return data.find(binVal)->second; }
addCount(double binVal,double count)21   void addCount( double binVal, double count ){ data.find(binVal)->second += count; }
22 public:
SimplePeakDetector(const PeakDetectorParameters * param)23   SimplePeakDetector( const PeakDetectorParameters* param )
24     : minCoverage(param->getMinCoverage()), maxCoverage(param->getMaxCoverage()), binWidth(param->getBinWidth()),
25       snRatio(param->getSnRatio()){
26     initializeCounts();
27   }
28   int detectCoveragePeaks( MetaGraph* graph, double* coveragePeaks, double* coverageBoundaries );
29 };
30 
31 #endif // _META_HISTO_HH_
32