ProteoWizard
IO.hpp
Go to the documentation of this file.
1 //
2 // $Id: IO.hpp 3013 2011-09-27 06:57:13Z pcbrefugee $
3 //
4 //
5 // Original author: Darren Kessner <darren@proteowizard.org>
6 //
7 // Copyright 2007 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 _IO_HPP_
25 #define _IO_HPP_
26 
27 
29 #include "MSData.hpp"
30 #include "BinaryDataEncoder.hpp"
33 #include "boost/iostreams/positioning.hpp"
34 
35 
36 namespace pwiz {
37 namespace msdata {
38 
39 
40 
41 /// Identifying information for a spectrum
42 /// subclassed to add private information for faster file IO in mzML and mzXML
44 {
45  /// for efficient read of peak lists after previous read of
46  /// scan header in mzML and mzXML - avoids reparsing the header
47  mutable boost::iostreams::stream_offset sourceFilePositionForBinarySpectrumData;
48  SpectrumIdentityFromXML() : SpectrumIdentity(), sourceFilePositionForBinarySpectrumData((boost::iostreams::stream_offset)-1) {}
49 };
50 
51 /// Identifying information for a spectrum as read from mzML or mzXML
52 /// subclassed to add private information for faster file IO in mzXML
54 {
55  /// for efficient read of peak lists after previous read of
56  /// scan header in mzXML - avoids reparsing the header
57  mutable unsigned int peaksCount;
59 };
60 
61 
62 namespace IO {
63 
64 
65 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const CV& cv);
66 PWIZ_API_DECL void read(std::istream& is, CV& cv);
67 
68 
69 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const UserParam& userParam);
70 PWIZ_API_DECL void read(std::istream& is, UserParam& userParam);
71 
72 
73 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const CVParam& cv);
74 PWIZ_API_DECL void read(std::istream& is, CVParam& cv);
75 
76 
77 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const ParamGroup& paramGroup);
78 PWIZ_API_DECL void read(std::istream& is, ParamGroup& paramGroup);
79 
80 
81 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const FileContent& fc);
82 PWIZ_API_DECL void read(std::istream& is, FileContent& fc);
83 
84 
85 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const SourceFile& sf);
86 PWIZ_API_DECL void read(std::istream& is, SourceFile& sf);
87 
88 
89 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Contact& c);
90 PWIZ_API_DECL void read(std::istream& is, Contact& c);
91 
92 
93 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const FileDescription& fd);
94 PWIZ_API_DECL void read(std::istream& is, FileDescription& fd);
95 
96 
97 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Sample& sf);
98 PWIZ_API_DECL void read(std::istream& is, Sample& sf);
99 
100 
101 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Component& component);
102 PWIZ_API_DECL void read(std::istream& is, Component& component);
103 
104 
105 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const ComponentList& componentList);
106 PWIZ_API_DECL void read(std::istream& is, ComponentList& componentList);
107 
108 
109 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Software& software);
110 PWIZ_API_DECL void read(std::istream& is, Software& software);
111 
112 
113 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const InstrumentConfiguration& instrumentConfiguration);
114 PWIZ_API_DECL void read(std::istream& is, InstrumentConfiguration& instrumentConfiguration);
115 
116 
117 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const ProcessingMethod& processingMethod);
118 PWIZ_API_DECL void read(std::istream& is, ProcessingMethod& processingMethod);
119 
120 
121 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const DataProcessing& dataProcessing);
122 PWIZ_API_DECL void read(std::istream& is, DataProcessing& dataProcessing);
123 
124 
125 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Target& t);
126 PWIZ_API_DECL void read(std::istream& is, Target& t);
127 
128 
129 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const ScanSettings& scanSettings);
130 PWIZ_API_DECL void read(std::istream& is, ScanSettings& scanSettings);
131 
132 
133 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const IsolationWindow& isolationWindow);
134 PWIZ_API_DECL void read(std::istream& is, IsolationWindow& isolationWindow);
135 
136 
137 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const SelectedIon& selectedIon);
138 PWIZ_API_DECL void read(std::istream& is, SelectedIon& selectedIon);
139 
140 
141 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Activation& activation);
142 PWIZ_API_DECL void read(std::istream& is, Activation& activation);
143 
144 
145 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Precursor& precursor);
146 PWIZ_API_DECL void read(std::istream& is, Precursor& precursor, const std::map<std::string,std::string>* legacyIdRefToNativeId = 0);
147 
148 
149 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Product& product);
150 PWIZ_API_DECL void read(std::istream& is, Product& product);
151 
152 
153 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const ScanWindow& selectionWindow);
154 PWIZ_API_DECL void read(std::istream& is, ScanWindow& selectionWindow);
155 
156 
157 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Scan& scan, const MSData& msd);
158 PWIZ_API_DECL void read(std::istream& is, Scan& scan);
159 
160 
161 PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const ScanList& scanList, const MSData& msd);
162 PWIZ_API_DECL void read(std::istream& is, ScanList& scanList);
163 
164 
166 void write(minimxml::XMLWriter& writer, const BinaryDataArray& binaryDataArray,
168 PWIZ_API_DECL void read(std::istream& is, BinaryDataArray& binaryDataArray, const MSData* msd = 0);
169 
170 //
171 // enum for preference in binary data read - ignore, read, read only binary if possible
172 //
173 enum PWIZ_API_DECL BinaryDataFlag {IgnoreBinaryData, ReadBinaryData, ReadBinaryDataOnly };
174 
175 
177 void write(minimxml::XMLWriter& writer, const Spectrum& spectrum, const MSData& msd,
178  const BinaryDataEncoder::Config& config = BinaryDataEncoder::Config());
180 void read(std::istream& is, Spectrum& spectrum,
181  BinaryDataFlag binaryDataFlag = IgnoreBinaryData,
182  int version = 0,
183  const std::map<std::string,std::string>* legacyIdRefToNativeId = 0,
184  const MSData* msd = 0,
185  const SpectrumIdentityFromXML *id = 0);
186 
187 
189 void write(minimxml::XMLWriter& writer, const Chromatogram& chromatogram,
190  const BinaryDataEncoder::Config& config = BinaryDataEncoder::Config());
192 void read(std::istream& is, Chromatogram& chromatogram,
193  BinaryDataFlag binaryDataFlag = IgnoreBinaryData);
194 
195 
197 void write(minimxml::XMLWriter& writer, const SpectrumList& spectrumList, const MSData& msd,
198  const BinaryDataEncoder::Config& config = BinaryDataEncoder::Config(),
199  std::vector<boost::iostreams::stream_offset>* spectrumPositions = 0,
200  const pwiz::util::IterationListenerRegistry* iterationListenerRegistry = 0);
201 PWIZ_API_DECL void read(std::istream& is, SpectrumListSimple& spectrumListSimple);
202 
203 
205 void write(minimxml::XMLWriter& writer, const ChromatogramList& chromatogramList,
206  const BinaryDataEncoder::Config& config = BinaryDataEncoder::Config(),
207  std::vector<boost::iostreams::stream_offset>* chromatogramPositions = 0,
208  const pwiz::util::IterationListenerRegistry* iterationListenerRegistry = 0);
209 PWIZ_API_DECL void read(std::istream& is, ChromatogramListSimple& chromatogramListSimple);
210 
211 
212 enum PWIZ_API_DECL SpectrumListFlag {IgnoreSpectrumList, ReadSpectrumList};
213 
214 
216 void write(minimxml::XMLWriter& writer, const Run& run, const MSData& msd,
217  const BinaryDataEncoder::Config& config = BinaryDataEncoder::Config(),
218  std::vector<boost::iostreams::stream_offset>* spectrumPositions = 0,
219  std::vector<boost::iostreams::stream_offset>* chromatogramPositions = 0,
220  const pwiz::util::IterationListenerRegistry* iterationListenerRegistry = 0);
222 void read(std::istream& is, Run& run,
223  SpectrumListFlag spectrumListFlag = IgnoreSpectrumList);
224 
225 
227 void write(minimxml::XMLWriter& writer, const MSData& msd,
228  const BinaryDataEncoder::Config& config = BinaryDataEncoder::Config(),
229  std::vector<boost::iostreams::stream_offset>* spectrumPositions = 0,
230  std::vector<boost::iostreams::stream_offset>* chromatogramPositions = 0,
231  const pwiz::util::IterationListenerRegistry* iterationListenerRegistry = 0);
233 void read(std::istream& is, MSData& msd,
234  SpectrumListFlag spectrumListFlag = IgnoreSpectrumList);
235 
236 
237 } // namespace IO
238 
239 
240 } // namespace msdata
241 } // namespace pwiz
242 
243 
244 #endif // _IO_HPP_
245 
246 
Structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam), or a reference to a predefined set of these in this mzML file (paramGroupRef).
Definition: MSData.hpp:79
This summarizes the different types of spectra that can be expected in the file. This is expected to ...
Definition: MSData.hpp:49
IgnoreBinaryData
Definition: IO.hpp:173
product ion information
Definition: MSData.hpp:346
The type and energy level used for activation.
Definition: MSData.hpp:306
PWIZ_API_DECL const CV & cv(const std::string &prefix)
returns a CV object for the specified namespace (prefix); currently supported namespaces are: MS UO ...
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:47
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
Description of the source file, including location and type.
Definition: MSData.hpp:53
IgnoreSpectrumList
Definition: IO.hpp:212
ReadBinaryData
Definition: IO.hpp:173
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile...
Definition: MSData.hpp:368
The method of precursor ion selection and activation.
Definition: MSData.hpp:310
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i...
Definition: MSData.hpp:130
Information about an ontology or CV source and a short &#39;lookup&#39; tag to refer to.
Definition: cv.hpp:13353
boost::iostreams::stream_offset sourceFilePositionForBinarySpectrumData
for efficient read of peak lists after previous read of scan header in mzML and mzXML - avoids repars...
Definition: IO.hpp:47
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
PWIZ_API_DECL void read(std::istream &is, TraData &td)
Description of the default peak processing method. This element describes the base method used in the...
Definition: MSData.hpp:253
Information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
Definition: MSData.hpp:83
#define PWIZ_API_DECL
Definition: Export.hpp:32
A piece of software.
Definition: MSData.hpp:178
unsigned int peaksCount
for efficient read of peak lists after previous read of scan header in mzXML - avoids reparsing the h...
Definition: IO.hpp:57
List with the different components used in the mass spectrometer. At least one source, one mass analyzer and one detector need to be specified.
Definition: MSData.hpp:155
This element captures the isolation (or &#39;selection&#39;) window configured to isolate one or more precurs...
Definition: MSData.hpp:291
Identifying information for a spectrum as read from mzML or mzXML subclassed to add private informati...
Definition: IO.hpp:53
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:324
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
Definition: MSData.hpp:228
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:403
Identifying information for a spectrum.
Definition: MSData.hpp:469
encoding/decoding configuration
handles registration of IterationListeners and broadcast of update messages
Description of the acquisition settings of the instrument prior to the start of the run...
Definition: MSData.hpp:205
List and descriptions of scans.
Definition: MSData.hpp:394
Expansible description of the sample used to generate the dataset, named in sampleName.
Definition: MSData.hpp:100
Identifying information for a spectrum subclassed to add private information for faster file IO in mz...
Definition: IO.hpp:43
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const Configuration &x)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44