ProteoWizard
RegionAnalyzer.hpp
Go to the documentation of this file.
1 //
2 // $Id$
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 
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_;
108 };
109 
110 
111 } // namespace analysis
112 } // namespace pwiz
113 
114 
115 #endif //_REGIONANANALYZER_HPP_
116 
MSDataAnalyzer.hpp
pwiz::analysis::RegionAnalyzer::SpectrumStats::sumIntensity
double sumIntensity
Definition: RegionAnalyzer.hpp:61
pwiz::analysis::RegionAnalyzer::SpectrumStats::peak
MZIntensityPair peak
Definition: RegionAnalyzer.hpp:63
pwiz::analysis::RegionAnalyzer::Stats::sum_sumIntensity
double sum_sumIntensity
Definition: RegionAnalyzer.hpp:73
pwiz::analysis::RegionAnalyzer::Config::indexRange
std::pair< size_t, size_t > indexRange
Definition: RegionAnalyzer.hpp:47
pwiz::msdata::SpectrumIdentity
Identifying information for a spectrum.
Definition: MSData.hpp:471
pwiz::analysis::RegionAnalyzer::RegionAnalyzer
RegionAnalyzer(RegionAnalyzer &)
MSDataCache.hpp
pwiz::msdata::Spectrum
The structure that captures the generation of a peak list (including the underlying acquisitions)
Definition: MSData.hpp:506
pwiz::analysis::RegionAnalyzer::SpectrumStats
Definition: RegionAnalyzer.hpp:60
pwiz
Definition: ChromatogramList_Filter.hpp:36
pwiz::analysis::TabularConfig
Definition: TabularConfig.hpp:39
pwiz::analysis::RegionAnalyzer::Config::Config
Config()
pwiz::analysis::RegionAnalyzer::close
virtual void close(const DataInfo &dataInfo)
end analysis of the data
pwiz::analysis::RegionAnalyzer::update
virtual void update(const DataInfo &dataInfo, const Spectrum &spectrum)
analyze a single spectrum
PWIZ_API_DECL
#define PWIZ_API_DECL
Definition: Export.hpp:32
pwiz::analysis::RegionAnalyzer::impl_
boost::shared_ptr< Impl > impl_
Definition: RegionAnalyzer.hpp:104
TabularConfig.hpp
pwiz::analysis::RegionAnalyzer::Stats::sd_peak_mz
double sd_peak_mz
Definition: RegionAnalyzer.hpp:79
pwiz::analysis::RegionAnalyzer
analyzes a rectangular region of m/z-time space
Definition: RegionAnalyzer.hpp:41
pwiz::analysis::RegionAnalyzer::Stats::variance_peak_mz
double variance_peak_mz
Definition: RegionAnalyzer.hpp:78
Export.hpp
pwiz::analysis::RegionAnalyzer::Config
Definition: RegionAnalyzer.hpp:45
pwiz::analysis::RegionAnalyzer::Config::mzRange
std::pair< double, double > mzRange
Definition: RegionAnalyzer.hpp:46
pwiz::analysis::RegionAnalyzer::RegionAnalyzer
RegionAnalyzer(const Config &config, const MSDataCache &cache)
pwiz::analysis::RegionAnalyzer::Config::osDump
std::ostream * osDump
Definition: RegionAnalyzer.hpp:51
pwiz::analysis::RegionAnalyzer::Stats::indexApex
size_t indexApex
Definition: RegionAnalyzer.hpp:82
pwiz::analysis::RegionAnalyzer::SpectrumStats::SpectrumStats
SpectrumStats()
pwiz::analysis::RegionAnalyzer::Stats::mean_peak_mz
double mean_peak_mz
Definition: RegionAnalyzer.hpp:77
pwiz::analysis::RegionAnalyzer::Stats
Definition: RegionAnalyzer.hpp:71
pwiz::analysis::RegionAnalyzer::open
virtual void open(const DataInfo &dataInfo)
start analysis of the data
pwiz::analysis::RegionAnalyzer::Config::filenameSuffix
std::string filenameSuffix
Definition: RegionAnalyzer.hpp:52
pwiz::analysis::RegionAnalyzer::stats
const Stats & stats() const
pwiz::analysis::RegionAnalyzer::operator=
RegionAnalyzer & operator=(RegionAnalyzer &)
pwiz::analysis::RegionAnalyzer::Stats::nonzeroCount
size_t nonzeroCount
Definition: RegionAnalyzer.hpp:72
pwiz::analysis::MSDataCache
simple memory cache for common MSData info
Definition: MSDataCache.hpp:77
pwiz::analysis::RegionAnalyzer::spectrumStats
const std::vector< SpectrumStats > & spectrumStats() const
pwiz::analysis::RegionAnalyzer::Config::rtRange
std::pair< double, double > rtRange
Definition: RegionAnalyzer.hpp:49
pwiz::analysis::RegionAnalyzer::Config::scanNumberRange
std::pair< int, int > scanNumberRange
Definition: RegionAnalyzer.hpp:48
pwiz::analysis::MSDataAnalyzer
Interface for MSData analyzers.
Definition: MSDataAnalyzer.hpp:61
pwiz::analysis::RegionAnalyzer::Stats::Stats
Stats()
pwiz::msdata::MZIntensityPair
The data point type of a mass spectrum.
Definition: MSData.hpp:423
pwiz::analysis::RegionAnalyzer::Stats::sum_peak_intensity
double sum_peak_intensity
Definition: RegionAnalyzer.hpp:74
pwiz::analysis::RegionAnalyzer::updateRequested
virtual UpdateRequest updateRequested(const DataInfo &dataInfo, const SpectrumIdentity &spectrumIdentity) const
ask analyzer if it wants an update
pwiz::analysis::MSDataAnalyzer::DataInfo
information about the data to be analyzed
Definition: MSDataAnalyzer.hpp:66
pwiz::analysis::RegionAnalyzer::Config::dumpRegionData
bool dumpRegionData
Definition: RegionAnalyzer.hpp:50
pwiz::analysis::RegionAnalyzer::SpectrumStats::max
MZIntensityPair max
Definition: RegionAnalyzer.hpp:62