ProteoWizard
RegionAnalyzer.hpp
Go to the documentation of this file.
1 //
2 // $Id: RegionAnalyzer.hpp 4136 2012-11-21 21:17:24Z chambm $
3 //
4 //
5 // Original author: Darren Kessner <darren@proteowizard.org>
6 //
7 // Copyright 2008 Spielberg Family Center for Applied Proteomics
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 _REGIONANANALYZER_HPP_
25 #define _REGIONANANALYZER_HPP_
26 
27 
29 #include "MSDataAnalyzer.hpp"
30 #include "MSDataCache.hpp"
31 #include "TabularConfig.hpp"
32 #include <iostream>
33 
34 
35 namespace pwiz {
36 namespace analysis {
37 
38 
39 /// analyzes a rectangular region of m/z-time space
41 {
42  public:
43 
45  {
46  std::pair<double,double> mzRange;
47  std::pair<size_t,size_t> indexRange;
48  std::pair<int,int> scanNumberRange;
49  std::pair<double,double> rtRange;
50  bool dumpRegionData; // if true, dump info to a stream or file
51  std::ostream* osDump; // if non-null, dump to this stream, else open a file
52  std::string filenameSuffix;
53 
54  Config();
55  };
56 
57  RegionAnalyzer(const Config& config, const MSDataCache& cache);
58 
60  {
61  double sumIntensity;
62  MZIntensityPair max; // sample point with highest intensity
63  MZIntensityPair peak; // interpolated peak
64 
65  SpectrumStats();
66  };
67 
68  const std::vector<SpectrumStats>& spectrumStats() const;
69 
71  {
72  size_t nonzeroCount; // # spectra with sumIntensity > 0
75 
76  // intensity-weighted peak statistics
77  double mean_peak_mz;
79  double sd_peak_mz; // standard deviation
80 
81  // index of peak with highest intensity
82  size_t indexApex;
83 
84  Stats();
85  };
86 
87  const Stats& stats() const;
88 
89 
90  /// \name MSDataAnalyzer interface
91  //@{
92  virtual void open(const DataInfo& dataInfo);
93 
94  virtual UpdateRequest updateRequested(const DataInfo& dataInfo,
95  const SpectrumIdentity& spectrumIdentity) const;
96 
97  virtual void update(const DataInfo& dataInfo,
98  const Spectrum& spectrum);
99 
100  virtual void close(const DataInfo& dataInfo);
101  //@}
102 
103  private:
104  struct Impl;
105  boost::shared_ptr<Impl> impl_;
107  RegionAnalyzer& operator=(RegionAnalyzer&);
108 };
109 
110 
111 } // namespace analysis
112 } // namespace pwiz
113 
114 
115 #endif //_REGIONANANALYZER_HPP_
116