ProteoWizard
PeakDetectorMatchedFilter.hpp
Go to the documentation of this file.
1 //
2 // $Id: PeakDetectorMatchedFilter.hpp 1638 2009-12-18 23:26:34Z chambm $
3 //
4 //
5 // Original author: Darren Kessner <darren@proteowizard.org>
6 //
7 // Copyright 2006 Louis Warschaw Prostate Cancer Center
8 // Cedars Sinai Medical Center, Los Angeles, California 90048
9 //
10 // Licensed under the Apache License, Version 2.0 (the "License");
11 // you may not use this file except in compliance with the License.
12 // You may obtain a copy of the License at
13 //
14 // http://www.apache.org/licenses/LICENSE-2.0
15 //
16 // Unless required by applicable law or agreed to in writing, software
17 // distributed under the License is distributed on an "AS IS" BASIS,
18 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 // See the License for the specific language governing permissions and
20 // limitations under the License.
21 //
22 
23 
24 #ifndef _PEAKDETECTORMATCHEDFILTER_HPP_
25 #define _PEAKDETECTORMATCHEDFILTER_HPP_
26 
27 
29 #include "PeakDetector.hpp"
31 #include <memory>
32 #include <complex>
33 
34 
35 namespace pwiz {
36 namespace frequency {
37 
38 
39 /// MatchedFilter implementation of the PeakDetector interface.
40 
42 {
43  public:
44 
45  /// structure for holding configuration
47  {
48  /// IsotopeEnvelopeEstimator pointer, must be valid for PeakDetector lifetime
50 
51  /// number of filter correlations computed per frequency step
53 
54  /// number of filter samples taken on either side of 0
56 
57  /// noise floor multiple for initial peak reporting threshold
59 
60  /// maximum correlation angle (degrees) for initial peak reporting
62 
63  /// noise floor multiple for isotope filter threshold
65 
66  /// noise floor multiple for monoisotopic peak threshold
68 
69  /// isotope filter maximum charge state to score
71 
72  /// isotope filter maximum number of neutrons to score
74 
75  /// multiple peaks within this radius (Hz) are reported as single peak
76  double collapseRadius;
77 
78  /// use the magnitude of the peak shape filter kernel for finding peaks
80 
81  /// log detail level (0 == normal, 1 == extra)
83 
84  /// log stream (0 == no logging)
85  std::ostream* log;
86 
88  : isotopeEnvelopeEstimator(0),
89  filterMatchRate(0),
90  filterSampleRadius(0),
91  peakThresholdFactor(0),
92  peakMaxCorrelationAngle(0),
93  isotopeThresholdFactor(0),
94  monoisotopicPeakThresholdFactor(0),
95  isotopeMaxChargeState(0),
96  isotopeMaxNeutronCount(0),
97  collapseRadius(0),
98  useMagnitudeFilter(false),
99  logDetailLevel(0),
100  log(0)
101  {}
102  };
103 
104 
105  /// \name Instantiation
106  //@{
107 
108  /// create an instance.
109  static std::auto_ptr<PeakDetectorMatchedFilter> create(const Config& config);
110 
112  //@}
113 
114 
115  /// \name PeakDetector interface
116  //@{
117  virtual void findPeaks(const pwiz::data::FrequencyData& fd,
118  pwiz::data::peakdata::Scan& result) const = 0;
119  //@}
120 
121 
122  /// \name PeakDetectorMatchedFilter interface
123  //@{
124 
125  /// access to the configuration
126  virtual const Config& config() const = 0;
127 
128  /// structure for holding the matched filter calculation results
130  {
131  double frequency;
132  int charge;
134  double value;
135 
137  std::complex<double> monoisotopicIntensity;
139 
140  std::vector<pwiz::data::peakdata::Peak> peaks;
141 
142  Score(double _f = 0, int _c = 0, int _n = 0)
143  : frequency(_f), charge(_c), neutronCount(_n),
144  value(0), monoisotopicFrequency(0), monoisotopicIntensity(0),
145  peakCount(0)
146  {}
147  };
148 
149  /// same as PeakDetector::findPeaks(), but provides additional Score information
150  virtual void findPeaks(const pwiz::data::FrequencyData& fd,
152  std::vector<Score>& scores) const = 0;
153 
154  //@}
155 };
156 
157 
158 PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const PeakDetectorMatchedFilter::Score& a);
159 
160 
161 } // namespace frequency
162 } // namespace pwiz
163 
164 
165 #endif // _PEAKDETECTORMATCHEDFILTER_HPP_
166 
167