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 
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 
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 
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 
82 PWIZ_API_DECL void read(std::istream& is, FileContent& fc);
83 
84 
86 PWIZ_API_DECL void read(std::istream& is, SourceFile& sf);
87 
88 
90 PWIZ_API_DECL void read(std::istream& is, Contact& c);
91 
92 
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 
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,
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,
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,
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,
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,
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,
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 
pwiz::data::UserParam
Uncontrolled user parameters (essentially allowing free text). Before using these,...
Definition: ParamTypes.hpp:186
pwiz::msdata::IsolationWindow
This element captures the isolation (or 'selection') window configured to isolate one or more precurs...
Definition: MSData.hpp:292
pwiz::minimxml::XMLWriter
The XMLWriter class provides simple, tag-level XML syntax writing.
Definition: XMLWriter.hpp:48
IgnoreBinaryData
IgnoreBinaryData
Definition: IO.hpp:173
pwiz::msdata::ChromatogramListSimple
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:791
IterationListener.hpp
pwiz::msdata::SpectrumIdentity
Identifying information for a spectrum.
Definition: MSData.hpp:471
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::cv::CV
Information about an ontology or CV source and a short 'lookup' tag to refer to.
Definition: cv.hpp:14916
pwiz::msdata::Software
A piece of software.
Definition: MSData.hpp:180
pwiz::msdata::ProcessingMethod
Description of the default peak processing method. This element describes the base method used in the...
Definition: MSData.hpp:255
pwiz::msdata::SourceFile
Description of the source file, including location and type.
Definition: MSData.hpp:55
pwiz::msdata::Run
A run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
Definition: MSData.hpp:810
MSData.hpp
pwiz::msdata::Product
product ion information
Definition: MSData.hpp:348
pwiz::msdata::Contact
Structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam),...
Definition: MSData.hpp:80
pwiz::msdata::ScanList
List and descriptions of scans.
Definition: MSData.hpp:396
boost
Definition: DateTime.hpp:41
PWIZ_API_DECL
#define PWIZ_API_DECL
Definition: Export.hpp:32
ReadBinaryData
ReadBinaryData
Definition: IO.hpp:173
pwiz::msdata::ComponentList
List with the different components used in the mass spectrometer. At least one source,...
Definition: MSData.hpp:157
pwiz::data::ParamGroup
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:347
Export.hpp
pwiz::msdata::Activation
The type and energy level used for activation.
Definition: MSData.hpp:307
pwiz::msdata::SpectrumIdentityFromMzXML::peaksCount
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
pwiz::msdata::Chromatogram
A single chromatogram.
Definition: MSData.hpp:578
pwiz::msdata::IO::read
PWIZ_API_DECL void read(std::istream &is, CV &cv)
BinaryDataEncoder.hpp
pwiz::msdata::ScanWindow
TODO.
Definition: MSData.hpp:362
XMLWriter.hpp
pwiz::msdata::SpectrumIdentityFromXML::sourceFilePositionForBinarySpectrumData
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
pwiz::msdata::FileDescription
Information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
Definition: MSData.hpp:85
pwiz::msdata::SpectrumIdentityFromXML
Identifying information for a spectrum subclassed to add private information for faster file IO in mz...
Definition: IO.hpp:44
pwiz::util::IterationListenerRegistry
handles registration of IterationListeners and broadcast of update messages
Definition: IterationListener.hpp:66
pwiz::msdata::Component
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i....
Definition: MSData.hpp:132
pwiz::cv::cv
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
IgnoreSpectrumList
IgnoreSpectrumList
Definition: IO.hpp:212
pwiz::msdata::ScanSettings
Description of the acquisition settings of the instrument prior to the start of the run.
Definition: MSData.hpp:207
pwiz::msdata::SpectrumListSimple
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:717
pwiz::msdata::Scan
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile.
Definition: MSData.hpp:370
pwiz::msdata::SpectrumIdentityFromMzXML
Identifying information for a spectrum as read from mzML or mzXML subclassed to add private informati...
Definition: IO.hpp:54
pwiz::msdata::FileContent
This summarizes the different types of spectra that can be expected in the file. This is expected to ...
Definition: MSData.hpp:50
pwiz::msdata::Sample
Expansible description of the sample used to generate the dataset, named in sampleName.
Definition: MSData.hpp:102
pwiz::msdata::SelectedIon
TODO.
Definition: MSData.hpp:297
pwiz::msdata::BinaryDataArray
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:405
pwiz::msdata::Target
TODO.
Definition: MSData.hpp:202
pwiz::msdata::InstrumentConfiguration
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
Definition: MSData.hpp:230
pwiz::msdata::MSData
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:850
pwiz::msdata::DataProcessing
Description of the way in which a particular software was used.
Definition: MSData.hpp:274
pwiz::msdata::ChromatogramList
Interface for accessing chromatograms, which may be stored in memory or backed by a data file (RAW,...
Definition: MSData.hpp:757
pwiz::msdata::Precursor
The method of precursor ion selection and activation.
Definition: MSData.hpp:312
pwiz::msdata::SpectrumIdentityFromMzXML::SpectrumIdentityFromMzXML
SpectrumIdentityFromMzXML()
Definition: IO.hpp:58
pwiz::data::CVParam
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:45
pwiz::msdata::SpectrumIdentityFromXML::SpectrumIdentityFromXML
SpectrumIdentityFromXML()
Definition: IO.hpp:48
pwiz::msdata::SpectrumList
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW,...
Definition: MSData.hpp:661
pwiz::msdata::IO::write
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
pwiz::msdata::BinaryDataEncoder::Config
encoding/decoding configuration
Definition: BinaryDataEncoder.hpp:56