ProteoWizard
MSData.hpp
Go to the documentation of this file.
1 //
2 // $Id: MSData.hpp 6452 2014-07-03 19:01:15Z 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 _MSDATA_HPP_
25 #define _MSDATA_HPP_
26 
27 
30 #include "boost/shared_ptr.hpp"
31 #include "boost/iostreams/positioning.hpp"
32 #include <vector>
33 #include <string>
34 #include <map>
35 #include <set>
36 
37 
38 namespace pwiz {
39 namespace msdata {
40 
41 
42  using namespace pwiz::data;
43 
44 
45 PWIZ_API_DECL std::vector<CV> defaultCVList();
46 
47 
48 /// This summarizes the different types of spectra that can be expected in the file. This is expected to aid processing software in skipping files that do not contain appropriate spectrum types for it.
50 
51 
52 /// Description of the source file, including location and type.
54 {
55  /// an identifier for this file.
56  std::string id;
57 
58  /// name of the source file, without reference to location (either URI or local path).
59  std::string name;
60 
61  /// URI-formatted location where the file was retrieved.
62  std::string location;
63 
64  SourceFile(const std::string _id = "",
65  const std::string _name = "",
66  const std::string _location = "");
67 
68 
69  /// returns true iff the element contains no params and all members are empty or null
70  bool empty() const;
71 };
72 
73 
74 /// Description of the source file, including location and type.
75 typedef boost::shared_ptr<SourceFile> SourceFilePtr;
76 
77 
78 /// 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).
80 
81 
82 /// Information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is stored here.
84 {
85  /// this summarizes the different types of spectra that can be expected in the file. This is expected to aid processing software in skipping files that do not contain appropriate spectrum types for it.
87 
88  /// list and descriptions of the source files this mzML document was generated or derived from.
89  std::vector<SourceFilePtr> sourceFilePtrs;
90 
91  /// 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)
92  std::vector<Contact> contacts;
93 
94  /// returns true iff all members are empty or null
95  bool empty() const;
96 };
97 
98 
99 /// Expansible description of the sample used to generate the dataset, named in sampleName.
101 {
102  /// a unique identifier across the samples with which to reference this sample description.
103  std::string id;
104 
105  /// an optional name for the sample description, mostly intended as a quick mnemonic.
106  std::string name;
107 
108  Sample(const std::string _id = "",
109  const std::string _name = "");
110 
111 
112  /// returns true iff the element contains no params and all members are empty or null
113  bool empty() const;
114 };
115 
116 
117 typedef boost::shared_ptr<Sample> SamplePtr;
118 
119 
121 {
126 };
127 
128 
129 /// A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i.e. mass analyzer), or a detector (i.e. ion detector)
131 {
132  /// the type of component (Source, Analyzer, or Detector)
134 
135  /// this attribute MUST be used to indicate the order in which the components are encountered from source to detector (e.g., in a Q-TOF, the quadrupole would have the lower order number, and the TOF the higher number of the two).
136  int order;
137 
138  Component() : type(ComponentType_Unknown), order(0) {}
139  Component(ComponentType type, int order) : type(type), order(order) {}
140  Component(CVID cvid, int order) { define(cvid, order); }
141 
142  void define(CVID cvid, int order);
143 
144  /// returns true iff the element contains no params and all members are empty or null
145  bool empty() const;
146 };
147 
148 
149 //struct PWIZ_API_DECL Source : public Component {};
150 //struct PWIZ_API_DECL Analyzer : public Component {};
151 //struct PWIZ_API_DECL Detector : public Component {};
152 
153 
154 /// List with the different components used in the mass spectrometer. At least one source, one mass analyzer and one detector need to be specified.
155 struct PWIZ_API_DECL ComponentList : public std::vector<Component>
156 {
157  /// returns the source component with ordinal <index+1>
158  Component& source(size_t index);
159 
160  /// returns the analyzer component with ordinal <index+1>
161  Component& analyzer(size_t index);
162 
163  /// returns the detector component with ordinal <index+1>
164  Component& detector(size_t index);
165 
166  /// returns the source component with ordinal <index+1>
167  const Component& source(size_t index) const;
168 
169  /// returns the analyzer component with ordinal <index+1>
170  const Component& analyzer(size_t index) const;
171 
172  /// returns the detector component with ordinal <index+1>
173  const Component& detector(size_t index) const;
174 };
175 
176 
177 /// A piece of software.
179 {
180  /// an identifier for this software that is unique across all SoftwareTypes.
181  std::string id;
182 
183  /// the software version.
184  std::string version;
185 
186  Software(const std::string& _id = "");
187 
188  Software(const std::string& _id,
189  const CVParam& _param,
190  const std::string& _version);
191 
192  /// returns true iff all members are empty or null
193  bool empty() const;
194 };
195 
196 
197 typedef boost::shared_ptr<Software> SoftwarePtr;
198 
199 
200 /// TODO
202 
203 
204 /// Description of the acquisition settings of the instrument prior to the start of the run.
206 {
207  /// a unique identifier for this acquisition setting.
208  std::string id;
209 
210  /// container for a list of source file references.
211  std::vector<SourceFilePtr> sourceFilePtrs;
212 
213  /// target list (or 'inclusion list') configured prior to the run.
214  std::vector<Target> targets;
215 
216  ScanSettings(const std::string& _id = "");
217 
218 
219  /// returns true iff the element contains no params and all members are empty or null
220  bool empty() const;
221 };
222 
223 
224 typedef boost::shared_ptr<ScanSettings> ScanSettingsPtr;
225 
226 
227 /// Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST have one (and only one) of the three different components used for an analysis. For hybrid instruments, such as an LTQ-FT, there MUST be one configuration for each permutation of the components that is used in the document. For software configuration, reference the appropriate ScanSettings element.
229 {
230  /// an identifier for this instrument configuration.
231  std::string id;
232 
233  /// list with the different components used in the mass spectrometer. At least one source, one mass analyzer and one detector need to be specified.
235 
236  /// reference to a previously defined software element.
238 
239  /// reference to a scan settings element defining global scan settings used by this configuration
241 
242  InstrumentConfiguration(const std::string& _id = "");
243 
244  /// returns true iff the element contains no params and all members are empty or null
245  bool empty() const;
246 };
247 
248 
249 typedef boost::shared_ptr<InstrumentConfiguration> InstrumentConfigurationPtr;
250 
251 
252 /// Description of the default peak processing method. This element describes the base method used in the generation of a particular mzML file. Variable methods should be described in the appropriate acquisition section - if no acquisition-specific details are found, then this information serves as the default.
254 {
255  /// this attributes allows a series of consecutive steps to be placed in the correct order.
256  int order;
257 
258  /// this attribute MUST reference the 'id' of the appropriate SoftwareType.
260 
261  ProcessingMethod() : order(0) {}
262 
263  /// returns true iff the element contains no params and all members are empty or null
264  bool empty() const;
265 };
266 
267 
268 typedef boost::shared_ptr<ProcessingMethod> ProcessingMethodPtr;
269 
270 
271 /// Description of the way in which a particular software was used.
273 {
274  /// a unique identifier for this data processing that is unique across all DataProcessingTypes.
275  std::string id;
276 
277  /// description of the default peak processing method(s). This element describes the base method used in the generation of a particular mzML file. Variable methods should be described in the appropriate acquisition section - if no acquisition-specific details are found, then this information serves as the default.
278  std::vector<ProcessingMethod> processingMethods;
279 
280  DataProcessing(const std::string& _id = "");
281 
282  /// returns true iff the element contains no params and all members are empty or null
283  bool empty() const;
284 };
285 
286 
287 typedef boost::shared_ptr<DataProcessing> DataProcessingPtr;
288 
289 
290 /// This element captures the isolation (or 'selection') window configured to isolate one or more precursors.
292 
293 
294 /// TODO
296 {
298  explicit SelectedIon(double mz);
299  explicit SelectedIon(double mz, double intensity, CVID intensityUnit);
300  explicit SelectedIon(double mz, int chargeState);
301  explicit SelectedIon(double mz, double intensity, int chargeState, CVID intensityUnit);
302 };
303 
304 
305 /// The type and energy level used for activation.
307 
308 
309 /// The method of precursor ion selection and activation
311 {
312  /// for precursor spectra that are external to this document, this attribute MUST reference the 'id' attribute of a sourceFile representing that external document.
313  /// note: this attribute is mutually exclusive with spectrumID; i.e. use one or the other but not both
315 
316  /// for precursor spectra that are external to this document, this string MUST correspond to the 'id' attribute of a spectrum in the external document indicated by 'sourceFileRef'.
317  /// note: this attribute is mutually exclusive with spectrumID; i.e. use one or the other but not both
318  std::string externalSpectrumID;
319 
320  /// reference to the id attribute of the spectrum from which the precursor was selected.
321  /// note: this attribute is mutually exclusive with externalSpectrumID; i.e. use one or the other but not both
322  std::string spectrumID;
323 
324  /// this element captures the isolation (or 'selection') window configured to isolate one or more precursors.
326 
327  /// this list of precursor ions that were selected.
328  std::vector<SelectedIon> selectedIons;
329 
330  /// the type and energy level used for activation.
332 
334  explicit Precursor(double mz);
335  explicit Precursor(double mz, double intensity, CVID intensityUnit);
336  explicit Precursor(double mz, int chargeState);
337  explicit Precursor(double mz, double intensity, int chargeState, CVID intensityUnit);
338 
339 
340  /// returns true iff the element contains no params and all members are empty or null
341  bool empty() const;
342 };
343 
344 
345 /// product ion information
347 {
348  /// this element captures the isolation (or 'selection') window configured to isolate one or more precursors.
350 
351  /// returns true iff the element contains no params and all members are empty or null
352  bool empty() const;
353 
354  /// returns true iff this product's isolation window is equal to that product's
355  bool operator==(const Product& that) const;
356 };
357 
358 
359 /// TODO
361 {
363  ScanWindow(double low, double high, CVID unit);
364 };
365 
366 
367 /// Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile.
369 {
370  /// if this attribute is set, it must reference the 'id' attribute of a sourceFile representing the external document containing the spectrum referred to by 'externalSpectrumID'.
371  /// note: this attribute is mutually exclusive with spectrumID; i.e. use one or the other but not both
373 
374  /// for scans that are external to this document, this string must correspond to the 'id' attribute of a spectrum in the external document indicated by 'sourceFileRef'.
375  /// note: this attribute is mutually exclusive with spectrumID; i.e. use one or the other but not both
376  std::string externalSpectrumID;
377 
378  /// for scans that are local to this document, this attribute can be used to reference the 'id' attribute of the spectrum corresponding to the scan.
379  /// note: this attribute is mutually exclusive with externalSpectrumID; i.e. use one or the other but not both
380  std::string spectrumID;
381 
382  /// this attribute MUST reference the 'id' attribute of the appropriate instrument configuration.
384 
385  /// container for a list of select windows.
386  std::vector<ScanWindow> scanWindows;
387 
388  /// returns true iff the element contains no params and all members are empty or null
389  bool empty() const;
390 };
391 
392 
393 /// List and descriptions of scans.
395 {
396  std::vector<Scan> scans;
397 
398  bool empty() const;
399 };
400 
401 
402 /// The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style). Computers using a different endian style MUST convert to/from little endian when writing/reading mzML
404 {
405  /// this optional attribute may reference the 'id' attribute of the appropriate dataProcessing.
407 
408  /// the binary data.
409  std::vector<double> data;
410 
411  /// returns true iff the element contains no params and all members are empty or null
412  bool empty() const;
413 };
414 
415 
416 typedef boost::shared_ptr<BinaryDataArray> BinaryDataArrayPtr;
417 
418 
419 #pragma pack(1)
420 /// The data point type of a mass spectrum.
422 {
423  double mz;
424  double intensity;
425 
427  : mz(0), intensity(0)
428  {}
429 
430  MZIntensityPair(double mz, double intensity)
431  : mz(mz), intensity(intensity)
432  {}
433 
434  /// returns true iff mz and intensity are pairwise equal
435  bool operator==(const MZIntensityPair& that) const;
436 };
437 #pragma pack()
438 
439 
440 PWIZ_API_DECL std::ostream& operator<<(std::ostream& os, const MZIntensityPair& mzi);
441 
442 
443 #pragma pack(1)
444 /// The data point type of a chromatogram.
446 {
447  double time;
448  double intensity;
449 
451  : time(0), intensity(0)
452  {}
453 
454  TimeIntensityPair(double time,