ProteoWizard
IOTest.cpp
Go to the documentation of this file.
1 //
2 // $Id: IOTest.cpp 6478 2014-07-08 20:01:38Z chambm $
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 #include "IO.hpp"
25 #include "Diff.hpp"
26 #include "References.hpp"
29 
30 using namespace pwiz::util;
31 using namespace pwiz::minimxml;
32 using namespace pwiz::cv;
33 using namespace pwiz::data;
34 using namespace pwiz::msdata;
35 using boost::iostreams::stream_offset;
36 
37 
38 ostream* os_ = 0;
39 
40 
41 template <typename object_type>
42 void testObject(const object_type& a)
43 {
44  if (os_) *os_ << "testObject(): " << typeid(a).name() << endl;
45 
46  // write 'a' out to a stream
47 
48  ostringstream oss;
49  XMLWriter writer(oss);
50  IO::write(writer, a);
51  if (os_) *os_ << oss.str() << endl;
52 
53  // read 'b' in from stream
54 
55  object_type b;
56  istringstream iss(oss.str());
57  IO::read(iss, b);
58 
59  // compare 'a' and 'b'
60 
62  if (diff && os_) *os_ << "diff:\n" << diff << endl;
63  unit_assert(!diff);
64 }
65 
66 
67 template <typename object_type>
68 void testObjectWithMSData(const object_type& a, const MSData& msd)
69 {
70  if (os_) *os_ << "testObject(): " << typeid(a).name() << endl;
71 
72  // write 'a' out to a stream
73 
74  ostringstream oss;
75  XMLWriter writer(oss);
76  IO::write(writer, a, msd);
77  if (os_) *os_ << oss.str() << endl;
78 
79  // read 'b' in from stream
80 
81  object_type b;
82  istringstream iss(oss.str());
83  IO::read(iss, b);
84 
85  // compare 'a' and 'b'
86 
88  if (diff && os_) *os_ << "diff:\n" << diff << endl;
89  unit_assert(!diff);
90 }
91 
92 
94 {
95  if (os_) *os_ << "testObject_SpectrumList(): " << endl;
96 
97  // write 'a' out to a stream
98 
99  ostringstream oss;
100  XMLWriter writer(oss);
101  MSData dummy;
102  IO::write(writer, a, dummy);
103  if (os_) *os_ << oss.str() << endl;
104 
105  // read 'b' in from stream
106 
108  istringstream iss(oss.str());
109  IO::read(iss, b);
110 
111  // compare 'a' and 'b'
112 
114  if (diff && os_) *os_ << "diff:\n" << diff << endl;
115  unit_assert(!diff);
116 
117 
118 }
119 
121 
122 {
123  if (os_) *os_ << "testObject_ChromatogramList(): " << endl;
124 
125  // write 'a' out to a stream
126 
127  ostringstream oss;
128  XMLWriter writer(oss);
129  IO::write(writer, a);
130  if (os_) *os_ << oss.str() << endl;
131 
132  // read 'b' in from stream
133 
135  istringstream iss(oss.str());
136  IO::read(iss, b);
137 
138  // compare 'a' and 'b'
139 
141  if (diff && os_) *os_ << "diff:\n" << diff << endl;
142  unit_assert(!diff);
143 }
144 
145 
146 void testCV()
147 {
148  CV a;
149  a.URI = "abcd";
150  a.id = "efgh";
151  a.fullName = "ijkl";
152  a.version = "mnop";
153 
154  testObject(a);
155 }
156 
157 
159 {
160  UserParam a;
161  a.name = "abcd";
162  a.value = "efgh";
163  a.type = "ijkl";
164  a.units = UO_minute;
165 
166  testObject(a);
167 }
168 
169 
171 {
172  CVParam a(MS_selected_ion_m_z, "810.48", MS_m_z);
173  testObject(a);
174 
175  CVParam b(UO_second, "123.45");
176  testObject(b);
177 }
178 
179 
181 {
182  ParamGroup a("pg");
183  a.userParams.push_back(UserParam("goober", "goo", "peanuts"));
184  a.cvParams.push_back(CVParam(MS_ionization_type, "420"));
185  a.cvParams.push_back(CVParam(MS_selected_ion_m_z, "666", MS_m_z));
186  a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pgp")));
187  testObject(a);
188 }
189 
190 
191 template <typename object_type>
193 {
194  object_type a;
195  a.userParams.push_back(UserParam("goober", "goo", "peanuts"));
196  a.cvParams.push_back(CVParam(MS_ionization_type, "420"));
197  a.cvParams.push_back(CVParam(MS_selected_ion_m_z, "666", MS_m_z));
198  a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pgp")));
199  testObject(a);
200 }
201 
202 
204 {
205  SourceFile a("id123", "name456", "location789");
206  a.userParams.push_back(UserParam("goober", "goo", "peanuts"));
207  a.cvParams.push_back(CVParam(MS_ionization_type, "420"));
208  a.cvParams.push_back(CVParam(MS_selected_ion_m_z, "666", MS_m_z));
209  a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pgp")));
210  testObject(a);
211 }
212 
213 
215 {
216  FileDescription a;
217  a.fileContent.cvParams.push_back(MS_MSn_spectrum);
218 
219  SourceFilePtr sf(new SourceFile("1", "tiny1.RAW", "file://F:/data/Exp01"));
220  sf->cvParams.push_back(MS_Thermo_RAW_format);
221  sf->cvParams.push_back(MS_SHA_1);
222  a.sourceFilePtrs.push_back(sf);
223 
224  Contact contact;
225  contact.cvParams.push_back(CVParam(MS_contact_name, "Darren"));
226  a.contacts.push_back(contact);
227 
228  testObject(a);
229 }
230 
231 
233 {
234  Sample a("id123", "name456");
235  a.userParams.push_back(UserParam("goober", "goo", "peanuts"));
236  a.cvParams.push_back(CVParam(MS_ionization_type, "420"));
237  a.cvParams.push_back(CVParam(MS_selected_ion_m_z, "666", MS_m_z));
238  a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pgp")));
239  testObject(a);
240 }
241 
242 
244 {
246  a.userParams.push_back(UserParam("goober", "goo", "peanuts"));
247  a.cvParams.push_back(CVParam(MS_ionization_type, "420"));
248  a.cvParams.push_back(CVParam(MS_selected_ion_m_z, "666", MS_m_z));
249  a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pgp")));
250  testObject(a);
251 }
252 
253 
255 {
256  ComponentList a;
257  a.push_back(Component(MS_nanoelectrospray, 1));
258  a.push_back(Component(MS_quadrupole_ion_trap, 2));
259  a.push_back(Component(MS_electron_multiplier, 3));
260  testObject(a);
261 }
262 
263 
265 {
266  Software a;
267  a.id = "goober";
269  a.version = "4.20";
270  testObject(a);
271 }
272 
273 
275 {
277  a.id = "LCQ Deca";
278  a.cvParams.push_back(MS_LCQ_Deca);
279  a.cvParams.push_back(CVParam(MS_instrument_serial_number, 23433));
283  a.softwarePtr = SoftwarePtr(new Software("XCalibur"));
284  testObject(a);
285 }
286 
287 
289 {
291  a.order = 420;
292  a.cvParams.push_back(CVParam(MS_deisotoping, false));
293  a.cvParams.push_back(CVParam(MS_charge_deconvolution, false));
294  a.cvParams.push_back(CVParam(MS_peak_picking, true));
295  a.softwarePtr = SoftwarePtr(new Software("pwiz"));
296  testObject(a);
297 }
298 
299 
301 {
302  DataProcessing a;
303 
304  a.id = "msdata processing";
305 
306  ProcessingMethod pm1, pm2;
307 
308  pm1.order = 420;
309  pm1.cvParams.push_back(CVParam(MS_deisotoping, false));
310  pm1.cvParams.push_back(CVParam(MS_charge_deconvolution, false));
311  pm1.cvParams.push_back(CVParam(MS_peak_picking, true));
312  pm1.softwarePtr = SoftwarePtr(new Software("msdata"));
313 
314  pm2.order = 421;
315  pm2.userParams.push_back(UserParam("testing"));
316 
317  a.processingMethods.push_back(pm1);
318  a.processingMethods.push_back(pm2);
319 
320  testObject(a);
321 }
322 
323 
325 {
326  ScanSettings a;
327 
328  a.id = "as1";
329 
330  Target t1, t2;
331 
332  t1.set(MS_selected_ion_m_z, 200);
333  t2.userParams.push_back(UserParam("testing"));
334 
335  a.targets.push_back(t1);
336  a.targets.push_back(t2);
337 
338  a.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf1")));
339  a.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf2")));
340 
341  testObject(a);
342 }
343 
344 
346 {
347  Precursor a;
348 
349  a.spectrumID = "scan=19";
353  a.selectedIons.resize(2);
354  a.selectedIons[0].set(MS_selected_ion_m_z, 445.34, MS_m_z);
355  a.selectedIons[1].set(MS_charge_state, 2);
358 
359  testObject(a);
360 
361  // TODO: fix this to test mzML 1.0 precursors;
362  // (requires fixing the framework to support testing different schema versions)
363 }
364 
365 
367 {
368  Product a;
369 
373 
374  testObject(a);
375 }
376 
377 
378 void testScan()
379 {
380  Scan a;
381 
383  a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("CommonMS1SpectrumParams")));
384  a.cvParams.push_back(CVParam(MS_scan_start_time, 5.890500, UO_minute));
385  a.cvParams.push_back(CVParam(MS_filter_string, "+ c NSI Full ms [ 400.00-1800.00]"));
386  a.scanWindows.push_back(ScanWindow(400.0, 1800.0, MS_m_z));
387 
388  MSData dummy;
389  testObjectWithMSData(a, dummy);
390 }
391 
392 
394 {
395  ScanList a;
396  a.cvParams.push_back(MS_sum_of_spectra);
397 
398  Scan a1;
399  a1.cvParams.push_back(MS_reflectron_on);
400 
401  Scan a2;
402  a1.cvParams.push_back(MS_reflectron_off);
403 
404  a.scans.push_back(a1);
405  a.scans.push_back(a2);
406 
407  MSData dummy;
408  testObjectWithMSData(a, dummy);
409 }
410 
411 
413 {
414  if (os_) *os_ << "testBinaryDataArray():\n";
415 
416  BinaryDataArray a;
417  for (int i=0; i<10; i++) a.data.push_back(i);
419 
420  // write 'a' out to a stream
421 
422  ostringstream oss;
423  XMLWriter writer(oss);
424  IO::write(writer, a, config);
425  if (os_) *os_ << oss.str() << endl;
426 
427  // read 'b' in from stream
428 
429  BinaryDataArray b;
430  istringstream iss(oss.str());
431  IO::read(iss, b);
432 
433  // compare 'a' and 'b'
434 
436  if (diff && os_) *os_ << "diff:\n" << diff << endl;
437  unit_assert(!diff);
438 }
439 
440 
442 {
444 
445  config.precision = BinaryDataEncoder::Precision_32;
446  config.byteOrder = BinaryDataEncoder::ByteOrder_LittleEndian;
447  testBinaryDataArray(config);
448 
449  config.precision = BinaryDataEncoder::Precision_64;
450  config.byteOrder = BinaryDataEncoder::ByteOrder_LittleEndian;
451  testBinaryDataArray(config);
452 
453  //config.precision = BinaryDataEncoder::Precision_64;
454  //config.compression = BinaryDataEncoder::Compression_Zlib;
455  //testBinaryDataArray(config);
456 }
457 
458 
459 const char* bdaWithExternalMetadata = "\
460 <binaryDataArray encodedLength=\"160\" arrayLength=\"15\"> \
461  <referenceableParamGroupRef ref=\"mz_params\"/> \
462  <binary>AAAAAAAAAAAAAAAAAADwPwAAAAAAAABAAAAAAAAACEAAAAAAAAAQQAAAAAAAABRAAAAAAAAAGEAAAAAAAAAcQAAAAAAAACBAAAAAAAAAIkAAAAAAAAAkQAAAAAAAACZAAAAAAAAAKEAAAAAAAAAqQAAAAAAAACxA</binary> \
463 </binaryDataArray>";
464 
465 
467 {
468  // instantiate an MSData object with the binary array metadata held in a ParamGroup
469 
470  MSData msd;
471  ParamGroupPtr pg(new ParamGroup);
472  pg->id = "mz_params";
473  pg->cvParams.push_back(MS_m_z_array);
474  pg->cvParams.push_back(MS_64_bit_float);
475  pg->cvParams.push_back(MS_no_compression);
476  msd.paramGroupPtrs.push_back(pg);
477 
478  istringstream is(bdaWithExternalMetadata);
479  BinaryDataArray bda;
480 
481  // test read with MSData reference
482 
483  IO::read(is, bda, &msd);
484 
485  unit_assert(bda.data.size() == 15);
486  for (size_t i=0; i<15; i++)
487  unit_assert(bda.data[i] == i);
488 }
489 
490 
492 {
493  if (os_) *os_ << "testSpectrum():\n";
494 
495  Spectrum a;
496 
497  a.index = 123;
498  a.id = "goo";
499  a.defaultArrayLength = 666;
501  a.sourceFilePtr = SourceFilePtr(new SourceFile("sf"));
503  for (size_t i=0; i<a.defaultArrayLength; i++)
504  a.binaryDataArrayPtrs.back()->data.push_back(i);
505  a.binaryDataArrayPtrs.back()->set(MS_m_z_array);
507  for (size_t i=0; i<a.defaultArrayLength; i++)
508  a.binaryDataArrayPtrs.back()->data.push_back(i*2);
510  a.cvParams.push_back(MS_reflectron_on);
511  a.cvParams.push_back(MS_MSn_spectrum);
512 
513  a.precursors.push_back(Precursor());
514  a.precursors.back().spectrumID = "19";
515  a.precursors.back().selectedIons.resize(1);
516  a.precursors.back().selectedIons[0].set(MS_selected_ion_m_z, 445.34, MS_m_z);
517  a.precursors.back().selectedIons[0].set(MS_charge_state, 2);
518  a.precursors.back().activation.set(MS_collision_induced_dissociation);
519  a.precursors.back().activation.set(MS_collision_energy, 35.00, UO_electronvolt);
520 
521  a.products.push_back(Product());
522  a.products.back().isolationWindow.set(MS_ionization_type, "420");
523 
524  a.scanList.scans.push_back(Scan());
525  Scan& scan = a.scanList.scans.back();
526  scan.set(MS_scan_start_time, 4.20);
527  scan.set(MS_filter_string, "doobie");
528 
529  a.scanList.scans.push_back(Scan());
530  Scan& scan2 = a.scanList.scans.back();
531  scan2.set(MS_scan_start_time, 4.21);
532  scan2.set(MS_filter_string, "doo");
533 
534  // write 'a' out to a stream
535 
536  ostringstream oss;
537  XMLWriter writer(oss);
538  MSData dummy;
539  IO::write(writer, a, dummy);
540  if (os_) *os_ << oss.str() << endl;
541 
542  // read 'b' in from stream
543 
544  Spectrum b;
545  istringstream iss(oss.str());
546  IO::read(iss, b, IO::ReadBinaryData);
547  unit_assert(b.sourceFilePosition == 0); // not -1
548 
549  // compare 'a' and 'b'
550 
552  if (diff && os_) *os_ << "diff:\n" << diff << endl;
553  unit_assert(!diff);
554 
555  // test IgnoreBinaryData
556 
557  Spectrum c;
558  iss.seekg(0);
559  IO::read(iss, c); // default = IgnoreBinaryData
560  unit_assert(c.binaryDataArrayPtrs.empty());
561  unit_assert(c.sourceFilePosition == 0); // not -1
562 
563  a.binaryDataArrayPtrs.clear();
564  diff(a, c);
565  unit_assert(!diff);
566 }
567 
568 
570 {
571  if (os_) *os_ << "testChromatogram():\n";
572 
573  Chromatogram a;
574 
575  a.index = 123;
576  a.id = "goo";
577  a.defaultArrayLength = 666;
580  for (size_t i=0; i<a.defaultArrayLength; i++)
581  a.binaryDataArrayPtrs.back()->data.push_back(i);
582  a.binaryDataArrayPtrs.back()->set(MS_time_array);
584  for (size_t i=0; i<a.defaultArrayLength; i++)
585  a.binaryDataArrayPtrs.back()->data.push_back(i*2);
587  a.cvParams.push_back(MS_total_ion_current_chromatogram); // TODO: fix when CV has appropriate terms
588 
589  // write 'a' out to a stream
590 
591  ostringstream oss;
592  XMLWriter writer(oss);
593  IO::write(writer, a);
594  if (os_) *os_ << oss.str() << endl;
595 
596  // read 'b' in from stream
597 
598  Chromatogram b;
599  istringstream iss(oss.str());
600  IO::read(iss, b, IO::ReadBinaryData);
601  unit_assert(b.sourceFilePosition == 0); // not -1
602 
603  // compare 'a' and 'b'
604 
606  if (diff && os_) *os_ << "diff:\n" << diff << endl;
607  unit_assert(!diff);
608 
609  // test IgnoreBinaryData
610 
611  Chromatogram c;
612  iss.seekg(0);
613  IO::read(iss, c); // default = IgnoreBinaryData
614  unit_assert(c.binaryDataArrayPtrs.empty());
615  unit_assert(c.sourceFilePosition == 0); // not -1
616 
617  a.binaryDataArrayPtrs.clear();
618  diff(a, c);
619  unit_assert(!diff);
620 }
621 
622 
624 {
626 
627  SpectrumPtr spectrum1(new Spectrum);
628  spectrum1->id = "goober";
629  spectrum1->index = 0;
630  spectrum1->defaultArrayLength = 666;
631  spectrum1->userParams.push_back(UserParam("description1"));
632 
633  SpectrumPtr spectrum2(new Spectrum);
634  spectrum2->id = "raisinet";
635  spectrum2->index = 1;
636  spectrum2->defaultArrayLength = 667;
637  spectrum2->userParams.push_back(UserParam("description2"));
638 
639  a.spectra.push_back(spectrum1);
640  a.spectra.push_back(spectrum2);
641  a.dp = DataProcessingPtr(new DataProcessing("dp"));
642 
644 }
645 
646 
648 {
649  if (os_) *os_ << "testSpectrumListWithPositions()\n ";
650 
652 
653  SpectrumPtr spectrum1(new Spectrum);
654  spectrum1->id = "goober";
655  spectrum1->index = 0;
656  spectrum1->defaultArrayLength = 666;
657  spectrum1->userParams.push_back(UserParam("description1"));
658 
659  SpectrumPtr spectrum2(new Spectrum);
660  spectrum2->id = "raisinet";
661  spectrum2->index = 1;
662  spectrum2->defaultArrayLength = 667;
663  spectrum2->userParams.push_back(UserParam("description2"));
664 
665  a.spectra.push_back(spectrum1);
666  a.spectra.push_back(spectrum2);
667 
668  ostringstream oss;
669  XMLWriter writer(oss);
670  vector<stream_offset> positions;
671  MSData dummy;
672  IO::write(writer, a, dummy, BinaryDataEncoder::Config(), &positions);
673 
674  if (os_)
675  {
676  copy(positions.begin(), positions.end(), ostream_iterator<stream_offset>(*os_, " "));
677  *os_ << endl << oss.str() << endl;
678  *os_ << "\n\n";
679  }
680 
681  unit_assert(positions.size() == 2);
682  unit_assert(positions[0] == 27);
683  unit_assert(positions[1] == 179);
684 }
685 
686 
688 {
689  public:
690 
691  virtual Status update(const UpdateMessage& updateMessage)
692  {
693  indices_.push_back(updateMessage.iterationIndex);
694  return Status_Ok;
695  }
696 
697  const vector<size_t>& indices() const {return indices_;}
698 
699  private:
700  vector<size_t> indices_;
701 };
702 
703 
705 {
706  public:
707 
708  virtual Status update(const UpdateMessage& updateMessage)
709  {
710  if (updateMessage.iterationIndex == 5) return Status_Cancel;
711  indices_.push_back(updateMessage.iterationIndex);
712  return Status_Ok;
713  }
714 
715  const vector<size_t>& indices() const {return indices_;}
716 
717  private:
718  vector<size_t> indices_;
719 };
720 
721 
723 {
724  if (os_) *os_ << "testSpectrumListWriteProgress()\n ";
725 
727 
728  for (size_t i=0; i<11; i++)
729  {
730  SpectrumPtr spectrum(new Spectrum);
731  spectrum->id = "goober_" + lexical_cast<string>(i);
732  spectrum->index = i;
733  spectrum->defaultArrayLength = 666;
734  a.spectra.push_back(spectrum);
735  }
736 
737  ostringstream oss;
738  XMLWriter writer(oss);
739 
741  TestIterationListener& listener = *boost::static_pointer_cast<TestIterationListener>(listenerPtr);
742  IterationListenerRegistry registry;
743  registry.addListener(listenerPtr, 3); // callbacks: 0,2,5,8,10
744 
745  MSData dummy;
746  IO::write(writer, a, dummy, BinaryDataEncoder::Config(), 0, &registry);
747 
748  if (os_)
749  {
750  *os_ << "callback indices: ";
751  copy(listener.indices().begin(), listener.indices().end(),
752  ostream_iterator<size_t>(*os_, " "));
753  *os_ << "\n\n";
754  }
755 
756  unit_assert(listener.indices().size() == 5);
757  unit_assert(listener.indices()[0] == 0);
758  unit_assert(listener.indices()[1] == 2);
759  unit_assert(listener.indices()[2] == 5);
760  unit_assert(listener.indices()[3] == 8);
761  unit_assert(listener.indices()[4] == 10);
762 
763  // test #2, this time with cancel at index 6
764 
766  TestIterationListener_WithCancel& cancelListener = *boost::static_pointer_cast<TestIterationListener_WithCancel>(cancelListenerPtr);
767  IterationListenerRegistry registry2;
768  registry2.addListener(cancelListenerPtr, 3); // callbacks: 0,2, cancel at 5
769 
770  ostringstream oss2;
771  XMLWriter writer2(oss2);
772  IO::write(writer2, a, dummy, BinaryDataEncoder::Config(), 0, &registry2);
773 
774  if (os_)
775  {
776  *os_ << "callback indices: ";
777  copy(cancelListener.indices().begin(), cancelListener.indices().end(),
778  ostream_iterator<size_t>(*os_, " "));
779  *os_ << "\n\n";
780  }
781 
782  unit_assert(cancelListener.indices().size() == 2);
783  unit_assert(cancelListener.indices()[0] == 0);
784  unit_assert(cancelListener.indices()[1] == 2);
785 }
786 
787 
789 {
791 
792  ChromatogramPtr chromatogram1(new Chromatogram);
793  chromatogram1->id = "goober";
794  chromatogram1->index = 0;
795  chromatogram1->defaultArrayLength = 666;
796 
797  ChromatogramPtr chromatogram2(new Chromatogram);
798  chromatogram2->id = "raisinet";
799  chromatogram2->index = 1;
800  chromatogram2->defaultArrayLength = 667;
801 
802  a.chromatograms.push_back(chromatogram1);
803  a.chromatograms.push_back(chromatogram2);
804  a.dp = DataProcessingPtr(new DataProcessing("dp"));
805 
807 }
808 
809 
811 {
812  if (os_) *os_ << "testChromatogramListWithPositions()\n ";
813 
815 
816  ChromatogramPtr chromatogram1(new Chromatogram);
817  chromatogram1->id = "goober";
818  chromatogram1->index = 0;
819  chromatogram1->defaultArrayLength = 666;
820 
821  ChromatogramPtr chromatogram2(new Chromatogram);
822  chromatogram2->id = "raisinet";
823  chromatogram2->index = 1;
824  chromatogram2->defaultArrayLength = 667;
825 
826  a.chromatograms.push_back(chromatogram1);
827  a.chromatograms.push_back(chromatogram2);
828 
829  ostringstream oss;
830  XMLWriter writer(oss);
831  vector<stream_offset> positions;
832  IO::write(writer, a, BinaryDataEncoder::Config(), &positions);
833 
834  if (os_)
835  {
836  copy(positions.begin(), positions.end(), ostream_iterator<stream_offset>(*os_, " "));
837  *os_ << endl << oss.str() << endl;
838  *os_ << "\n\n";
839  }
840 
841  unit_assert(positions.size() == 2);
842  unit_assert(positions[0] == 31);
843  unit_assert(positions[1] == 113);
844 }
845 
846 
847 void testRun()
848 {
849  if (os_) *os_ << "testRun():\n";
850 
851  Run a;
852 
853  a.id = "goober";
855  a.samplePtr = SamplePtr(new Sample("sample"));
856  a.startTimeStamp = "20 April 2004 4:20pm";
858 
859  // spectrumList
860 
861  shared_ptr<SpectrumListSimple> spectrumListSimple(new SpectrumListSimple);
862 
863  SpectrumPtr spectrum1(new Spectrum);
864  spectrum1->id = "goober";
865  spectrum1->index = 0;
866  spectrum1->defaultArrayLength = 666;
867  spectrum1->userParams.push_back(UserParam("description1"));
868 
869  SpectrumPtr spectrum2(new Spectrum);
870  spectrum2->id = "raisinet";
871  spectrum2->index = 1;
872  spectrum2->defaultArrayLength = 667;
873  spectrum2->userParams.push_back(UserParam("description2"));
874 
875  spectrumListSimple->spectra.push_back(spectrum1);
876  spectrumListSimple->spectra.push_back(spectrum2);
877 
878  a.spectrumListPtr = spectrumListSimple;
879 
880  // chromatogramList
881 
882  shared_ptr<ChromatogramListSimple> chromatogramListSimple(new ChromatogramListSimple);
883 
884  ChromatogramPtr chromatogram1(new Chromatogram);
885  chromatogram1->id = "goober";
886  chromatogram1->index = 0;
887  chromatogram1->defaultArrayLength = 666;
888 
889  ChromatogramPtr chromatogram2(new Chromatogram);
890  chromatogram2->id = "raisinet";
891  chromatogram2->index = 1;
892  chromatogram2->defaultArrayLength = 667;
893 
894  chromatogramListSimple->chromatograms.push_back(chromatogram1);
895  chromatogramListSimple->chromatograms.push_back(chromatogram2);
896 
897  a.chromatogramListPtr = chromatogramListSimple;
898 
899  // write 'a' out to a stream
900 
901  MSData dummy;
902 
903  ostringstream oss;
904  XMLWriter writer(oss);
905  IO::write(writer, a, dummy);
906  if (os_) *os_ << oss.str() << endl;
907 
908  // read 'b' in from stream, ignoring SpectrumList (default)
909 
910  Run b;
911  istringstream iss(oss.str());
912  IO::read(iss, b, IO::IgnoreSpectrumList); // IO::IgnoreSpectrumList
913 
914  // compare 'a' and 'b'
915 
917  if (diff && os_) *os_ << "diff:\n" << diff << endl;
918  unit_assert(diff);
919  unit_assert(diff.a_b.spectrumListPtr.get());
920  unit_assert(diff.a_b.spectrumListPtr->size() == 1);
921  unit_assert(diff.a_b.spectrumListPtr->spectrum(0)->userParams.size() == 1);
922 
923  // read 'c' in from stream, reading SpectrumList
924 
925  Run c;
926  iss.seekg(0);
927  IO::read(iss, c, IO::ReadSpectrumList);
928 
929  // compare 'a' and 'c'
930 
931  diff(a,c);
932  if (diff && os_) *os_ << "diff:\n" << diff << endl;
933  unit_assert(!diff);
934 
935  // remove SpectrumList and ChromatogramList from a, and compare to b
936 
937  a.spectrumListPtr.reset();
938  a.chromatogramListPtr.reset();
939  diff(a, b);
940  unit_assert(!diff);
941 }
942 
943 
945 {
946  msd.accession = "test accession";
947  msd.id = "test id";
948 
949  // cvList
950 
951  msd.cvs.resize(1);
952  CV& cv = msd.cvs.front();
953  cv.URI = "http://psidev.sourceforge.net/ms/xml/mzdata/psi-ms.2.0.2.obo";
954  cv.id = "MS";
955  cv.fullName = "Proteomics Standards Initiative Mass Spectrometry Ontology";
956  cv.version = "2.0.2";
957 
958  // fileDescription
959 
961  fc.cvParams.push_back(MS_MSn_spectrum);
962  fc.userParams.push_back(UserParam("number of cats", "4"));
963 
964  SourceFilePtr sfp(new SourceFile);
965  sfp->id = "1";
966  sfp->name = "tiny1.RAW";
967  sfp->location = "file://F:/data/Exp01";
968  sfp->cvParams.push_back(MS_Thermo_RAW_format);
969  sfp->cvParams.push_back(CVParam(MS_SHA_1,"71be39fb2700ab2f3c8b2234b91274968b6899b1"));
970  msd.fileDescription.sourceFilePtrs.push_back(sfp);
971 
972  SourceFilePtr sfp_parameters(new SourceFile("sf_parameters", "parameters.par", "file:///C:/settings/"));
973  msd.fileDescription.sourceFilePtrs.push_back(sfp_parameters);
974 
975  msd.fileDescription.contacts.resize(1);
976  Contact& contact = msd.fileDescription.contacts.front();
977  contact.cvParams.push_back(CVParam(MS_contact_name, "William Pennington"));
978  contact.cvParams.push_back(CVParam(MS_contact_address,
979  "Higglesworth University, 12 Higglesworth Avenue, 12045, HI, USA"));
980  contact.cvParams.push_back(CVParam(MS_contact_URL, "http://www.higglesworth.edu/"));
981  contact.cvParams.push_back(CVParam(MS_contact_email, "wpennington@higglesworth.edu"));
982 
983  // paramGroupList
984 
985  ParamGroupPtr pg1(new ParamGroup);
986  pg1->id = "CommonMS1SpectrumParams";
987  pg1->cvParams.push_back(MS_positive_scan);
988  msd.paramGroupPtrs.push_back(pg1);
989 
990  ParamGroupPtr pg2(new ParamGroup);
991  pg2->id = "CommonMS2SpectrumParams";
992  pg2->cvParams.push_back(MS_positive_scan);
993  msd.paramGroupPtrs.push_back(pg2);
994 
995  // sampleList
996 
997  SamplePtr samplePtr(new Sample);
998  samplePtr->id = "1";
999  samplePtr->name = "Sample1";
1000  msd.samplePtrs.push_back(samplePtr);
1001 
1002  // instrumentConfigurationList
1003 
1004  InstrumentConfigurationPtr instrumentConfigurationPtr(new InstrumentConfiguration);
1005  instrumentConfigurationPtr->id = "LCQ Deca";
1006  instrumentConfigurationPtr->cvParams.push_back(MS_LCQ_Deca);
1007  instrumentConfigurationPtr->cvParams.push_back(CVParam(MS_instrument_serial_number,"23433"));
1008  instrumentConfigurationPtr->componentList.push_back(Component(MS_nanoelectrospray, 1));
1009  instrumentConfigurationPtr->componentList.push_back(Component(MS_quadrupole_ion_trap, 2));
1010  instrumentConfigurationPtr->componentList.push_back(Component(MS_electron_multiplier, 3));
1011 
1012  SoftwarePtr softwareXcalibur(new Software);
1013  softwareXcalibur->id = "Xcalibur";
1014  softwareXcalibur->set(MS_Xcalibur);
1015  softwareXcalibur->version = "2.0.5";
1016  instrumentConfigurationPtr->softwarePtr = softwareXcalibur;
1017 
1018  msd.instrumentConfigurationPtrs.push_back(instrumentConfigurationPtr);
1019 
1020  // softwareList
1021 
1022  SoftwarePtr softwareBioworks(new Software);
1023  softwareBioworks->id = "Bioworks";
1024  softwareBioworks->set(MS_Bioworks);
1025  softwareBioworks->version = "3.3.1 sp1";
1026 
1027  SoftwarePtr software_pwiz(new Software);
1028  software_pwiz->id = "pwiz";
1029  software_pwiz->set(MS_pwiz);
1030  software_pwiz->version = "1.0";
1031 
1032  msd.softwarePtrs.push_back(softwareBioworks);
1033  msd.softwarePtrs.push_back(software_pwiz);
1034  msd.softwarePtrs.push_back(softwareXcalibur);
1035 
1036  // dataProcessingList
1037 
1038  DataProcessingPtr dpXcalibur(new DataProcessing);
1039  dpXcalibur->id = "Xcalibur Processing";
1040 
1041  ProcessingMethod procXcal;
1042  procXcal.order = 1;
1043  procXcal.softwarePtr = softwareXcalibur;
1044  procXcal.cvParams.push_back(CVParam(MS_deisotoping, false));
1045  procXcal.cvParams.push_back(CVParam(MS_charge_deconvolution, false));
1046  procXcal.cvParams.push_back(CVParam(MS_peak_picking, true));
1047 
1048  dpXcalibur->processingMethods.push_back(procXcal);
1049 
1050  DataProcessingPtr dp_msconvert(new DataProcessing);
1051  dp_msconvert->id = "pwiz conversion";
1052 
1053  ProcessingMethod proc_msconvert;
1054  proc_msconvert.order = 2;
1055  proc_msconvert.softwarePtr = software_pwiz;
1056  proc_msconvert.cvParams.push_back(MS_Conversion_to_mzML);
1057 
1058  dp_msconvert->processingMethods.push_back(proc_msconvert);
1059 
1060  msd.dataProcessingPtrs.push_back(dpXcalibur);
1061  msd.dataProcessingPtrs.push_back(dp_msconvert);
1062 
1063  ScanSettingsPtr as1(new ScanSettings("as1"));
1064  as1->sourceFilePtrs.push_back(sfp_parameters);
1065  Target t1;
1066  t1.set(MS_m_z, 1000);
1067  Target t2;
1068  t2.set(MS_m_z, 1200);
1069  as1->targets.push_back(t1);
1070  as1->targets.push_back(t2);
1071  msd.scanSettingsPtrs.push_back(as1);
1072 
1073  // run
1074 
1075  msd.run.id = "Exp01";
1076  msd.run.defaultInstrumentConfigurationPtr = instrumentConfigurationPtr;
1077  msd.run.samplePtr = samplePtr;
1078  msd.run.startTimeStamp = "2007-06-27T15:23:45.00035";
1079  msd.run.defaultSourceFilePtr = sfp;
1080 
1081  shared_ptr<SpectrumListSimple> spectrumList(new SpectrumListSimple);
1082  msd.run.spectrumListPtr = spectrumList;
1083 
1084  spectrumList->spectra.push_back(SpectrumPtr(new Spectrum));
1085  spectrumList->spectra.push_back(SpectrumPtr(new Spectrum));
1086 
1087  Spectrum& s19 = *spectrumList->spectra[0];
1088  s19.id = "S19";
1089  s19.index = 0;
1090  s19.defaultArrayLength = 10;
1091  s19.cvParams.push_back(MS_MSn_spectrum);
1092  s19.set(MS_ms_level, 1);
1093  s19.cvParams.push_back(MS_centroid_spectrum);
1094  s19.cvParams.push_back(CVParam(MS_lowest_observed_m_z, 400.39));
1095  s19.cvParams.push_back(CVParam(MS_highest_observed_m_z, 1795.56));
1096  s19.cvParams.push_back(CVParam(MS_base_peak_m_z, 445.347));
1097  s19.cvParams.push_back(CVParam(MS_base_peak_intensity, 120053));
1098  s19.cvParams.push_back(CVParam(MS_total_ion_current, 1.66755e+007));
1099  s19.scanList.scans.push_back(Scan());
1100  Scan& s19scan = s19.scanList.scans.back();
1101  s19scan.instrumentConfigurationPtr = instrumentConfigurationPtr;
1102  s19scan.paramGroupPtrs.push_back(pg1);
1103  s19scan.cvParams.push_back(CVParam(MS_scan_start_time, 5.890500, UO_minute));
1104  s19scan.cvParams.push_back(CVParam(MS_filter_string, "+ c NSI Full ms [ 400.00-1800.00]"));
1105  s19scan.scanWindows.resize(1);
1106  ScanWindow& window = s19scan.scanWindows.front();
1107  window.cvParams.push_back(CVParam(MS_scan_window_lower_limit, 400.000000));
1108  window.cvParams.push_back(CVParam(MS_scan_window_upper_limit, 1800.000000));
1109 
1110  BinaryDataArrayPtr s19_mz(new BinaryDataArray);
1111  s19_mz->dataProcessingPtr = dpXcalibur;
1112  s19_mz->cvParams.push_back(MS_m_z_array);
1113  s19_mz->data.resize(10);
1114  for (int i=0; i<10; i++)
1115  s19_mz->data[i] = i;
1116 
1117  BinaryDataArrayPtr s19_intensity(new BinaryDataArray);
1118  s19_intensity->dataProcessingPtr = dpXcalibur;
1119  s19_intensity->cvParams.push_back(MS_intensity_array);
1120  s19_intensity->data.resize(10);
1121  for (int i=0; i<10; i++)
1122  s19_intensity->data[i] = 10-i;
1123 
1124  s19.binaryDataArrayPtrs.push_back(s19_mz);
1125  s19.binaryDataArrayPtrs.push_back(s19_intensity);
1126 
1127  Spectrum& s20 = *spectrumList->spectra[1];
1128  s20.id = "S20";
1129  s20.index = 1;
1130  s20.defaultArrayLength = 10;
1131 
1132  s20.cvParams.push_back(MS_MSn_spectrum);
1133  s20.set(MS_ms_level, 2);
1134 
1135  s20.cvParams.push_back(MS_centroid_spectrum);
1136  s20.cvParams.push_back(CVParam(MS_lowest_observed_m_z, 320.39));
1137  s20.cvParams.push_back(CVParam(MS_highest_observed_m_z, 1003.56));
1138  s20.cvParams.push_back(CVParam(MS_base_peak_m_z, 456.347));
1139  s20.cvParams.push_back(CVParam(MS_base_peak_intensity, 23433));
1140  s20.cvParams.push_back(CVParam(MS_total_ion_current, 1.66755e+007));
1141 
1142  s20.precursors.resize(1);
1143  Precursor& precursor = s20.precursors.front();
1144  precursor.spectrumID= s19.id;
1145  precursor.selectedIons.resize(1);
1146  precursor.selectedIons[0].cvParams.push_back(CVParam(MS_selected_ion_m_z, 445.34));
1147  precursor.selectedIons[0].cvParams.push_back(CVParam(MS_charge_state, 2));
1149  precursor.activation.cvParams.push_back(CVParam(MS_collision_energy, 35.00, UO_electronvolt));
1150 
1151  s20.scanList.scans.push_back(Scan());
1152  Scan& s20scan = s20.scanList.scans.back();
1153  s20scan.instrumentConfigurationPtr = instrumentConfigurationPtr;
1154  s20scan.paramGroupPtrs.push_back(pg2);
1155  s20scan.cvParams.push_back(CVParam(MS_scan_start_time, 5.990500, UO_minute));
1156  s20scan.cvParams.push_back(CVParam(MS_filter_string, "+ c d Full ms2 445.35@cid35.00 [ 110.00-905.00]"));
1157  s20scan.scanWindows.resize(1);
1158  ScanWindow& window2 = s20scan.scanWindows.front();
1159  window2.cvParams.push_back(CVParam(MS_scan_window_lower_limit, 110.000000));
1160  window2.cvParams.push_back(CVParam(MS_scan_window_upper_limit, 905.000000));
1161 
1162  BinaryDataArrayPtr s20_mz(new BinaryDataArray);
1163  s20_mz->dataProcessingPtr = dpXcalibur;
1164  s20_mz->cvParams.push_back(MS_m_z_array);
1165  s20_mz->data.resize(10);
1166  for (int i=0; i<10; i++)
1167  s20_mz->data[i] = i;
1168 
1169  BinaryDataArrayPtr s20_intensity(new BinaryDataArray);
1170  s20_intensity->dataProcessingPtr = dpXcalibur;
1171  s20_intensity->cvParams.push_back(MS_intensity_array);
1172  s20_intensity->data.resize(10);
1173  for (int i=0; i<10; i++)
1174  s20_intensity->data[i] = 10-i;
1175 
1176  s20.binaryDataArrayPtrs.push_back(s20_mz);
1177  s20.binaryDataArrayPtrs.push_back(s20_intensity);
1178 
1179  // chromatograms
1180 
1181  shared_ptr<ChromatogramListSimple> chromatogramList(new ChromatogramListSimple);
1182  msd.run.chromatogramListPtr = chromatogramList;
1183 
1184  chromatogramList->chromatograms.push_back(ChromatogramPtr(new Chromatogram));
1185 
1186  Chromatogram& tic = *chromatogramList->chromatograms[0];
1187  tic.id = "tic";
1188  tic.index = 0;
1189  tic.defaultArrayLength = 10;
1191 
1192  BinaryDataArrayPtr tic_time(new BinaryDataArray);
1193  tic_time->dataProcessingPtr = dp_msconvert;
1194  tic_time->cvParams.push_back(MS_time_array);
1195  tic_time->data.resize(10);
1196  for (int i=0; i<10; i++)
1197  tic_time->data[i] = i;
1198 
1199  BinaryDataArrayPtr tic_intensity(new BinaryDataArray);
1200  tic_intensity->dataProcessingPtr = dp_msconvert;
1201  tic_intensity->cvParams.push_back(MS_intensity_array);
1202  tic_intensity->data.resize(10);
1203  for (int i=0; i<10; i++)
1204  tic_intensity->data[i] = 10-i;
1205 
1206  tic.binaryDataArrayPtrs.push_back(tic_time);
1207  tic.binaryDataArrayPtrs.push_back(tic_intensity);
1208 }
1209 
1210 
1212 {
1213  if (os_) *os_ << "testMSData():\n";
1214 
1215  MSData a;
1216  initializeTestData(a);
1217 
1218  // write 'a' out to a stream
1219 
1220  ostringstream oss;
1221  XMLWriter writer(oss);
1222  IO::write(writer, a);
1223  if (os_) *os_ << oss.str() << endl;
1224 
1225  // read 'b' in from stream, ignoring SpectrumList (default)
1226 
1227  MSData b;
1228  istringstream iss(oss.str());
1229  IO::read(iss, b); // IO::IgnoreSpectrumList
1230 
1231  // compare 'a' and 'b'
1232 
1234  if (diff && os_) *os_ << "diff:\n" << diff << endl;
1235  unit_assert(diff);
1236  unit_assert(diff.a_b.run.spectrumListPtr.get());
1237  unit_assert(diff.a_b.run.spectrumListPtr->size() == 1);
1238  unit_assert(diff.a_b.run.spectrumListPtr->spectrum(0)->userParams.size() == 1);
1239 
1240  // read 'c' in from stream, reading SpectrumList
1241 
1242  MSData c;
1243  iss.seekg(0);
1244  IO::read(iss, c, IO::ReadSpectrumList);
1245 
1246  // compare 'a' and 'c'
1247 
1248  diff(a,c);
1249  if (diff && os_) *os_ << "diff:\n" << diff << endl;
1250  unit_assert(!diff);
1251 
1252  // remove SpectrumList and ChromatogramList from a, and compare to b
1253 
1254  a.run.spectrumListPtr.reset();
1255  a.run.chromatogramListPtr.reset();
1256  diff(a, b);
1257  unit_assert(!diff);
1258 }
1259 
1260 
1261 void test()
1262 {
1263  testCV();
1264  testUserParam();
1265  testCVParam();
1266  testParamGroup();
1267  testNamedParamContainer<FileContent>();
1268  testSourceFile();
1269  testNamedParamContainer<Contact>();
1271  testSample();
1272  testComponent();
1273  testComponentList();
1274  testSoftware();
1278  testNamedParamContainer<Target>();
1279  testScanSettings();
1280  testNamedParamContainer<IsolationWindow>();
1281  testNamedParamContainer<SelectedIon>();
1282  testNamedParamContainer<Activation>();
1283  testPrecursor();
1284  testProduct();
1285  testNamedParamContainer<ScanWindow>();
1286  testScan();
1287  testScanList();
1290  testSpectrum();
1291  testChromatogram();
1292  testSpectrumList();
1297  testRun();
1298  testMSData();
1299 }
1300 
1301 
1302 int main(int argc, char* argv[])
1303 {
1304  TEST_PROLOG_EX(argc, argv, "_MSData")
1305 
1306  try
1307  {
1308  if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
1309  test();
1310  if (os_) *os_ << "ok\n";
1311  }
1312  catch (exception& e)
1313  {
1314  TEST_FAILED(e.what())
1315  }
1316  catch (...)
1317  {
1318  TEST_FAILED("Caught unknown exception.")
1319  }
1320 
1321  TEST_EPILOG
1322 }
1323 
MS_contact_address
contact address: Postal address of the contact person or organization.
Definition: cv.hpp:2260
std::string id
the short label to be used as a reference tag with which to refer to this particular Controlled Vocab...
Definition: cv.hpp:13356
void testObject(const object_type &a)
Definition: IOTest.cpp:41
IsolationWindow isolationWindow
this element captures the isolation (or &#39;selection&#39;) window configured to isolate one or more precurs...
Definition: MSData.hpp:349
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
MS_deisotoping
deisotoping: The removal of isotope peaks to represent the fragment ion as one data point and is comm...
Definition: cv.hpp:202
MS_Bioworks
Bioworks: Thermo Finnigan software for data analysis of peptides and proteins.
Definition: cv.hpp:2053
MS_charge_state
charge state: The charge state of the ion, single or multiple and positive or negatively charged...
Definition: cv.hpp:235
std::vector< Product > products
list and descriptions of product ion information
Definition: MSData.hpp:522
This summarizes the different types of spectra that can be expected in the file. This is expected to ...
Definition: MSData.hpp:49
void testProcessingMethod()
Definition: IOTest.cpp:288
void testSample()
Definition: IOTest.cpp:193
void testComponentList()
Definition: IOTest.cpp:254
product ion information
Definition: MSData.hpp:346
MS_MSn_spectrum
MSn spectrum: MSn refers to multi-stage MS2 experiments designed to record product ion spectra where ...
Definition: cv.hpp:2212
Interface for accessing chromatograms, which may be stored in memory or backed by a data file (RAW...
Definition: MSData.hpp:752
void testUserParam()
Definition: IOTest.cpp:158
std::string id
a unique identifier for this chromatogram. It should be expected that external files may use this ide...
Definition: MSData.hpp:494
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
std::vector< SourceFilePtr > sourceFilePtrs
list and descriptions of the source files this mzML document was generated or derived from...
Definition: MSData.hpp:89
MS_total_ion_current_chromatogram
total ion current chromatogram: Chromatogram obtained by plotting the total ion current detected in e...
Definition: cv.hpp:955
const vector< size_t > & indices() const
Definition: IOTest.cpp:715
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
ComponentList componentList
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:234
ScanList scanList
list of scans
Definition: MSData.hpp:516
MS_isolation_window_lower_offset
isolation window lower offset: The extent of the isolation window in m/z below the isolation window t...
Definition: cv.hpp:3031
boost::shared_ptr< Software > SoftwarePtr
Definition: MSData.hpp:197
MS_base_peak_intensity
base peak intensity: The intensity of the greatest peak in the mass spectrum.
Definition: cv.hpp:1969
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:239
Description of the source file, including location and type.
Definition: MSData.hpp:53
void addListener(const IterationListenerPtr &listener, size_t iterationPeriod)
IgnoreSpectrumList
Definition: IO.hpp:212
void testSoftware()
Definition: IOTest.cpp:264
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
std::vector< InstrumentConfigurationPtr > instrumentConfigurationPtrs
list and descriptions of instrument configurations.
Definition: MSData.hpp:873
The method of precursor ion selection and activation.
Definition: MSData.hpp:310
Status_Ok
void testScan()
Definition: IOTest.cpp:378
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
Definition: MSData.hpp:826
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: MSData.hpp:525
MS_highest_observed_m_z
highest observed m/z: Highest m/z value observed in the m/z array.
Definition: cv.hpp:2035
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i...
Definition: MSData.hpp:130
SoftwarePtr softwarePtr
reference to a previously defined software element.
Definition: MSData.hpp:237
std::vector< ChromatogramPtr > chromatograms
Definition: MSData.hpp:788
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:569
MS_total_ion_current
total ion current: The sum of all the separate ion currents carried by the ions of different m/z cont...
Definition: cv.hpp:1255
MS_contact_URL
contact URL: Uniform Resource Locator related to the contact person or organization.
Definition: cv.hpp:2263
void testChromatogramListWithPositions()
Definition: IOTest.cpp:810
boost::shared_ptr< ScanSettings > ScanSettingsPtr
Definition: MSData.hpp:224
std::string value
the value for the parameter, where appropriate.
Definition: ParamTypes.hpp:191
void testChromatogramList()
Definition: IOTest.cpp:788
void testSpectrumListWithPositions()
Definition: IOTest.cpp:647
MS_scan_start_time
scan start time: The time that an analyzer started a scan, relative to the start of the MS run...
Definition: cv.hpp:148
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
std::vector< ProcessingMethod > processingMethods
description of the default peak processing method(s). This element describes the base method used in ...
Definition: MSData.hpp:278
std::vector< Precursor > precursors
list and descriptions of precursors to the spectrum currently being described.
Definition: MSData.hpp:519
#define TEST_EPILOG
Definition: unit.hpp:182
MS_positive_scan
positive scan: Polarity of the scan is positive.
Definition: cv.hpp:577
IsolationWindow isolationWindow
this element captures the isolation (or &#39;selection&#39;) window configured to isolate one or more precurs...
Definition: MSData.hpp:325
MS_nanoelectrospray
nanoelectrospray: Electrospray ionization at a flow rate less than ~25 nL/min. Nanoelectrospray is sy...
Definition: cv.hpp:1612
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
SoftwarePtr softwarePtr
this attribute MUST reference the &#39;id&#39; of the appropriate SoftwareType.
Definition: MSData.hpp:259
MS_Thermo_RAW_format
Thermo RAW format: Thermo Scientific RAW file format.
Definition: cv.hpp:2146
MS_electron_multiplier
electron multiplier: A device to amplify the current of a beam or packet of charged particles or phot...
Definition: cv.hpp:1060
MS_scan_window_upper_limit
scan window upper limit: The lower m/z bound of a mass spectrometer scan window.
Definition: cv.hpp:1954
Information about an ontology or CV source and a short &#39;lookup&#39; tag to refer to.
Definition: cv.hpp:13353
MS_collision_induced_dissociation
collision-induced dissociation: The dissociation of an ion after collisional excitation. The term collisional-activated dissociation is not recommended.
Definition: cv.hpp:586
size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: MSData.hpp:576
void testBinaryDataArray(const BinaryDataEncoder::Config &config)
Definition: IOTest.cpp:412
void initializeTestData(MSData &msd)
Definition: IOTest.cpp:944
void testFileDescription()
Definition: IOTest.cpp:214
size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
Definition: MSData.hpp:491
void testParamGroup()
Definition: IOTest.cpp:180
A single chromatogram.
Definition: MSData.hpp:573
FileDescription fileDescription
information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
Definition: MSData.hpp:858
FileContent fileContent
this summarizes the different types of spectra that can be expected in the file. This is expected to ...
Definition: MSData.hpp:86
MS_LCQ_Deca
LCQ Deca: ThermoFinnigan LCQ Deca.
Definition: cv.hpp:2119
std::vector< ScanSettingsPtr > scanSettingsPtrs
list with the descriptions of the acquisition settings applied prior to the start of data acquisition...
Definition: MSData.hpp:870
MS_ms_level
ms level: Stages of ms achieved in a multi stage mass spectrometry experiment.
Definition: cv.hpp:1987
float lexical_cast(const std::string &str)
MS_64_bit_float
64-bit float: 64-bit precision little-endian floating point conforming to IEEE-754.
Definition: cv.hpp:2023
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW...
Definition: MSData.hpp:656
MS_contact_email
contact email: Email address of the contact person or organization.
Definition: cv.hpp:2266
vector< size_t > indices_
Definition: IOTest.cpp:700
UO_second
second: A time unit which is equal to the duration of 9 192 631 770 periods of the radiation correspo...
Definition: cv.hpp:12526
std::string id
an optional id for the mzML document. It is recommended to use LSIDs when possible.
Definition: MSData.hpp:851
void testNamedParamContainer()
Definition: IOTest.cpp:192
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of an selected ion.
Definition: cv.hpp:2749
std::string id
a unique identifier for this run.
Definition: MSData.hpp:808
MS_filter_string
filter string: A string unique to Thermo instrument describing instrument settings for the scan...
Definition: cv.hpp:1990
MS_no_compression
no compression: No Compression.
Definition: cv.hpp:2185
DataProcessingPtr dataProcessingPtr
this optional attribute may reference the &#39;id&#39; attribute of the appropriate dataProcessing.
Definition: MSData.hpp:406
MS_intensity_array
intensity array: A data array of intensity values.
Definition: cv.hpp:1999
boost::shared_ptr< IterationListener > IterationListenerPtr
void diff(const string &filename1, const string &filename2)
MS_instrument_serial_number
instrument serial number: Serial Number of the instrument.
Definition: cv.hpp:2041
void testComponent()
Definition: IOTest.cpp:243
void testObject_ChromatogramList(const ChromatogramList &a)
Definition: IOTest.cpp:120
std::string fullName
the usual name for the resource (e.g. The PSI-MS Controlled Vocabulary).
Definition: cv.hpp:13362
MS_SHA_1
SHA-1: SHA-1 (Secure Hash Algorithm-1) is a cryptographic hash function designed by the National Secu...
Definition: cv.hpp:2164
void testScanList()
Definition: IOTest.cpp:393
SourceFilePtr defaultSourceFilePtr
default source file reference
Definition: MSData.hpp:820
MS_m_z_array
m/z array: A data array of m/z values.
Definition: cv.hpp:1996
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
std::string id
a unique identifier for this spectrum. It should be expected that external files may use this identif...
Definition: MSData.hpp:475
const char * bdaWithExternalMetadata
Definition: IOTest.cpp:459
MS_collision_energy
collision energy: Energy for an ion experiencing collision with a stationary gas particle resulting i...
Definition: cv.hpp:250
void testCV()
Definition: IOTest.cpp:93
size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: MSData.hpp:507
boost::iostreams::stream_offset sourceFilePosition
for file-based MSData implementations, this attribute may refer to the spectrum&#39;s position in the fil...
Definition: MSData.hpp:481
Description of the default peak processing method. This element describes the base method used in the...
Definition: MSData.hpp:253
void testPrecursor()
Definition: IOTest.cpp:345
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.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
std::string spectrumID
reference to the id attribute of the spectrum from which the precursor was selected.
Definition: MSData.hpp:322
int order
this attributes allows a series of consecutive steps to be placed in the correct order.
Definition: MSData.hpp:256
A run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:805
MS_time_array
time array: A data array of relative time offset values from a reference time.
Definition: cv.hpp:2287
std::string type
the datatype of the parameter, where appropriate (e.g.: xsd:float).
Definition: ParamTypes.hpp:194
void testMSData()
Definition: IOTest.cpp:1211
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:786
MS_m_z
m/z: Three-character symbol m/z is used to denote the quantity formed by dividing the mass of an ion ...
Definition: cv.hpp:223
MS_base_peak_m_z
base peak m/z: M/z value of the signal of highest intensity in the mass spectrum. ...
Definition: cv.hpp:1966
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
std::string accession
an optional accession number for the mzML document.
Definition: MSData.hpp:848
std::vector< Target > targets
target list (or &#39;inclusion list&#39;) configured prior to the run.
Definition: MSData.hpp:214
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:124
void testSpectrum()
Definition: IOTest.cpp:491
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
std::string id
a unique identifier for this data processing that is unique across all DataProcessingTypes.
Definition: MSData.hpp:275
Activation activation
the type and energy level used for activation.
Definition: MSData.hpp:331
std::string id
a unique identifier for this acquisition setting.
Definition: MSData.hpp:208
std::string URI
the URI for the resource.
Definition: cv.hpp:13359
std::vector< ScanWindow > scanWindows
container for a list of select windows.
Definition: MSData.hpp:386
virtual Status update(const UpdateMessage &updateMessage)
Definition: IOTest.cpp:691
void testScanSettings()
Definition: IOTest.cpp:324
MS_scan_window_lower_limit
scan window lower limit: The upper m/z bound of a mass spectrometer scan window.
Definition: cv.hpp:1957
std::string version
the software version.
Definition: MSData.hpp:184
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
std::vector< Contact > contacts
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:92
const vector< size_t > & indices() const
Definition: IOTest.cpp:697
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
Definition: MSData.hpp:472
MS_isolation_window_target_m_z
isolation window target m/z: The primary or reference m/z about which the isolation window is defined...
Definition: cv.hpp:3028
void testObject_SpectrumList(const SpectrumList &a)
Definition: IOTest.cpp:93
std::vector< CV > cvs
container for one or more controlled vocabulary definitions.
Definition: MSData.hpp:855
void testBinaryDataArrayExternalMetadata()
Definition: IOTest.cpp:466
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
Definition: ParamTypes.hpp:247
boost::iostreams::stream_offset sourceFilePosition
for file-based MSData implementations, this attribute may refer to the chromatogram&#39;s position in the...
Definition: MSData.hpp:497
void testInstrumentConfiguration()
Definition: IOTest.cpp:274
A piece of software.
Definition: MSData.hpp:178
std::string startTimeStamp
the optional start timestamp of the run, in UT.
Definition: MSData.hpp:817
std::string name
the name for the parameter.
Definition: ParamTypes.hpp:188
MS_reflectron_on
reflectron on: Reflectron is on.
Definition: cv.hpp:475
InstrumentConfigurationPtr instrumentConfigurationPtr
this attribute MUST reference the &#39;id&#39; attribute of the appropriate instrument configuration.
Definition: MSData.hpp:383
MS_sum_of_spectra
sum of spectra: Spectra Sum.
Definition: cv.hpp:2170
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
interface to be implemented by clients who want progress callbacks
std::vector< SourceFilePtr > sourceFilePtrs
container for a list of source file references.
Definition: MSData.hpp:211
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:324
UO_minute
minute: A time unit which is equal to 60 seconds.
Definition: cv.hpp:12589
std::vector< SamplePtr > samplePtrs
list and descriptions of samples.
Definition: MSData.hpp:864
std::vector< double > data
the binary data.
Definition: MSData.hpp:409
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
Definition: MSData.hpp:228
void testCVParam()
Definition: IOTest.cpp:170
CVID units
an optional CV parameter for the unit term associated with the value, if any (e.g. MS_electron_volt).
Definition: ParamTypes.hpp:197
boost::shared_ptr< InstrumentConfiguration > InstrumentConfigurationPtr
Definition: MSData.hpp:249
std::vector< Scan > scans
Definition: MSData.hpp:396
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:403
std::vector< SelectedIon > selectedIons
this list of precursor ions that were selected.
Definition: MSData.hpp:328
void testRun()
Definition: IOTest.cpp:847
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
#define TEST_PROLOG_EX(argc, argv, suffix)
Definition: unit.hpp:157
PWIZ_API_DECL void read(std::istream &is, CV &cv)
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the &#39;id&#39; of the appropriate dataProcessing.
Definition: MSData.hpp:579
std::vector< ParamGroupPtr > paramGroupPtrs
container for a list of referenceableParamGroups
Definition: MSData.hpp:861
encoding/decoding configuration
std::vector< SpectrumPtr > spectra
Definition: MSData.hpp:714
handles registration of IterationListeners and broadcast of update messages
#define TEST_FAILED(x)
Definition: unit.hpp:176
void testDataProcessing()
Definition: IOTest.cpp:300
std::vector< SoftwarePtr > softwarePtrs
list and descriptions of software used to acquire and/or process the data in this mzML file...
Definition: MSData.hpp:867
Description of the acquisition settings of the instrument prior to the start of the run...
Definition: MSData.hpp:205
MS_centroid_spectrum
centroid spectrum: Processing of profile data to produce spectra that contains discrete peaks of zero...
Definition: cv.hpp:559
std::vector< DataProcessingPtr > dataProcessingPtrs
list and descriptions of data processing applied to this data.
Definition: MSData.hpp:876
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: MSData.hpp:588
List and descriptions of scans.
Definition: MSData.hpp:394
ostream * os_
Definition: IOTest.cpp:38
void test()
Definition: IOTest.cpp:860
void testObjectWithMSData(const object_type &a, const MSData &msd)
Definition: IOTest.cpp:68
virtual Status update(const UpdateMessage &updateMessage)
Definition: IOTest.cpp:708
void testSourceFile()
Definition: IOTest.cpp:566
MS_pwiz
pwiz (ProteoWizard software): ProteoWizard software for data processing and analysis. Primarily developed by the labs of P. Malick and D. Tabb.
Definition: cv.hpp:2356
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
object_result_type a_b
Definition: diff_std.hpp:156
void testChromatogram()
Definition: IOTest.cpp:569
MS_quadrupole_ion_trap
quadrupole ion trap: Quadrupole Ion Trap mass analyzer captures the ions in a three dimensional ion t...
Definition: cv.hpp:385
Expansible description of the sample used to generate the dataset, named in sampleName.
Definition: MSData.hpp:100
UO_electronvolt
electronvolt: A non-SI unit of energy (eV) defined as the energy acquired by a single unbound electro...
Definition: cv.hpp:13288
MS_Xcalibur
Xcalibur: Thermo Finnigan software for data acquisition and analysis.
Definition: cv.hpp:2050
int main(int argc, char *argv[])
Definition: IOTest.cpp:910
SourceFilePtr sourceFilePtr
this attribute can optionally reference the &#39;id&#39; of the appropriate sourceFile.
Definition: MSData.hpp:513
void testProduct()
Definition: IOTest.cpp:366
boost::shared_ptr< Sample > SamplePtr
Definition: MSData.hpp:117
MS_reflectron_off
reflectron off: Reflectron is off.
Definition: cv.hpp:472
MS_charge_deconvolution
charge deconvolution: The determination of the mass of an ion based on the mass spectral peaks that r...
Definition: cv.hpp:205
MS_contact_name
contact name: Name of the contact person or organization.
Definition: cv.hpp:2257
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the &#39;id&#39; of the appropriate dataProcessing.
Definition: MSData.hpp:510
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
Definition: MSData.hpp:504
std::string version
the version of the CV from which the referred-to terms are drawn.
Definition: cv.hpp:13365
SamplePtr samplePtr
this attribute MUST reference the &#39;id&#39; of the appropriate sample.
Definition: MSData.hpp:814
MS_isolation_window_upper_offset
isolation window upper offset: The extent of the isolation window in m/z above the isolation window t...
Definition: cv.hpp:3034
MS_lowest_observed_m_z
lowest observed m/z: Lowest m/z value observed in the m/z array.
Definition: cv.hpp:2038
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
std::string id
an identifier for this instrument configuration.
Definition: MSData.hpp:231
void testSpectrumList()
Definition: IOTest.cpp:623
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:712
#define unit_assert(x)
Definition: unit.hpp:85
MS_Conversion_to_mzML
Conversion to mzML: Conversion of a file format to Proteomics Standards Initiative mzML file format...
Definition: cv.hpp:2089
void testSpectrumListWriteProgress()
Definition: IOTest.cpp:722
MS_peak_picking
peak picking: Spectral peak processing conducted on the acquired data to convert profile data to cent...
Definition: cv.hpp:208
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:620
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: MSData.hpp:416
Definition: cv.hpp:91
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
std::string id
an identifier for this software that is unique across all SoftwareTypes.
Definition: MSData.hpp:181
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition: MSData.hpp:75
InstrumentConfigurationPtr defaultInstrumentConfigurationPtr
this attribute MUST reference the &#39;id&#39; of the default instrument configuration. If a scan does not re...
Definition: MSData.hpp:811