ProteoWizard
Datastructures_mz5.hpp
Go to the documentation of this file.
1 //
2 // $Id: Datastructures_mz5.hpp 3484 2012-04-04 19:55:33Z mwilhelm42 $
3 //
4 //
5 // Original authors: Mathias Wilhelm <mw@wilhelmonline.com>
6 // Marc Kirchner <mail@marc-kirchner.de>
7 //
8 // Copyright 2011 Proteomics Center
9 // Children's Hospital Boston, Boston, MA 02135
10 //
11 // Licensed under the Apache License, Version 2.0 (the "License");
12 // you may not use this file except in compliance with the License.
13 // You may obtain a copy of the License at
14 //
15 // http://www.apache.org/licenses/LICENSE-2.0
16 //
17 // Unless required by applicable law or agreed to in writing, software
18 // distributed under the License is distributed on an "AS IS" BASIS,
19 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 // See the License for the specific language governing permissions and
21 // limitations under the License.
22 //
23 
24 #ifndef DATASTRUCTURES_MZ5_HPP_
25 #define DATASTRUCTURES_MZ5_HPP_
26 
27 #include "../../common/cv.hpp"
28 #include "../../common/ParamTypes.hpp"
29 #include "../MSData.hpp"
30 #include "H5Cpp.h"
31 #include <string>
32 #include <vector>
33 
34 namespace pwiz {
35 namespace msdata {
36 namespace mz5 {
37 
38 /**
39  * All these classes are wrappers with build in converter methods from pwiz::msdata::MSData to the corresponding MZ5 representation.
40  * Each class has a copy constructor, an assign operator and a destructor. Some have a corresponding data struct, to allow the usage of HOFFSET, which only works with a plain old datatype(POD).
41  */
42 
43 /**
44  * Forward declaration of ReferenceWrite_mz5 and ReferenceRead_mz5 to resolve cyclic dependency.
45  */
46 class ReferenceWrite_mz5;
47 class ReferenceRead_mz5;
48 class Configuration_mz5;
49 
50 /**
51  * CVParam value string size
52  */
53 #define CVL 128
54 /**
55  * UserParam value string size
56  */
57 #define USRVL 128
58 /**
59  * UserParam name string size
60  */
61 #define USRNL 256
62 /**
63  * UserParam type string size.
64  */
65 #define USRTL 64
66 
67 /**
68  * General mz5 file information.
69  * This struct contains information about the mz5 version, and how to handle specific data sets.
70  *
71  * The functionality of didFiltering is removed, but it will stay in the FileInformationMZ5Data struct.
72  */
74 {
75  unsigned short majorVersion;
76  unsigned short minorVersion;
77  unsigned short didFiltering;
78  unsigned short deltaMZ;
79  unsigned short translateInten;
80 };
81 
83 {
89  void init(const unsigned short majorVersion,
90  const unsigned short minorVersion, const unsigned didFiltering,
91  const unsigned deltaMZ, const unsigned translateInten);
92  static H5::CompType getType();
93 };
94 
96 {
97  char* uri;
98  char* fullname;
99  char* id;
100  char* version;
101 };
102 
103 /**
104  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#cv
105  */
107 {
108  ContVocabMZ5();
109  ContVocabMZ5(const pwiz::cv::CV);
110  ContVocabMZ5(const std::string& uri, const std::string& fullname,
111  const std::string& id, const std::string& version);
112  ContVocabMZ5(const char* uri, const char* fullname, const char* id,
113  const char* version);
114  ContVocabMZ5(const ContVocabMZ5&);
116  ~ContVocabMZ5();
117  void init(const std::string&, const std::string&, const std::string&,
118  const std::string&);
120  static H5::CompType getType();
121  static void convert(std::vector<ContVocabMZ5>&, const std::vector<
122  pwiz::cv::CV>);
123 };
124 
126 {
127  char* name;
128  char* prefix;
129  unsigned long accession;
130 };
131 
132 /**
133  * This class will be referenced from CVParamMZ5 and UserParamMZ5 to reduce storage size.
134  */
135 struct CVRefMZ5: public CVRefMZ5Data
136 {
137  CVRefMZ5();
138  CVRefMZ5(const pwiz::cv::CVID);
139  CVRefMZ5(const CVRefMZ5&);
140  CVRefMZ5& operator=(const CVRefMZ5&);
141  ~CVRefMZ5();
142  void init(const char* name, const char* prefix,
143  const unsigned long accession);
144  static H5::CompType getType();
145 };
146 
148 {
149  char name[USRNL];
150  char value[USRVL];
151  char type[USRTL];
152  unsigned long unitCVRefID;
153 };
154 
155 /**
156  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#userParam
157  */
159 {
160  UserParamMZ5();
161  UserParamMZ5(const UserParamMZ5&);
164  ~UserParamMZ5();
165  void init(const char* name, const char* value, const char* type,
166  const unsigned long urefid);
168  static H5::CompType getType();
169 };
170 
172 {
173  char value[CVL];
174  unsigned long typeCVRefID;
175  unsigned long unitCVRefID;
176 };
177 
178 /**
179  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#cvParam
180  */
182 {
183  CVParamMZ5();
184  CVParamMZ5(const CVParamMZ5&);
187  ~CVParamMZ5();
188  void init(const char* value, const unsigned long& cvrefid,
189  const unsigned long& urefid);
190  void fill(pwiz::data::CVParam&, const ReferenceRead_mz5& rref);
191  static H5::CompType getType();
192 };
193 
195 {
196  unsigned long refID;
197 };
198 
199 /**
200  * Is used as a general reference for different tags.
201  */
202 struct RefMZ5: public RefMZ5Data
203 {
204  RefMZ5();
205  RefMZ5(const RefMZ5&);
207  RefMZ5(const pwiz::msdata::Sample&, const ReferenceWrite_mz5& ref);
213  const ReferenceWrite_mz5& ref);
214  RefMZ5(const std::string& spectrumID, const ReferenceWrite_mz5& ref);
215  RefMZ5& operator=(const RefMZ5&);
216  ~RefMZ5();
222  const ReferenceRead_mz5& rref);
224  const ReferenceRead_mz5& rref);
226  const ReferenceRead_mz5& rref);
227  static H5::CompType getType();
228 };
229 
231 {
232  size_t len;
234 };
235 
236 /**
237  * Variable length list of references.
238  */
240 {
241  RefListMZ5();
242  RefListMZ5(const RefListMZ5&);
243  RefListMZ5(const std::vector<pwiz::data::ParamGroupPtr>&,
244  const ReferenceWrite_mz5& ref);
245  RefListMZ5(const std::vector<pwiz::msdata::SourceFilePtr>&,
246  const ReferenceWrite_mz5& ref);
248  ~RefListMZ5();
249  void init(const RefMZ5* list, const size_t len);
250  void fill(std::vector<pwiz::msdata::ParamGroupPtr>&,
251  const ReferenceRead_mz5& rref);
252  void fill(std::vector<pwiz::msdata::SourceFilePtr>&,
253  const ReferenceRead_mz5& rref);
254  static H5::VarLenType getType();
255 };
256 
258 {
259  unsigned long cvParamStartID;
260  unsigned long cvParamEndID;
261  unsigned long userParamStartID;
262  unsigned long userParamEndID;
263  unsigned long refParamGroupStartID;
264  unsigned long refParamGroupEndID;
265 };
266 
267 /**
268  * This class represents a pwiz::msdata::ParamContainer but only stores start and end indices for CVParams, UserParams and ParamGroups.
269  */
271 {
272  ParamListMZ5();
273  ParamListMZ5(const ParamListMZ5&);
274  ParamListMZ5(const std::vector<pwiz::msdata::CVParam>& cv,
275  const std::vector<pwiz::msdata::UserParam>& user,
276  const std::vector<pwiz::msdata::ParamGroupPtr>& param,
277  const ReferenceWrite_mz5& wref);
279  ~ParamListMZ5();
280  bool empty();
281  void init(const unsigned long cvstart, const unsigned long cvend,
282  const unsigned long usrstart, const unsigned long usrend,
283  const unsigned long refstart, const unsigned long refend);
285  const ReferenceRead_mz5& rref);
286  void fillParamContainer(std::vector<pwiz::msdata::CVParam>& cv,
287  std::vector<pwiz::msdata::UserParam>& user, std::vector<
289  const ReferenceRead_mz5& rref);
290  static H5::CompType getType();
291  static void convert(std::vector<ParamListMZ5>&, const std::vector<
293  static void convert(std::vector<ParamListMZ5>&, const std::vector<
295  static void convert(std::vector<ParamListMZ5>&, const std::vector<
297 };
298 
299 /**
300  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#referenceableParamGroup
301  */
303 {
304  char* id;
306  ParamGroupMZ5();
309  const ReferenceWrite_mz5& wref);
311  ~ParamGroupMZ5();
312  void init(const ParamListMZ5& params, const char* id);
314  static H5::CompType getType();
315 };
316 
317 /**
318  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#sourceFile
319  */
321 {
322  char* id;
323  char* location;
324  char* name;
326  SourceFileMZ5();
329  const ReferenceWrite_mz5& wref);
331  ~SourceFileMZ5();
332  void init(const ParamListMZ5& params, const char* id, const char* location,
333  const char* name);
335  static H5::CompType getType();
336  static void convert(std::vector<SourceFileMZ5>&, const std::vector<
338  static void read(const std::vector<pwiz::msdata::SourceFilePtr>&,
339  const ReferenceWrite_mz5& wref);
340 };
341 
342 /**
343  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#sample
344  */
345 struct SampleMZ5
346 {
347  char* id;
348  char* name;
350  SampleMZ5();
351  SampleMZ5(const SampleMZ5&);
353  SampleMZ5& operator=(const SampleMZ5&);
354  ~SampleMZ5();
355  void init(const ParamListMZ5& params, const char* id, const char* name);
357  static H5::CompType getType();
358  static void convert(std::vector<SampleMZ5>&, const std::vector<
360  static void read(const std::vector<pwiz::msdata::SamplePtr>&,
361  const ReferenceWrite_mz5& wref);
362 };
363 
364 /**
365  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#software
366  */
368 {
369  char* id;
370  char* version;
372  SoftwareMZ5();
373  SoftwareMZ5(const SoftwareMZ5&);
376  ~SoftwareMZ5();
377  void init(const ParamListMZ5& params, const char* id, const char* version);
379  static H5::CompType getType();
380  static void convert(std::vector<SoftwareMZ5>&, const std::vector<
382  static void read(const std::vector<pwiz::msdata::SoftwarePtr>&,
383  const ReferenceWrite_mz5& wref);
384 };
385 
386 /**
387  * This class is used as a generalized container for Targets, SelectedIons, Products and ScanWindows.
388  * See for example:
389  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#isolationWindow
390  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#product
391  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#scanWindowList
392  */
394 {
395  size_t len;
397  ParamListsMZ5();
399  ParamListsMZ5(const std::vector<pwiz::msdata::Target>&,
400  const ReferenceWrite_mz5& wref);
401  ParamListsMZ5(const std::vector<pwiz::msdata::SelectedIon>&,
402  const ReferenceWrite_mz5& wref);
403  ParamListsMZ5(const std::vector<pwiz::msdata::Product>&,
404  const ReferenceWrite_mz5& wref);
405  ParamListsMZ5(const std::vector<pwiz::msdata::ScanWindow>&,
406  const ReferenceWrite_mz5& wref);
408  ~ParamListsMZ5();
409  void init(const ParamListMZ5* list, const size_t len);
410  void
411  fill(std::vector<pwiz::msdata::Target>&, const ReferenceRead_mz5& rref);
412  void fill(std::vector<pwiz::msdata::Product>&,
413  const ReferenceRead_mz5& rref);
414  void fill(std::vector<pwiz::msdata::ScanWindow>&,
415  const ReferenceRead_mz5& rref);
416  void fill(std::vector<pwiz::msdata::SelectedIon>&,
417  const ReferenceRead_mz5& rref);
418  static H5::VarLenType getType();
419 };
420 
421 /**
422  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#scanSettings
423  */
425 {
426  char* id;
430  ScanSettingMZ5();
433  const ReferenceWrite_mz5& wref);
435  ~ScanSettingMZ5();
436  void
437  init(const ParamListMZ5& params, const RefListMZ5& refSourceFiles,
438  const ParamListsMZ5 targets, const char* id);
440  static H5::CompType getType();
441  static void convert(std::vector<ScanSettingMZ5>&, const std::vector<
443  static void read(const std::vector<pwiz::msdata::ScanSettingsPtr>&,
444  const ReferenceWrite_mz5& wref);
445 };
446 
447 /**
448  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#source
449  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#analyzer
450  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#detector
451  */
453 {
455  unsigned long order;
456  ComponentMZ5();
457  ComponentMZ5(const ComponentMZ5&);
459  const ReferenceWrite_mz5& wref);
461  ~ComponentMZ5();
462  void init(const ParamListMZ5&, const unsigned long order);
464  const pwiz::msdata::ComponentType t, const ReferenceRead_mz5& rref);
465  static H5::CompType getType();
466 };
467 
468 /**
469  * List of components.
470  */
472 {
473  size_t len;
477  ComponentListMZ5(const std::vector<ComponentMZ5>&);
480  void init(const ComponentMZ5*, const size_t&);
481  void
483  const ReferenceRead_mz5& rref);
484  static H5::VarLenType getType();
485 };
486 
487 /**
488  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#componentList
489  */
491 {
495  ComponentsMZ5();
498  const ReferenceWrite_mz5& wref);
500  ~ComponentsMZ5();
501  void init(const ComponentListMZ5& sources,
503  const ComponentListMZ5& detectors);
505  static H5::CompType getType();
506 };
507 
508 /**
509  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#instrumentConfiguration
510  */
512 {
513  char* id;
521  const ReferenceWrite_mz5& ref);
524  void init(const ParamListMZ5& params, const ComponentsMZ5& components,
525  const RefMZ5& refScanSetting, const RefMZ5& refSoftware,
526  const char* id);
528  const ReferenceRead_mz5& rref);
529  static H5::CompType getType();
530  static void read(
531  const std::vector<pwiz::msdata::InstrumentConfigurationPtr>&,
532  const ReferenceWrite_mz5& wref);
533 };
534 
535 /**
536  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#processingMethod
537  */
539 {
542  unsigned long order;
546  const ReferenceWrite_mz5& ref);
549  void init(const ParamListMZ5& params, const RefMZ5& refSoftware,
550  const unsigned long order);
552  const ReferenceRead_mz5& rref);
553  static H5::CompType getType();
554 };
555 
556 /**
557  * Variable length processing method list.
558  */
560 {
561  size_t len;
565  ProcessingMethodListMZ5(const std::vector<pwiz::msdata::ProcessingMethod>&,
566  const ReferenceWrite_mz5& wref);
569  void init(const ProcessingMethodMZ5* list, const size_t len);
570  void fill(std::vector<pwiz::msdata::ProcessingMethod>&,
571  const ReferenceRead_mz5& rref);
572  static H5::VarLenType getType();
573 };
574 
575 /**
576  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#dataProcessing
577  */
579 {
580  char* id;
585  const ReferenceWrite_mz5& wref);
588  void init(const ProcessingMethodListMZ5&, const char* id);
590  const ReferenceRead_mz5& rref);
591  static H5::CompType getType();
592  static void convert(std::vector<DataProcessingMZ5>&, const std::vector<
594  static void read(const std::vector<pwiz::msdata::DataProcessingPtr>&,
595  const ReferenceWrite_mz5& wref);
596 };
597 
598 /**
599  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#precursor
600  */
602 {
609  PrecursorMZ5();
610  PrecursorMZ5(const PrecursorMZ5&);
612  const ReferenceWrite_mz5& wref);
614  ~PrecursorMZ5();
615  void init(const ParamListMZ5& activation,
617  const ParamListsMZ5 selectedIonList, const RefMZ5& refSpectrum,
618  const RefMZ5& refSourceFile, const char* externalSpectrumId);
620  static H5::CompType getType();
621 };
622 
623 /**
624  * Variable length precursor list.
625  */
627 {
628  size_t len;
632  PrecursorListMZ5(const std::vector<PrecursorMZ5>&);
633  PrecursorListMZ5(const std::vector<pwiz::msdata::Precursor>&,
634  const ReferenceWrite_mz5& wref);
637  void init(const PrecursorMZ5*, const size_t len);
638  void fill(std::vector<pwiz::msdata::Precursor>&,
639  const ReferenceRead_mz5& rref);
640  static H5::VarLenType getType();
641 };
642 
643 /**
644  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#chromatogram but without binary data element.
645  */
647 {
648  char* id;
653  unsigned long index;
654  ChromatogramMZ5();
657  const ReferenceWrite_mz5& wref);
660  void init(const ParamListMZ5& params, const PrecursorMZ5& precursor,
662  const RefMZ5& refDataProcessing, const unsigned long index,
663  const char* id);
666  static H5::CompType getType();
667 };
668 
669 /**
670  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#scan
671  */
672 struct ScanMZ5
673 {
680  ScanMZ5();
681  ScanMZ5(const ScanMZ5&);
682  ScanMZ5(const pwiz::msdata::Scan&, const ReferenceWrite_mz5& wref);
683  ScanMZ5& operator=(const ScanMZ5&);
684  ~ScanMZ5();
685  void init(const ParamListMZ5& params, const ParamListsMZ5& scanWindowList,
686  const RefMZ5& refInstrument, const RefMZ5& refSourceFile,
687  const RefMZ5& refSpectrum, const char* externalSpectrumID);
688  void fill(pwiz::msdata::Scan&, const ReferenceRead_mz5& rref);
689  static H5::CompType getType();
690 };
691 
692 /**
693  * Variable length scan list.
694  */
696 {
697  size_t len;
699  ScanListMZ5();
700  ScanListMZ5(const ScanListMZ5&);
701  ScanListMZ5(const std::vector<ScanMZ5>&);
702  ScanListMZ5(const std::vector<pwiz::msdata::Scan>&,
703  const ReferenceWrite_mz5& wref);
705  ~ScanListMZ5();
706  void init(const ScanMZ5* list, const size_t len);
707  void fill(std::vector<pwiz::msdata::Scan>&, const ReferenceRead_mz5& rref);
708  static H5::VarLenType getType();
709 };
710 
711 /**
712  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#scanList
713  */
714 struct ScansMZ5
715 {
718  ScansMZ5();
719  ScansMZ5(const ScansMZ5&);
721  ScansMZ5& operator=(const ScansMZ5&);
722  ~ScansMZ5();
723  void init(const ParamListMZ5& params, const ScanListMZ5& scanList);
724  void fill(pwiz::msdata::ScanList& sl, const ReferenceRead_mz5& rref);
725  static H5::CompType getType();
726 };
727 
728 /**
729  *http://www.peptideatlas.org/tmp/mzML1.1.0.html#spectrum but without binary data elements.
730  */
732 {
733  char* id;
734  char* spotID;
741  unsigned int index;
742  SpectrumMZ5();
743  SpectrumMZ5(const SpectrumMZ5&);
746  ~SpectrumMZ5();
747  void init(const ParamListMZ5& params, const ScansMZ5& scanList,
748  const PrecursorListMZ5& precursors,
749  const ParamListsMZ5& productIonIsolationWindows,
750  const RefMZ5& refDataProcessing, const RefMZ5& refSourceFile,
751  const unsigned long index, const char* id, const char* spotID);
755  static H5::CompType getType();
756 };
757 
758 /**
759  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#run but without spectrum and chromatogram elements.
760  */
761 struct RunMZ5
762 {
763  char* id;
765  char* fid;
766  char* facc;
773  RunMZ5();
774  RunMZ5(const RunMZ5&);
775  RunMZ5(const pwiz::msdata::Run&, const std::string fid,
776  const std::string facc, const ReferenceWrite_mz5& wref);
777  RunMZ5& operator=(const RunMZ5&);
778  ~RunMZ5();
779  void
780  init(const ParamListMZ5& params, const RefMZ5& refSpectrumDP,
781  const RefMZ5& refChromatogramDP,
782  const RefMZ5& refDefaultInstrument, const RefMZ5& refSourceFile,
783  const RefMZ5& refSample, const char* id,
784  const char* startTimeStamp, const char* fid, const char* facc);
786  static H5::CompType getType();
787 };
788 
789 /**
790  * http://www.peptideatlas.org/tmp/mzML1.1.0.html#binaryDataArray but without raw data
791  */
793 {
798  BinaryDataMZ5();
801  const pwiz::msdata::BinaryDataArray& bday,
802  const ReferenceWrite_mz5& wref);
804  ~BinaryDataMZ5();
805  bool empty();
806  void init(const ParamListMZ5& xParams, const ParamListMZ5& yParams,
807  const RefMZ5& refDPx, const RefMZ5& refDPy);
810  static H5::CompType getType();
811  static void convert(std::vector<BinaryDataMZ5>& l,
812  const pwiz::msdata::SpectrumListPtr& sptr,
813  const ReferenceWrite_mz5& wref);
814  static void convert(std::vector<BinaryDataMZ5>&,
816  const ReferenceWrite_mz5& wref);
817 };
818 
819 }
820 }
821 }
822 
823 #endif /* DATASTRUCTURES_MZ5_HPP_ */