ProteoWizard
SpectrumBinaryData.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 _SPECTRUMBINARYDATA_HPP_
25 #define _SPECTRUMBINARYDATA_HPP_
26 
27 
29 #include "MSDataAnalyzer.hpp"
30 #include "MSDataCache.hpp"
31 
32 
33 namespace pwiz {
34 namespace analysis {
35 
36 
37 /// writes table of spectrum metadata to a file
39 {
40  public:
41 
43  {
44  size_t begin;
45  size_t end;
47  size_t precision;
48 
49  Config(const std::string& args = "");
50 
51  bool operator == (const Config &rhs) const
52  {
53  return begin==rhs.begin &&
54  end == rhs.end &&
55  interpretAsScanNumbers == rhs.interpretAsScanNumbers &&
56  precision == rhs.precision;
57  }
58  };
59 
60  SpectrumBinaryData(const MSDataCache& cache, const Config& config);
61 
62  /// \name MSDataAnalyzer interface
63  //@{
64  virtual UpdateRequest updateRequested(const DataInfo& dataInfo,
65  const SpectrumIdentity& spectrumIdentity) const;
66 
67  virtual void update(const DataInfo& dataInfo,
68  const Spectrum& spectrum);
69  //@}
70 
71  private:
73  const Config config_;
74 };
75 
76 
77 template<>
79 {
80  static const char* id() {return "binary";}
81 #define BINARY_INDEX_ARG "index"
82 #define BINARY_SCAN_ARG "sn"
83 #define BINARY_PRECISION_ARG "precision"
84  static const char* argsFormat() {return BINARY_INDEX_ARG "=<spectrumIndexLow>[,<spectrumIndexHigh>] | " BINARY_SCAN_ARG "=<scanNumberLow>[,<scanNumberHigh>] [" BINARY_PRECISION_ARG "=<precision>]";}
85 
86  static const char* description() {return "write binary data for selected spectra";}
87 
88  static std::vector<std::string> argsUsage()
89  {
90  std::vector<std::string> result;
91  result.push_back(BINARY_INDEX_ARG": write data for spectra in this index range");
92  result.push_back(BINARY_SCAN_ARG": write data for spectra in this scan number range");
93  result.push_back(BINARY_PRECISION_ARG": write d decimal places");
94  return result;
95  }
96 };
97 
98 
99 } // namespace analysis
100 } // namespace pwiz
101 
102 
103 #endif // _SPECTRUMBINARYDATA_HPP_
104 
MSDataAnalyzer.hpp
pwiz::analysis::analyzer_strings
This auxilliary class should be specialized for MSDataAnalyzers whose instantiation is controlled by ...
Definition: MSDataAnalyzer.hpp:116
BINARY_SCAN_ARG
#define BINARY_SCAN_ARG
Definition: SpectrumBinaryData.hpp:82
pwiz::msdata::SpectrumIdentity
Identifying information for a spectrum.
Definition: MSData.hpp:471
pwiz::analysis::analyzer_strings< SpectrumBinaryData >::id
static const char * id()
Definition: SpectrumBinaryData.hpp:80
MSDataCache.hpp
pwiz::msdata::Spectrum
The structure that captures the generation of a peak list (including the underlying acquisitions)
Definition: MSData.hpp:506
pwiz
Definition: ChromatogramList_Filter.hpp:36
pwiz::analysis::analyzer_strings< SpectrumBinaryData >::argsUsage
static std::vector< std::string > argsUsage()
Definition: SpectrumBinaryData.hpp:88
pwiz::analysis::analyzer_strings::argsFormat
static const char * argsFormat()
format of args string
Definition: MSDataAnalyzer.hpp:124
pwiz::frequency::operator==
PWIZ_API_DECL bool operator==(const TruncatedLorentzianParameters &t, const TruncatedLorentzianParameters &u)
pwiz::analysis::SpectrumBinaryData::config_
const Config config_
Definition: SpectrumBinaryData.hpp:73
BINARY_PRECISION_ARG
#define BINARY_PRECISION_ARG
Definition: SpectrumBinaryData.hpp:83
PWIZ_API_DECL
#define PWIZ_API_DECL
Definition: Export.hpp:32
Export.hpp
pwiz::analysis::SpectrumBinaryData::Config::Config
Config(const std::string &args="")
pwiz::analysis::SpectrumBinaryData
writes table of spectrum metadata to a file
Definition: SpectrumBinaryData.hpp:39
pwiz::analysis::SpectrumBinaryData::Config::precision
size_t precision
Definition: SpectrumBinaryData.hpp:47
pwiz::analysis::SpectrumBinaryData::cache_
const MSDataCache & cache_
Definition: SpectrumBinaryData.hpp:72
pwiz::analysis::SpectrumBinaryData::Config::end
size_t end
Definition: SpectrumBinaryData.hpp:45
pwiz::analysis::analyzer_strings< SpectrumBinaryData >::description
static const char * description()
Definition: SpectrumBinaryData.hpp:86
pwiz::analysis::SpectrumBinaryData::SpectrumBinaryData
SpectrumBinaryData(const MSDataCache &cache, const Config &config)
pwiz::analysis::SpectrumBinaryData::Config::begin
size_t begin
Definition: SpectrumBinaryData.hpp:44
pwiz::analysis::MSDataCache
simple memory cache for common MSData info
Definition: MSDataCache.hpp:77
BINARY_INDEX_ARG
#define BINARY_INDEX_ARG
Definition: SpectrumBinaryData.hpp:81
pwiz::analysis::SpectrumBinaryData::Config::interpretAsScanNumbers
bool interpretAsScanNumbers
Definition: SpectrumBinaryData.hpp:46
pwiz::analysis::MSDataAnalyzer
Interface for MSData analyzers.
Definition: MSDataAnalyzer.hpp:61
pwiz::analysis::MSDataAnalyzer::DataInfo
information about the data to be analyzed
Definition: MSDataAnalyzer.hpp:66
pwiz::analysis::SpectrumBinaryData::updateRequested
virtual UpdateRequest updateRequested(const DataInfo &dataInfo, const SpectrumIdentity &spectrumIdentity) const
ask analyzer if it wants an update
pwiz::analysis::SpectrumBinaryData::update
virtual void update(const DataInfo &dataInfo, const Spectrum &spectrum)
analyze a single spectrum
pwiz::analysis::SpectrumBinaryData::Config
Definition: SpectrumBinaryData.hpp:43