ProteoWizard
IO.hpp
Go to the documentation of this file.
1//
2// $Id$
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
36namespace pwiz {
37namespace 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
62namespace IO {
63
64
65PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const CV& cv);
66PWIZ_API_DECL void read(std::istream& is, CV& cv);
67
68
69PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const UserParam& userParam);
70PWIZ_API_DECL void read(std::istream& is, UserParam& userParam);
71
72
74PWIZ_API_DECL void read(std::istream& is, CVParam& cv);
75
76
77PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const ParamGroup& paramGroup);
78PWIZ_API_DECL void read(std::istream& is, ParamGroup& paramGroup);
79
80
82PWIZ_API_DECL void read(std::istream& is, FileContent& fc);
83
84
86PWIZ_API_DECL void read(std::istream& is, SourceFile& sf);
87
88
90PWIZ_API_DECL void read(std::istream& is, Contact& c);
91
92
94PWIZ_API_DECL void read(std::istream& is, FileDescription& fd);
95
96
98PWIZ_API_DECL void read(std::istream& is, Sample& sf);
99
100
101PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Component& component);
102PWIZ_API_DECL void read(std::istream& is, Component& component);
103
104
105PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const ComponentList& componentList);
106PWIZ_API_DECL void read(std::istream& is, ComponentList& componentList);
107
108
109PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Software& software);
110PWIZ_API_DECL void read(std::istream& is, Software& software);
111
112
113PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const InstrumentConfiguration& instrumentConfiguration);
114PWIZ_API_DECL void read(std::istream& is, InstrumentConfiguration& instrumentConfiguration);
115
116
117PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const ProcessingMethod& processingMethod);
118PWIZ_API_DECL void read(std::istream& is, ProcessingMethod& processingMethod);
119
120
121PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const DataProcessing& dataProcessing);
122PWIZ_API_DECL void read(std::istream& is, DataProcessing& dataProcessing);
123
124
126PWIZ_API_DECL void read(std::istream& is, Target& t);
127
128
129PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const ScanSettings& scanSettings);
130PWIZ_API_DECL void read(std::istream& is, ScanSettings& scanSettings);
131
132
133PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const IsolationWindow& isolationWindow);
134PWIZ_API_DECL void read(std::istream& is, IsolationWindow& isolationWindow);
135
136
137PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const SelectedIon& selectedIon);
138PWIZ_API_DECL void read(std::istream& is, SelectedIon& selectedIon);
139
140
141PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Activation& activation);
142PWIZ_API_DECL void read(std::istream& is, Activation& activation);
143
144
145PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Precursor& precursor);
146PWIZ_API_DECL void read(std::istream& is, Precursor& precursor, const std::map<std::string,std::string>* legacyIdRefToNativeId = 0);
147
148
149PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Product& product);
150PWIZ_API_DECL void read(std::istream& is, Product& product);
151
152
153PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const ScanWindow& selectionWindow);
154PWIZ_API_DECL void read(std::istream& is, ScanWindow& selectionWindow);
155
156
157PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const Scan& scan, const MSData& msd);
158PWIZ_API_DECL void read(std::istream& is, Scan& scan);
159
160
161PWIZ_API_DECL void write(minimxml::XMLWriter& writer, const ScanList& scanList, const MSData& msd);
162PWIZ_API_DECL void read(std::istream& is, ScanList& scanList);
163
164
166void write(minimxml::XMLWriter& writer, const BinaryDataArray& binaryDataArray,
168PWIZ_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//
173enum PWIZ_API_DECL BinaryDataFlag {IgnoreBinaryData, ReadBinaryData, ReadBinaryDataOnly };
174
175
177void write(minimxml::XMLWriter& writer, const Spectrum& spectrum, const MSData& msd,
180void 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
189void write(minimxml::XMLWriter& writer, const Chromatogram& chromatogram,
192void read(std::istream& is, Chromatogram& chromatogram,
193 BinaryDataFlag binaryDataFlag = IgnoreBinaryData);
194
195
197void write(minimxml::XMLWriter& writer, const SpectrumList& spectrumList, const MSData& msd,
199 std::vector<boost::iostreams::stream_offset>* spectrumPositions = 0,
200 const pwiz::util::IterationListenerRegistry* iterationListenerRegistry = 0);
201PWIZ_API_DECL void read(std::istream& is, SpectrumListSimple& spectrumListSimple);
202
203
205void write(minimxml::XMLWriter& writer, const ChromatogramList& chromatogramList,
207 std::vector<boost::iostreams::stream_offset>* chromatogramPositions = 0,
208 const pwiz::util::IterationListenerRegistry* iterationListenerRegistry = 0);
209PWIZ_API_DECL void read(std::istream& is, ChromatogramListSimple& chromatogramListSimple);
210
211
212enum PWIZ_API_DECL SpectrumListFlag {IgnoreSpectrumList, ReadSpectrumList};
213
214
216void write(minimxml::XMLWriter& writer, const Run& run, const MSData& msd,
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);
222void read(std::istream& is, Run& run,
223 SpectrumListFlag spectrumListFlag = IgnoreSpectrumList);
224
225
227void write(minimxml::XMLWriter& writer, const MSData& msd,
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);
233void 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
#define PWIZ_API_DECL
Definition Export.hpp:32
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition XMLWriter.hpp:48
Interface for accessing chromatograms, which may be stored in memory or backed by a data file (RAW,...
Definition MSData.hpp:757
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW,...
Definition MSData.hpp:661
handles registration of IterationListeners and broadcast of update messages
IgnoreSpectrumList
Definition IO.hpp:212
IgnoreBinaryData
Definition IO.hpp:173
ReadBinaryData
Definition IO.hpp:173
PWIZ_API_DECL void read(std::istream &is, CV &cv)
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
Information about an ontology or CV source and a short 'lookup' tag to refer to.
Definition cv.hpp:14916
represents a tag-value pair, where the tag comes from the controlled vocabulary
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Uncontrolled user parameters (essentially allowing free text). Before using these,...
The type and energy level used for activation.
Definition MSData.hpp:307
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition MSData.hpp:405
encoding/decoding configuration
A single chromatogram.
Definition MSData.hpp:578
Simple writeable in-memory implementation of ChromatogramList.
Definition MSData.hpp:791
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i....
Definition MSData.hpp:132
List with the different components used in the mass spectrometer. At least one source,...
Definition MSData.hpp:157
Structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam),...
Definition MSData.hpp:80
Description of the way in which a particular software was used.
Definition MSData.hpp:274
This summarizes the different types of spectra that can be expected in the file. This is expected to ...
Definition MSData.hpp:50
Information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
Definition MSData.hpp:85
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
Definition MSData.hpp:230
This element captures the isolation (or 'selection') window configured to isolate one or more precurs...
Definition MSData.hpp:292
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition MSData.hpp:850
The method of precursor ion selection and activation.
Definition MSData.hpp:312
Description of the default peak processing method. This element describes the base method used in the...
Definition MSData.hpp:255
product ion information
Definition MSData.hpp:348
A run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
Definition MSData.hpp:810
Expansible description of the sample used to generate the dataset, named in sampleName.
Definition MSData.hpp:102
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile.
Definition MSData.hpp:370
List and descriptions of scans.
Definition MSData.hpp:396
Description of the acquisition settings of the instrument prior to the start of the run.
Definition MSData.hpp:207
A piece of software.
Definition MSData.hpp:180
Description of the source file, including location and type.
Definition MSData.hpp:55
The structure that captures the generation of a peak list (including the underlying acquisitions)
Definition MSData.hpp:506
Identifying information for a spectrum as read from mzML or mzXML subclassed to add private informati...
Definition IO.hpp:54
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
Identifying information for a spectrum subclassed to add private information for faster file IO in mz...
Definition IO.hpp:44
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
Identifying information for a spectrum.
Definition MSData.hpp:471
Simple writeable in-memory implementation of SpectrumList.
Definition MSData.hpp:717