ProteoWizard
DiffTest.cpp
Go to the documentation of this file.
1//
2// $Id$
3//
4//
5// Original author: Darren Kessner <darren@proteowizard.org>
6//
7// Copyright 2007 Spielberg Family Center for Applied Proteomics
8// Cedars-Sinai Medical Center, Los Angeles, California 90048
9//
10// Licensed under the Apache License, Version 2.0 (the "License");
11// you may not use this file except in compliance with the License.
12// You may obtain a copy of the License at
13//
14// http://www.apache.org/licenses/LICENSE-2.0
15//
16// Unless required by applicable law or agreed to in writing, software
17// distributed under the License is distributed on an "AS IS" BASIS,
18// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19// See the License for the specific language governing permissions and
20// limitations under the License.
21//
22
23#include "Diff.hpp"
24#include "TextWriter.hpp"
25#include "examples.hpp"
28#include <cstring>
29
30
31using namespace pwiz::util;
32using namespace pwiz::cv;
33using namespace pwiz::data;
34using namespace pwiz::data::diff_impl;
35using namespace pwiz::msdata;
36
37
38ostream* os_ = 0;
39
40
42{
43 if (os_) *os_ << "testFileContent()\n";
44
45 FileContent a, b;
46 a.userParams.push_back(UserParam("common"));
47 b.userParams.push_back(UserParam("common"));
48
51
52 a.userParams.push_back(UserParam("different", "1"));
53 b.userParams.push_back(UserParam("different", "2"));
54
55 diff(a, b);
56 if (os_) *os_ << diff << endl;
58
59 unit_assert(diff.a_b.userParams.size() == 1);
60 unit_assert(diff.a_b.userParams[0] == UserParam("different","1"));
61 unit_assert(diff.b_a.userParams.size() == 1);
62 unit_assert(diff.b_a.userParams[0] == UserParam("different","2"));
63}
64
65
67{
68 if (os_) *os_ << "testSourceFile()\n";
69
70 SourceFile a("id1","name1","location1"), b("id1","name1","location1");
71 a.userParams.push_back(UserParam("common"));
72 b.userParams.push_back(UserParam("common"));
73
76
77 b.location = "location2";
78 diff(a, b);
79 if (os_) *os_ << diff << endl;
81}
82
83
85{
86 if (os_) *os_ << "testFileDescription()\n";
87
88 FileDescription a, b;
89
90 a.fileContent.userParams.push_back(UserParam("user param 1"));
91 b.fileContent.userParams.push_back(UserParam("user param 1"));
92
93 Contact contact1, contact2, contact3, contact4;
94 contact1.cvParams.push_back(CVParam(MS_contact_name, "Darren"));
95 contact2.cvParams.push_back(CVParam(MS_contact_name, "Laura Jane"));
96 contact3.cvParams.push_back(CVParam(MS_contact_name, "Emma Lee"));
97 contact4.cvParams.push_back(CVParam(MS_contact_name, "Isabelle Lynn"));
98
99 // verify vector_diff_diff with differently ordered vectors
100 a.contacts.push_back(contact2);
101 a.contacts.push_back(contact1);
102 b.contacts.push_back(contact1);
103 b.contacts.push_back(contact2);
104
105 SourceFilePtr source1(new SourceFile("id1"));
106 SourceFilePtr source2a(new SourceFile("id2"));
107 SourceFilePtr source2b(new SourceFile("id2"));
108 source2a->cvParams.push_back(MS_Thermo_RAW_format);
109
110 a.sourceFilePtrs.push_back(source1);
111 b.sourceFilePtrs.push_back(source1);
112
115
116 a.contacts.push_back(contact3);
117 b.contacts.push_back(contact4);
118
119 a.sourceFilePtrs.push_back(source2a);
120 b.sourceFilePtrs.push_back(source2b);
121
122 diff(a, b);
123 if (os_) *os_ << diff << endl;
124
126 unit_assert(diff.a_b.contacts.size() == 1);
127 unit_assert(diff.a_b.contacts[0].cvParam(MS_contact_name).value == "Emma Lee");
128 unit_assert(diff.b_a.contacts.size() == 1);
129 unit_assert(diff.b_a.contacts[0].cvParam(MS_contact_name).value == "Isabelle Lynn");
130
131 unit_assert(diff.a_b.sourceFilePtrs.size() == 1);
132 unit_assert(diff.a_b.sourceFilePtrs[0]->hasCVParam(MS_Thermo_RAW_format));
133 unit_assert(diff.b_a.sourceFilePtrs.size() == 1);
134 unit_assert(!diff.b_a.sourceFilePtrs[0]->hasCVParam(MS_Thermo_RAW_format));
135}
136
137
139{
140 if (os_) *os_ << "testSample()\n";
141
142 Sample a("id1","name1"), b("id1","name1");
143 a.userParams.push_back(UserParam("common"));
144 b.userParams.push_back(UserParam("common"));
145
148
149 a.cvParams.push_back(MS_peak_intensity);
150 diff(a, b);
151 if (os_) *os_ << diff << endl;
153}
154
155
157{
158 if (os_) *os_ << "testComponent()\n";
159
160 Component a, b;
161 a.userParams.push_back(UserParam("common"));
162 b.userParams.push_back(UserParam("common"));
163
166
167 a.order = 420;
168 b.order = 421;
169 diff(a, b);
170 if (os_) *os_ << diff << endl;
172}
173
174
176{
177 if (os_) *os_ << "testSource()\n";
178
179 Component a, b;
180 a.userParams.push_back(UserParam("common"));
181 b.userParams.push_back(UserParam("common"));
182
185
186 a.order = 420;
187 b.order = 421;
188 diff(a, b);
189 if (os_) *os_ << diff << endl;
191}
192
193
195{
196 if (os_) *os_ << "testComponentList()\n";
197
198 ComponentList a, b;
199
200 a.push_back(Component(ComponentType_Source, 1));
201 b.push_back(Component(ComponentType_Source, 1));
202 a.push_back(Component(ComponentType_Analyzer, 2));
203 b.push_back(Component(ComponentType_Analyzer, 2));
204 a.push_back(Component(ComponentType_Detector, 3));
205 b.push_back(Component(ComponentType_Detector, 3));
206
207 a[0].userParams.push_back(UserParam("common"));
208 b[0].userParams.push_back(UserParam("common"));
209
212
213 a[1].userParams.push_back(UserParam("common"));
214 b[1].userParams.push_back(UserParam("common"));
215 a[1].userParams.push_back(UserParam("a only"));
216 b[1].userParams.push_back(UserParam("b only"));
217
218 a[2].userParams.push_back(UserParam("a only"));
219 b[2].userParams.push_back(UserParam("b only"));
220
221 diff(a, b);
222 if (os_) *os_ << diff << endl;
224}
225
226
228{
229 if (os_) *os_ << "testSoftware()\n";
230
231 Software a, b;
232
233 a.id = "msdata";
234 a.version = "4.20";
236 b = a;
237
240
241 b.version = "4.21";
242
243 diff(a, b);
244 if (os_) *os_ << diff << endl;
246}
247
248
250{
252
253 a.id = "LCQ Deca";
254 a.cvParams.push_back(MS_LCQ_Deca);
255 a.cvParams.push_back(CVParam(MS_instrument_serial_number, 23433));
259
260 b = a;
261
262 a.softwarePtr = SoftwarePtr(new Software("XCalibur"));
263 a.softwarePtr->version = "4.20";
264
265 b.softwarePtr = SoftwarePtr(new Software("XCalibur"));
266 b.softwarePtr->version = "4.20";
267
270
272 b.componentList.source(0).order = 2;
273 b.componentList.detector(0).order = 1;
274
275 diff(a, b);
276 if (os_) *os_ << diff << endl;
278}
279
280
282{
283 if (os_) *os_ << "testProcessingMethod()\n";
284
285 ProcessingMethod a, b;
286 a.userParams.push_back(UserParam("common"));
287 b.userParams.push_back(UserParam("common"));
288
291
292 a.order = 420;
293 b.order = 421;
294 diff(a, b);
295 if (os_) *os_ << diff << endl;
297
298 b.order = 420;
299 diff(a, b);
300 if (os_) *os_ << diff << endl;
302
303 a.softwarePtr = SoftwarePtr(new Software("pwiz"));
304 b.softwarePtr = SoftwarePtr(new Software("pwiz2"));
305 diff(a, b);
306 if (os_) *os_ << diff << endl;
308}
309
310
312{
313 if (os_) *os_ << "testDataProcessing()\n";
314
315 DataProcessing a, b;
316 a.id = "dp1";
317
318 b = a;
319
320 ProcessingMethod pm1, pm2, pm3;
321 pm1.userParams.push_back(UserParam("abc"));
322 pm2.userParams.push_back(UserParam("def"));
323 pm3.userParams.push_back(UserParam("ghi"));
324
325 pm1.softwarePtr = SoftwarePtr(new Software("msdata"));
326 pm1.softwarePtr->version = "4.20";
327
328 pm2.softwarePtr = SoftwarePtr(new Software("msdata"));
329 pm2.softwarePtr->version = "4.20";
330
331 a.processingMethods.push_back(pm1);
332 a.processingMethods.push_back(pm2);
333 b.processingMethods.push_back(pm2);
334 b.processingMethods.push_back(pm1);
335
338
339 pm2.softwarePtr = SoftwarePtr(new Software("Xcalibur"));
340 a.processingMethods.push_back(pm3);
341
342 diff(a, b);
343
344 if (os_) *os_ << diff << endl;
346}
347
348
350{
351 if (os_) *os_ << "testScanSettings()\n";
352
353 ScanSettings a, b;
354 a.id = "as1";
355
356 b = a;
357
360
361 b.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("source file")));
362 a.targets.resize(2);
363
364 diff(a, b);
365
366 if (os_) *os_ << diff << endl;
368 unit_assert(diff.a_b.sourceFilePtrs.empty());
369 unit_assert(diff.b_a.sourceFilePtrs.size() == 1);
370 unit_assert(diff.a_b.targets.size() == 2);
371 unit_assert(diff.b_a.targets.empty());
372}
373
374
376{
377 if (os_) *os_ << "testPrecursor()\n";
378
379 Precursor a, b;
380
381 a.spectrumID = "1234";
383 a.selectedIons.resize(1);
384 a.selectedIons[0].cvParams.push_back(MS_reflectron_on);
385 a.cvParams.push_back(MS_reflectron_off);
386 b = a;
387
390
391 a.cvParams.push_back(MS_reflectron_on);
392 a.selectedIons[0].userParams.push_back(UserParam("aaaa"));
393 b.activation.userParams.push_back(UserParam("bbbb"));
394 b.isolationWindow.set(MS_m_z, 200);
395
396 diff(a, b);
397
398 if (os_) *os_ << diff << endl;
400 unit_assert(!diff.a_b.selectedIons.empty());
401 unit_assert(!diff.a_b.selectedIons[0].userParams.empty());
402 unit_assert(!diff.b_a.selectedIons.empty());
403 unit_assert(diff.b_a.isolationWindow.cvParam(MS_m_z).valueAs<int>() == 200);
404}
405
406
408{
409 if (os_) *os_ << "testProduct()\n";
410
411 Product a, b;
412
414 b = a;
415
418
419 b.isolationWindow.set(MS_m_z, 200);
420
421 diff(a, b);
422
423 if (os_) *os_ << diff << endl;
425 unit_assert(diff.a_b.isolationWindow.cvParams.empty());
426 unit_assert(diff.b_a.isolationWindow.cvParams.size() == 1);
427}
428
429
431{
432 if (os_) *os_ << "testScan()\n";
433
434 Scan a, b;
435
437 ip->id = "LTQ FT";
438
439 a.cvParams.push_back(CVParam(MS_ionization_type, 420));
441 a.scanWindows.push_back(ScanWindow());
442 b = a;
443
446
447 b.scanWindows.push_back(ScanWindow(250.0, 2000.0, MS_m_z));
448 diff(a, b);
449
450 if (os_) *os_ << diff << endl;
452 unit_assert(diff.b_a.scanWindows.size() == 1);
453}
454
455
457{
458 if (os_) *os_ << "testScanList()\n";
459
460 ScanList a, b;
461
462 Scan a1;
463 a1.set(MS_filter_string, "booger");
464 a1.set(MS_scan_start_time, "4.20", UO_minute);
465
466 Scan a2;
467 a1.set(MS_filter_string, "goober");
468 a1.set(MS_scan_start_time, "6.66", UO_minute);
469
470 a.scans.push_back(a1);
471 a.scans.push_back(a2);
472 b.scans.push_back(a2);
473 b.scans.push_back(a1);
474
477
478 a.cvParams.push_back(MS_reflectron_on);
479
480 diff(a, b);
481
482 if (os_) *os_ << diff << endl;
484}
485
486
488{
489 if (os_) *os_ << "testBinaryDataArray()\n";
490
491 vector<double> data;
492 for (int i=0; i<10; i++) data.push_back(i);
493
494 BinaryDataArray a, b;
495 a.data = data;
497 b = a;
498
499 DiffConfig config;
500 config.precision = 1e-4;
501
502 a.data[9] = 1.00001e10;
503 b.data[9] = 1.00000e10;
504
505 // we want to verify relative precision diff (1e-5),
506 // not absolute diff (1e5)
507
509 if (diff && os_) *os_ << diff << endl;
511
512 b.data[9] = 1.0002e10;
513
514 diff(a, b);
515
516 if (diff && os_) *os_ << diff << endl;
518}
519
520
522{
523 if (os_) *os_ << "testSpectrum()\n";
524
525 Spectrum a, b;
526
527 a.id = "goober";
528 a.index = 1;
530 a.scanList.scans.push_back(Scan());
531 a.scanList.scans.back().instrumentConfigurationPtr = InstrumentConfigurationPtr(new InstrumentConfiguration("LTQ FT"));
532 a.scanList.scans.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("CommonMS1SpectrumParams")));
533 a.scanList.scans.back().cvParams.push_back(CVParam(MS_scan_start_time, 5.890500, UO_minute));
534 a.scanList.scans.back().cvParams.push_back(CVParam(MS_filter_string, "+ c NSI Full ms [ 400.00-1800.00]"));
535 a.scanList.scans.back().scanWindows.push_back(ScanWindow(400.0, 1800.0, MS_m_z));
536
537 b = a;
538
539 DiffConfig config;
540 config.precision = 1e-6;
541 Diff<Spectrum, DiffConfig> diff(a, b, config);
542 if (diff) cout << diff;
544
545 b.index = 4;
546 b.defaultArrayLength = 22;
548 b.sourceFilePtr = SourceFilePtr(new SourceFile("test.raw"));
549 a.precursors.push_back(Precursor());
550 a.precursors.back().spectrumID = "666";
551 b.products.push_back(Product());
552 b.products.back().isolationWindow.set(MS_ionization_type, 420);
554 a.binaryDataArrayPtrs.back()->data.resize(6);
556 b.binaryDataArrayPtrs.back()->data.resize(7);
558
559 diff(a, b);
560
561 if (os_) *os_ << diff << endl;
563
564 unit_assert(diff.a_b.index == 1);
565 unit_assert(diff.a_b.id == "goober");
566 unit_assert(diff.a_b.defaultArrayLength == 0);
567 unit_assert(diff.a_b.dataProcessingPtr->id == "msdata 2");
568 unit_assert(diff.a_b.precursors.size() == 1);
569 unit_assert(diff.a_b.products.empty());
570 unit_assert(diff.a_b.binaryDataArrayPtrs.empty());
571
572 unit_assert(diff.b_a.index == 4);
573 unit_assert(diff.b_a.id == "goober");
574 unit_assert(diff.b_a.defaultArrayLength == 22);
575 unit_assert(diff.b_a.dataProcessingPtr->id == "msdata");
576 unit_assert(diff.b_a.precursors.empty());
577 unit_assert(diff.b_a.products.size() == 1);
578 unit_assert(diff.b_a.binaryDataArrayPtrs.empty());
579
580 b = a;
581
582 unit_assert(a.binaryDataArrayPtrs.size() == 1);
584 b.binaryDataArrayPtrs[0]->data.resize(6);
585
586 a.binaryDataArrayPtrs[0]->data[0] = 420;
587 b.binaryDataArrayPtrs[0]->data[0] = 420 + 1e-12;
588
589 diff(a,b);
590 if (os_ && diff) *os_ << diff << endl;
592
593 b.binaryDataArrayPtrs[0]->data[0] += 1e-3;
594 diff(a,b);
595 if (os_ && diff) *os_ << diff << endl;
597}
598
599
601{
602 if (os_) *os_ << "testChromatogram()\n";
603
604 Chromatogram a, b;
605
606 a.id = "goober";
607 a.index = 1;
610 a.binaryDataArrayPtrs.back()->data.resize(6);
611
612 b = a;
613
614 DiffConfig config;
615 config.precision = 1e-6;
617 if (diff) cout << diff;
619
621 b.binaryDataArrayPtrs[0]->data.resize(6);
622
623 a.binaryDataArrayPtrs[0]->data[0] = 420;
624 b.binaryDataArrayPtrs[0]->data[0] = 420 + 1e-12;
625
626 diff(a,b);
627 if (os_ && diff) *os_ << diff << endl;
629
630 b.binaryDataArrayPtrs[0]->data[0] += 1e-3;
631 diff(a,b);
632 if (os_ && diff) *os_ << diff << endl;
634}
635
636
638{
639 if (os_) *os_ << "testSpectrumList()\n";
640
641 SpectrumListSimple aSimple, bSimple;
642
643 SpectrumPtr spectrum1a = SpectrumPtr(new Spectrum);
644 spectrum1a->id = "420";
645
646 SpectrumPtr spectrum1b = SpectrumPtr(new Spectrum);
647 spectrum1b->id = "420";
648
649 aSimple.spectra.push_back(spectrum1a);
650 bSimple.spectra.push_back(spectrum1b);
651
652 SpectrumList& a = aSimple;
653 SpectrumList& b = bSimple;
654
657
658 // check: dataProcessingPtr
659
660 aSimple.dp = DataProcessingPtr(new DataProcessing("dp"));
661 diff(a, b);
663
664 DiffConfig config_ignore;
665 config_ignore.ignoreDataProcessing = true;
666 Diff<SpectrumList, DiffConfig, SpectrumListSimple> diff_ignore(a, b, config_ignore);
667 unit_assert(!diff_ignore);
668
669 aSimple.dp = DataProcessingPtr();
670 diff(a, b);
672
673 // check: different SpectrumList::size()
674
675 SpectrumPtr spectrum2 = SpectrumPtr(new Spectrum);
676 spectrum2->id = "421";
677 aSimple.spectra.push_back(spectrum2);
678
679 diff(a, b);
680 if (os_) *os_ << diff << endl;
682 unit_assert(diff.a_b.spectra.size() == 1);
683 unit_assert(diff.a_b.spectra[0]->userParams.size() == 1);
684
685 // check: same SpectrumList::size(), different last scan number
686
687 SpectrumPtr spectrum3 = SpectrumPtr(new Spectrum);
688 spectrum3->id = "422";
689 bSimple.spectra.push_back(spectrum3);
690
691 diff(a, b);
692 if (os_) *os_ << diff << endl;
694 unit_assert(diff.a_b.spectra.size() == 1);
695 unit_assert(diff.a_b.spectra[0]->id == "421");
696 unit_assert(diff.b_a.spectra.size() == 1);
697 unit_assert(diff.b_a.spectra[0]->id == "422");
698
699 // check: scan numbers match, binary data slightly different
700
701 spectrum3->id = "421";
704 b1->data.resize(10);
705 b2->data.resize(10);
706 for (int i=0; i<10; i++)
707 b1->data[i] = b2->data[i] = i;
708 b2->data[2] += 1e-7;
709 spectrum2->binaryDataArrayPtrs.push_back(b1);
710 spectrum3->binaryDataArrayPtrs.push_back(b2);
711
712 DiffConfig config;
713 config.precision = 1e-6;
714
716 unit_assert(!diffWide);
717
718 config.precision = 1e-12;
720 if (os_) *os_ << diffNarrow << endl;
721 unit_assert(diffNarrow);
722}
723
724
726{
727 if (os_) *os_ << "testChromatogramList()\n";
728
729 ChromatogramListSimple aSimple, bSimple;
730
731 ChromatogramPtr chromatogram1a = ChromatogramPtr(new Chromatogram);
732 chromatogram1a->id = "420";
733
734 ChromatogramPtr chromatogram1b = ChromatogramPtr(new Chromatogram);
735 chromatogram1b->id = "420";
736
737 aSimple.chromatograms.push_back(chromatogram1a);
738 bSimple.chromatograms.push_back(chromatogram1b);
739
740 ChromatogramList& a = aSimple;
741 ChromatogramList& b = bSimple;
742
744 DiffConfig config_ignore;
745 config_ignore.ignoreChromatograms = true;
746
749 unit_assert(!diffIgnore);
750
751 // check: dataProcessingPtr
752
753 aSimple.dp = DataProcessingPtr(new DataProcessing("dp"));
754 diff(a, b);
756
757 DiffConfig config_ignore_dp;
758 config_ignore_dp.ignoreDataProcessing = true;
759 Diff<ChromatogramList, DiffConfig, ChromatogramListSimple> diff_ignore_dp(a, b, config_ignore_dp);
760 unit_assert(!diff_ignore_dp);
761
762 aSimple.dp = DataProcessingPtr();
763 diff(a, b);
765
766 // check: different ChromatogramList::size()
767
768 ChromatogramPtr chromatogram2 = ChromatogramPtr(new Chromatogram);
769 chromatogram2->id = "421";
770 aSimple.chromatograms.push_back(chromatogram2);
771
772 diff(a, b);
773 if (os_) *os_ << diff << endl;
775 unit_assert(diff.a_b.chromatograms.size() == 1);
776 unit_assert(diff.a_b.chromatograms[0]->userParams.size() == 1);
777
778 diffIgnore(a,b);
779 if (os_) *os_ << diffIgnore << endl;
780 unit_assert(!diffIgnore);
781
782 // check: same ChromatogramList::size(), different last scan number
783
784 ChromatogramPtr chromatogram3 = ChromatogramPtr(new Chromatogram);
785 chromatogram3->id = "422";
786 bSimple.chromatograms.push_back(chromatogram3);
787
788 diff(a, b);
789 if (os_) *os_ << diff << endl;
791 unit_assert(diff.a_b.chromatograms.size() == 1);
792 unit_assert(diff.a_b.chromatograms[0]->id == "421");
793 unit_assert(diff.b_a.chromatograms.size() == 1);
794 unit_assert(diff.b_a.chromatograms[0]->id == "422");
795
796 diffIgnore(a,b);
797 unit_assert(!diffIgnore);
798
799 // check: scan numbers match, binary data slightly different
800
801 chromatogram3->id = "421";
804 b1->data.resize(10);
805 b2->data.resize(10);
806 for (int i=0; i<10; i++)
807 b1->data[i] = b2->data[i] = i;
808 b2->data[2] += 1e-7;
809 chromatogram2->binaryDataArrayPtrs.push_back(b1);
810 chromatogram3->binaryDataArrayPtrs.push_back(b2);
811
812 DiffConfig config;
813 config.precision = 1e-6;
814
816 unit_assert(!diffWide);
817
818 config.precision = 1e-12;
820 if (os_) *os_ << diffNarrow << endl;
821 unit_assert(diffNarrow);
822
823 diffIgnore(a,b);
824 unit_assert(!diffIgnore);
825}
826
827
829{
830 if (os_) *os_ << "testRun()\n";
831
832 Run a, b;
833
834 a.id = "goober";
835 a.startTimeStamp = "20 April 2004 4:20pm";
836 b.id = "goober";
837 b.startTimeStamp = "20 April 2004 4:20pm";
838
841
842 b.id = "raisinet";
843
844 shared_ptr<SpectrumListSimple> spectrumList1(new SpectrumListSimple);
845 spectrumList1->spectra.push_back(SpectrumPtr(new Spectrum));
846 spectrumList1->spectra.back()->id = "spectrum1";
847 a.spectrumListPtr = spectrumList1;
848
849 shared_ptr<ChromatogramListSimple> chromatogramList1(new ChromatogramListSimple);
850 chromatogramList1->chromatograms.push_back(ChromatogramPtr(new Chromatogram));
851 chromatogramList1->chromatograms.back()->id = "chromatogram1";
852 b.chromatogramListPtr = chromatogramList1;
853
854 // same ref id
857
858 b.samplePtr = SamplePtr(new Sample("sample"));
859 a.defaultSourceFilePtr = SourceFilePtr(new SourceFile("source file"));
860
861 diff(a, b);
862 if (os_) *os_ << diff << endl;
864
865 unit_assert(diff.a_b.spectrumListPtr->size() == 1);
866 unit_assert(diff.a_b.spectrumListPtr->spectrum(0)->userParams.size() == 1);
867
868 unit_assert(diff.a_b.chromatogramListPtr.get());
869 unit_assert(diff.a_b.chromatogramListPtr->size() == 1);
870 unit_assert(diff.a_b.chromatogramListPtr->chromatogram(0)->userParams.size() == 1);
871
872 unit_assert(!diff.a_b.defaultInstrumentConfigurationPtr.get());
873 unit_assert(!diff.b_a.defaultInstrumentConfigurationPtr.get());
874
875 unit_assert(!diff.a_b.samplePtr.get());
876 unit_assert(!diff.b_a.samplePtr->empty());
877
878 unit_assert(diff.a_b.defaultSourceFilePtr.get());
879 unit_assert(!diff.b_a.defaultSourceFilePtr.get());
880
881 unit_assert(diff.a_b.startTimeStamp.empty());
882 unit_assert(diff.b_a.startTimeStamp.empty());
883}
884
885
886struct MSDataWithSettableVersion : public MSData {using MSData::version; void version(const string& v) {version_ = v;}};
887
889{
890 if (os_) *os_ << "testMSData()\n";
891
893
894 a.id = "goober";
895 b.id = "goober";
896
899
900 a.accession = "different";
901 b.version("version");
902 a.cvs.push_back(CV());
904 a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
905 b.samplePtrs.push_back(SamplePtr(new Sample("sample")));
906 a.instrumentConfigurationPtrs.push_back(InstrumentConfigurationPtr(new InstrumentConfiguration("instrumentConfiguration")));
907 b.softwarePtrs.push_back(SoftwarePtr(new Software("software")));
908 a.dataProcessingPtrs.push_back(DataProcessingPtr(new DataProcessing("dataProcessing")));
909 b.run.id = "run";
910 b.scanSettingsPtrs.push_back(ScanSettingsPtr(new ScanSettings("scanSettings")));
911
912 diff(a, b);
913 if (os_) *os_ << diff << endl;
915
916 unit_assert(diff.a_b.accession == "different");
917 unit_assert(diff.b_a.accession.empty());
918
919 unit_assert(diff.a_b.id == (a.id + " (" + a.version() + ")"));
920 unit_assert(diff.b_a.id == (b.id + " (" + b.version() + ")"));
921
922 unit_assert(diff.a_b.cvs.size() == 1);
923 unit_assert(diff.b_a.cvs.empty());
924
925 unit_assert(diff.a_b.fileDescription.empty());
926 unit_assert(!diff.b_a.fileDescription.empty());
927
928 unit_assert(!diff.a_b.paramGroupPtrs.empty());
929 unit_assert(diff.b_a.paramGroupPtrs.empty());
930
931 unit_assert(diff.a_b.samplePtrs.empty());
932 unit_assert(!diff.b_a.samplePtrs.empty());
933
934 unit_assert(!diff.a_b.instrumentConfigurationPtrs.empty());
935 unit_assert(diff.b_a.instrumentConfigurationPtrs.empty());
936
937 unit_assert(diff.a_b.softwarePtrs.empty());
938 unit_assert(!diff.b_a.softwarePtrs.empty());
939
940 unit_assert(!diff.a_b.dataProcessingPtrs.empty());
941 unit_assert(diff.b_a.dataProcessingPtrs.empty());
942
943 unit_assert(diff.a_b.run.empty());
944 unit_assert(!diff.b_a.run.empty());
945
946 unit_assert(diff.a_b.scanSettingsPtrs.empty());
947 unit_assert(!diff.b_a.scanSettingsPtrs.empty());
948}
949
950
952{
953 MSData tiny;
955
956 MSData tinier;
959 tinier.run.spectrumListPtr = sl;
960 tinier.run.chromatogramListPtr = cl;
961
962 for (unsigned int i=0; i<tiny.run.spectrumListPtr->size(); i++)
963 {
964 SpectrumPtr from = tiny.run.spectrumListPtr->spectrum(i, true);
965 sl->spectra.push_back(SpectrumPtr(new Spectrum));
966 SpectrumPtr& to = sl->spectra.back();
967
968 for (vector<BinaryDataArrayPtr>::const_iterator it=from->binaryDataArrayPtrs.begin();
969 it!=from->binaryDataArrayPtrs.end(); ++it)
970 {
971 // copy BinaryDataArray::data from tiny to tinier
972 to->binaryDataArrayPtrs.push_back(BinaryDataArrayPtr(new BinaryDataArray));
973 to->binaryDataArrayPtrs.back()->data = (*it)->data;
974 }
975
976 // copy "important" scan metadata
977
978 to->defaultArrayLength = from->defaultArrayLength;
979 to->scanList = from->scanList;
980
981 to->precursors.resize(from->precursors.size());
982 for (size_t precursorIndex=0; precursorIndex<from->precursors.size(); ++precursorIndex)
983 {
984 Precursor& precursorTo = to->precursors[precursorIndex];
985 Precursor& precursorFrom = from->precursors[precursorIndex];
986 precursorTo.selectedIons = precursorFrom.selectedIons;
987 }
988 }
989
990 for (unsigned int i=0; i<tiny.run.chromatogramListPtr->size(); i++)
991 {
992 ChromatogramPtr from = tiny.run.chromatogramListPtr->chromatogram(i, true);
993 cl->chromatograms.push_back(ChromatogramPtr(new Chromatogram));
994 ChromatogramPtr& to = cl->chromatograms.back();
995
996 for (vector<BinaryDataArrayPtr>::const_iterator it=from->binaryDataArrayPtrs.begin();
997 it!=from->binaryDataArrayPtrs.end(); ++it)
998 {
999 // copy BinaryDataArray::data from tiny to tinier
1000 to->binaryDataArrayPtrs.push_back(BinaryDataArrayPtr(new BinaryDataArray));
1001 to->binaryDataArrayPtrs.back()->data = (*it)->data;
1002 }
1003
1004 // copy "important" scan metadata
1005
1006 to->defaultArrayLength = from->defaultArrayLength;
1007 }
1008
1009 if (os_)
1010 {
1011 *os_ << "tinier::";
1012 TextWriter(*os_,0)(tinier);
1013 }
1014
1015 Diff<MSData, DiffConfig> diff_full(tiny, tinier);
1016 unit_assert(diff_full);
1017
1018 DiffConfig config;
1019 config.ignoreMetadata = true;
1020 config.ignoreIdentity = true;
1021
1022 Diff<MSData, DiffConfig> diff_data(tiny, tinier, config);
1023 if (os_ && diff_data) *os_ << diff_data << endl;
1024 unit_assert(!diff_data);
1025}
1026
1027
1028static const char* userParamName_MaxBinaryDataArrayDifference_ = "Maximum binary data array difference";
1029
1030// gets value of MaxBinaryDataArrayDifference userParam if present, else 0
1031template <typename list_type>
1032double getMaxPrecisionDiff(const list_type& list)
1033{
1034 if (list.dp.get() &&
1035 !list.dp->processingMethods.empty() &&
1036 !list.dp->processingMethods.back().userParam(userParamName_MaxBinaryDataArrayDifference_).empty())
1037 return lexical_cast<double>(list.dp->processingMethods.back().userParam(userParamName_MaxBinaryDataArrayDifference_).value);
1038 return 0;
1039}
1040
1041
1043
1044{
1045 if (os_)
1046 {
1047 *os_ <<"testMaxPrecisionDiff()\n";
1048 }
1049
1050 double epsilon = numeric_limits<double>::epsilon();
1051
1058
1059 std::vector<double> data1;
1060 std::vector<double> data2;
1061
1062 data1.push_back(3.0);
1063 data2.push_back(3.0000001);
1064
1065 e->data = data1;
1066 f->data = data2;
1067
1068 DiffConfig config;
1069 config.precision=1e-6;
1070
1071 Diff<BinaryDataArray, DiffConfig> diff_toosmall(*e,*f,config);
1072
1073 //not diff for diff of 1e-7
1074 unit_assert(!diff_toosmall);
1075
1076 data1.push_back(2.0);
1077 data2.push_back(2.0001);
1078
1079 c->data = data1;
1080 d->data = data2;
1081
1082 data1.push_back(1.0);
1083 data2.push_back(1.001);
1084
1085 a->data = data1;
1086 b->data = data2;
1087
1089
1090 //diff
1092
1093 if(os_) *os_<<diff<<endl;
1094
1095
1096 Diff<BinaryDataArray, DiffConfig> diff2(*c,*d,config);
1097
1098 //diff
1099 unit_assert(diff2);
1100
1101 if(os_) *os_<<diff2<<endl;
1102
1103 // BinaryDataArray UserParam is set
1104 unit_assert(!diff.a_b.userParams.empty());
1105 unit_assert(!diff.b_a.userParams.empty());
1106
1107 // and correctly
1108 double maxBin_a_b=boost::lexical_cast<double>(diff.a_b.userParam("Binary data array difference").value);
1109 double maxBin_b_a=boost::lexical_cast<double>(diff.a_b.userParam("Binary data array difference").value);
1110
1111 unit_assert_equal(maxBin_a_b,.001,epsilon);
1112 unit_assert_equal(maxBin_b_a,.001,epsilon);
1113
1114 Run run_a, run_b;
1115
1116 shared_ptr<SpectrumListSimple> sls_a(new SpectrumListSimple);
1117 shared_ptr<SpectrumListSimple> sls_b(new SpectrumListSimple);
1118
1119 SpectrumPtr spa(new Spectrum);
1120 SpectrumPtr spb(new Spectrum);
1121 SpectrumPtr spc(new Spectrum);
1122 SpectrumPtr spd(new Spectrum);
1123
1124 spa->binaryDataArrayPtrs.push_back(a);
1125 spb->binaryDataArrayPtrs.push_back(b);
1126 spc->binaryDataArrayPtrs.push_back(c);
1127 spd->binaryDataArrayPtrs.push_back(d);
1128
1129 sls_a->spectra.push_back(spa);
1130 sls_a->spectra.push_back(spc);
1131 sls_b->spectra.push_back(spb);
1132 sls_b->spectra.push_back(spc);
1133
1134 shared_ptr<ChromatogramListSimple> cls_a(new ChromatogramListSimple);
1135 shared_ptr<ChromatogramListSimple> cls_b(new ChromatogramListSimple);
1136
1141
1142 cpa->binaryDataArrayPtrs.push_back(a);
1143 cpb->binaryDataArrayPtrs.push_back(b);
1144 cpc->binaryDataArrayPtrs.push_back(c);
1145 cpd->binaryDataArrayPtrs.push_back(d);
1146
1147 cls_a->chromatograms.push_back(cpa);
1148 cls_a->chromatograms.push_back(cpc);
1149 cls_b->chromatograms.push_back(cpb);
1150 cls_b->chromatograms.push_back(cpd);
1151
1152 run_a.spectrumListPtr = sls_a;
1153 run_b.spectrumListPtr = sls_b;
1154
1155 run_a.chromatogramListPtr = cls_a;
1156 run_b.chromatogramListPtr = cls_b;
1157
1158 // Run user param is written for both Spectrum and Chromatogram binary data array difference user params, if present, with the correct value (max of the Spectrum and Chromatogram user params over the SpectrumList/ ChromatogramList respectively)
1159
1160 Diff<Run, DiffConfig> diff_run(run_a,run_b,config);
1161
1162 // diff
1163
1164 unit_assert(diff_run);
1165
1166
1167 // Run user params are set
1168
1169 unit_assert(!diff_run.a_b.userParams.empty());
1170 unit_assert(!diff_run.b_a.userParams.empty());
1171
1172
1173 // and correctly
1174
1175 double maxSpecList_a_b=boost::lexical_cast<double>(diff_run.a_b.userParam("Spectrum binary data array difference").value);
1176 double maxSpecList_b_a=boost::lexical_cast<double>(diff_run.b_a.userParam("Spectrum binary data array difference").value);
1177
1178 double maxChrList_a_b=boost::lexical_cast<double>(diff_run.a_b.userParam("Chromatogram binary data array difference").value);
1179 double maxChrList_b_a=boost::lexical_cast<double>(diff_run.b_a.userParam("Chromatogram binary data array difference").value);
1180
1181 unit_assert_equal(maxSpecList_a_b,.001,epsilon);
1182 unit_assert_equal(maxSpecList_b_a,.001,epsilon);
1183 unit_assert_equal(maxChrList_a_b,.001,epsilon);
1184 unit_assert_equal(maxChrList_b_a,.001,epsilon);
1185
1186 // test that Spectrum UserParam is written upon finding a binary data diff, with the correct value
1187
1188 // user params are set
1189 unit_assert(!diff_run.a_b.spectrumListPtr->spectrum(0)->userParams.empty());
1190 unit_assert(!diff_run.b_a.spectrumListPtr->spectrum(0)->userParams.empty()); //user params are set
1191
1192 // and correctly
1193
1194 double maxSpec_a_b=boost::lexical_cast<double>(diff_run.a_b.spectrumListPtr->spectrum(0)->userParam("Binary data array difference").value);
1195 double maxSpec_b_a=boost::lexical_cast<double>(diff_run.b_a.spectrumListPtr->spectrum(0)->userParam("Binary data array difference").value);
1196
1197 unit_assert_equal(maxSpec_a_b,.001,epsilon);
1198 unit_assert_equal(maxSpec_b_a,.001,epsilon);
1199
1200
1201 // test that Chromatogram UserParam is written upon finding a binary data diff, with the correct value
1202
1203 // user params are set
1204 unit_assert(!diff_run.a_b.chromatogramListPtr->chromatogram(0)->userParams.empty());
1205 unit_assert(!diff_run.b_a.chromatogramListPtr->chromatogram(0)->userParams.empty());
1206
1207 // and correctly
1208
1209 double maxChr_a_b=boost::lexical_cast<double>(diff_run.a_b.chromatogramListPtr->chromatogram(0)->userParam("Binary data array difference").value);
1210 double maxChr_b_a=boost::lexical_cast<double>(diff_run.b_a.chromatogramListPtr->chromatogram(0)->userParam("Binary data array difference").value);
1211
1212 unit_assert_equal(maxChr_a_b,.001,epsilon);
1213 unit_assert_equal(maxChr_b_a,.001,epsilon);
1214
1215 if(os_) *os_<<diff_run<<endl;
1216
1217
1218
1219 // test that maxPrecisionDiff is being returned correctly for a zero diff within diff_impl::diff(SpectrumList, SpectrumList, SpectrumList, SpectrumList, DiffConfig)
1220
1221 shared_ptr<SpectrumListSimple> sls_a_a(new SpectrumListSimple);
1222 shared_ptr<SpectrumListSimple> sls_A_A(new SpectrumListSimple);
1223
1224 pwiz::data::diff_impl::diff(*sls_a, *sls_a,*sls_a_a,*sls_A_A,config);
1225 double maxPrecisionNonDiffSpec = getMaxPrecisionDiff(*sls_a_a);
1226 unit_assert_equal(maxPrecisionNonDiffSpec,0,epsilon);
1227
1228
1229 // test that maxPrecisionDiff is being returned correctly for a non-zero diff within diff_impl::diff(SpectrumList, SpectrumList, SpectrumList, SpectrumList, DiffConfig)
1230
1231 shared_ptr<SpectrumListSimple> sls_a_b(new SpectrumListSimple);
1232 shared_ptr<SpectrumListSimple> sls_b_a(new SpectrumListSimple);
1233
1234 pwiz::data::diff_impl::diff(*sls_a, *sls_b,*sls_a_b,*sls_b_a,config);
1235 double maxPrecisionDiffSpec = getMaxPrecisionDiff(*sls_a_b);
1236 unit_assert_equal(maxPrecisionDiffSpec,.001,epsilon);
1237
1238
1239 // test that maxPrecisionDiff is being returned correctly for a zero diff within diff_impl::diff(ChromatogramList, ChromatogramList, ChromatogramList, ChromatogramList, DiffConfig)
1240
1241 shared_ptr<ChromatogramListSimple> cls_a_a(new ChromatogramListSimple);
1242 shared_ptr<ChromatogramListSimple> cls_A_A(new ChromatogramListSimple);
1243
1244 pwiz::data::diff_impl::diff(*cls_a, *cls_a,*cls_a_a,*cls_A_A,config);
1245 double maxPrecisionNonDiffChr = getMaxPrecisionDiff(*cls_a_a);
1246 unit_assert_equal(maxPrecisionNonDiffChr,0,epsilon);
1247
1248 // test that maxPrecisionDiff is being returned correctly for a non-zero diff within diff_impl::diff(ChromatogramList, ChromatogramList, ChromatogramList, ChromatogramList, DiffConfig)
1249
1250 shared_ptr<ChromatogramListSimple> cls_a_b(new ChromatogramListSimple);
1251 shared_ptr<ChromatogramListSimple> cls_b_a(new ChromatogramListSimple);
1252
1253 pwiz::data::diff_impl::diff(*cls_a,*cls_b,*cls_a_b,*cls_b_a,config);
1254 double maxPrecisionDiffChr = getMaxPrecisionDiff(*cls_a_b);
1255 unit_assert_equal(maxPrecisionDiffChr,.001,epsilon);
1256
1257
1258}
1259
1260
1262{
1263 if(os_) *os_<<"testMSDiffUpdate()"<<endl;
1264
1265 MSData tiny1;
1266 MSData tiny2;
1267
1270
1271 Diff<MSData, DiffConfig> diff_initial(tiny1,tiny2);
1272 unit_assert(!diff_initial);
1273
1274 //inflict metadata differences
1275
1276 tiny1.id="ego";
1277 tiny1.run.id="superego";
1278
1279 //inflict spectral differences
1280
1281 SpectrumPtr tiny1_s0 = tiny1.run.spectrumListPtr->spectrum(0);
1282 SpectrumPtr tiny2_s1 = tiny2.run.spectrumListPtr->spectrum(1);
1283
1284 tiny1_s0->id = "tiny1";
1285 tiny2_s1->id = "tiny2";
1286
1287 //inflict chromatogram differences
1288
1289 ChromatogramPtr tiny1_c0=tiny1.run.chromatogramListPtr->chromatogram(0);
1290
1291 tiny1_c0->id="zumas";
1292
1293 //test metadata, spectral, chromatogram differences
1294
1295 Diff<MSData, DiffConfig> diff_changed(tiny1,tiny2);
1296 unit_assert(diff_changed);
1297
1298 if(os_) *os_<<diff_changed<<endl;
1299
1300 tiny1.run.spectrumListPtr.reset();
1301
1302 Diff<MSData, DiffConfig> diff_changed_changed(tiny1,tiny2);
1303 unit_assert(diff_changed_changed);
1304
1305 if(os_) *os_<<diff_changed_changed<<endl;
1306}
1307
1308
1338
1339
1340int main(int argc, char* argv[])
1341{
1342 TEST_PROLOG_EX(argc, argv, "_MSData")
1343
1344 try
1345 {
1346 if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
1347 test();
1348 }
1349 catch (exception& e)
1350 {
1351 TEST_FAILED(e.what())
1352 }
1353 catch (...)
1354 {
1355 TEST_FAILED("Caught unknown exception.")
1356 }
1357
1359}
1360
Interface for accessing chromatograms, which may be stored in memory or backed by a data file (RAW,...
Definition MSData.hpp:757
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW,...
Definition MSData.hpp:661
MS_instrument_serial_number
instrument serial number: Serial Number of the instrument.
Definition cv.hpp:2193
MS_Thermo_RAW_format
Thermo RAW format: Thermo Scientific RAW file format.
Definition cv.hpp:2298
UO_minute
minute: A time unit which is equal to 60 seconds.
Definition cv.hpp:13896
MS_quadrupole_ion_trap
quadrupole ion trap: Quadrupole Ion Trap mass analyzer captures the ions in a three dimensional ion t...
Definition cv.hpp:546
MS_reflectron_on
reflectron on: Reflectron is on.
Definition cv.hpp:636
MS_nanoelectrospray
nanoelectrospray: Electrospray ionization at a flow rate less than ~25 nL/min. Nanoelectrospray is sy...
Definition cv.hpp:1764
MS_filter_string
filter string: A string unique to Thermo instrument describing instrument settings for the scan.
Definition cv.hpp:2142
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:384
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:309
MS_LCQ_Deca
LCQ Deca: ThermoFinnigan LCQ Deca.
Definition cv.hpp:2271
MS_electron_multiplier
electron multiplier: A device to amplify the current of a beam or packet of charged particles or phot...
Definition cv.hpp:1212
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition cv.hpp:285
MS_contact_name
contact name: Name of the contact person or organization.
Definition cv.hpp:2409
MS_reflectron_off
reflectron off: Reflectron is off.
Definition cv.hpp:633
MS_peak_intensity
peak intensity: Intensity of ions as measured by the height or area of a peak in a mass spectrum.
Definition cv.hpp:402
const double epsilon
Definition DiffTest.cpp:41
void testMaxPrecisionDiff()
int main(int argc, char *argv[])
void testSample()
Definition DiffTest.cpp:138
void testScanSettings()
Definition DiffTest.cpp:349
void testSourceFile()
Definition DiffTest.cpp:66
void testProcessingMethod()
Definition DiffTest.cpp:281
void testPrecursor()
Definition DiffTest.cpp:375
void testChromatogramList()
Definition DiffTest.cpp:725
void testProduct()
Definition DiffTest.cpp:407
void testBinaryDataOnly()
Definition DiffTest.cpp:951
void testSource()
Definition DiffTest.cpp:175
void testRun()
Definition DiffTest.cpp:828
void testSpectrumList()
Definition DiffTest.cpp:637
double getMaxPrecisionDiff(const list_type &list)
void testComponent()
Definition DiffTest.cpp:156
void testScan()
Definition DiffTest.cpp:430
void testMSDiffUpdate()
void testFileDescription()
Definition DiffTest.cpp:84
void testInstrumentConfiguration()
Definition DiffTest.cpp:249
void testFileContent()
Definition DiffTest.cpp:41
static const char * userParamName_MaxBinaryDataArrayDifference_
void testComponentList()
Definition DiffTest.cpp:194
void testSpectrum()
Definition DiffTest.cpp:521
void testChromatogram()
Definition DiffTest.cpp:600
ostream * os_
Definition DiffTest.cpp:38
void test()
void testDataProcessing()
Definition DiffTest.cpp:311
void testScanList()
Definition DiffTest.cpp:456
void testBinaryDataArray()
Definition DiffTest.cpp:487
void testSoftware()
Definition DiffTest.cpp:227
void testMSData()
Definition DiffTest.cpp:888
PWIZ_API_DECL void diff(const std::string &a, const std::string &b, std::string &a_b, std::string &b_a, const BaseDiffConfig &config)
boost::shared_ptr< ParamGroup > ParamGroupPtr
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
@ ComponentType_Analyzer
Definition MSData.hpp:125
@ ComponentType_Detector
Definition MSData.hpp:126
@ ComponentType_Source
Definition MSData.hpp:124
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition MSData.hpp:288
boost::shared_ptr< Software > SoftwarePtr
Definition MSData.hpp:198
boost::shared_ptr< ScanSettings > ScanSettingsPtr
Definition MSData.hpp:225
boost::shared_ptr< Sample > SamplePtr
Definition MSData.hpp:118
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition MSData.hpp:624
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition MSData.hpp:417
boost::shared_ptr< Spectrum > SpectrumPtr
Definition MSData.hpp:573
boost::shared_ptr< InstrumentConfiguration > InstrumentConfigurationPtr
Definition MSData.hpp:250
boost::shared_ptr< SpectrumListSimple > SpectrumListSimplePtr
Definition MSData.hpp:731
boost::shared_ptr< ChromatogramListSimple > ChromatogramListSimplePtr
Definition MSData.hpp:805
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition MSData.hpp:76
void version(const string &v)
Definition DiffTest.cpp:886
Information about an ontology or CV source and a short 'lookup' tag to refer to.
Definition cv.hpp:14916
represents a tag-value pair, where the tag comes from the controlled vocabulary
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition diff_std.hpp:143
object_result_type a_b
Definition diff_std.hpp:156
object_result_type b_a
Definition diff_std.hpp:157
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
std::vector< UserParam > userParams
a collection of uncontrolled user terms
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Uncontrolled user parameters (essentially allowing free text). Before using these,...
Implementation of ContactType from mzIdentML.
Implementation of the SampleType from the mzIdentML schema.
Implementation of SourceFileType from the mzIdentML schema.
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition MSData.hpp:405
DataProcessingPtr dataProcessingPtr
this optional attribute may reference the 'id' attribute of the appropriate dataProcessing.
Definition MSData.hpp:407
pwiz::util::BinaryData< double > data
the binary data.
Definition MSData.hpp:410
A single chromatogram.
Definition MSData.hpp:578
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the 'id' of the appropriate dataProcessing.
Definition MSData.hpp:583
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition MSData.hpp:592
std::string id
a unique identifier for this chromatogram. It should be expected that external files may use this ide...
Definition MSData.hpp:495
size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
Definition MSData.hpp:492
Simple writeable in-memory implementation of ChromatogramList.
Definition MSData.hpp:791
std::vector< ChromatogramPtr > chromatograms
Definition MSData.hpp:792
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i....
Definition MSData.hpp:132
int order
this attribute MUST be used to indicate the order in which the components are encountered from source...
Definition MSData.hpp:137
List with the different components used in the mass spectrometer. At least one source,...
Definition MSData.hpp:157
Component & detector(size_t index)
returns the detector component with ordinal <index+1>
Component & source(size_t index)
returns the source component with ordinal <index+1>
Description of the way in which a particular software was used.
Definition MSData.hpp:274
std::vector< ProcessingMethod > processingMethods
description of the default peak processing method(s). This element describes the base method used in ...
Definition MSData.hpp:279
std::string id
a unique identifier for this data processing that is unique across all DataProcessingTypes.
Definition MSData.hpp:276
This summarizes the different types of spectra that can be expected in the file. This is expected to ...
Definition MSData.hpp:50
Information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
Definition MSData.hpp:85
std::vector< Contact > contacts
structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam),...
Definition MSData.hpp:93
FileContent fileContent
this summarizes the different types of spectra that can be expected in the file. This is expected to ...
Definition MSData.hpp:87
std::vector< SourceFilePtr > sourceFilePtrs
list and descriptions of the source files this mzML document was generated or derived from.
Definition MSData.hpp:90
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
Definition MSData.hpp:230
ComponentList componentList
list with the different components used in the mass spectrometer. At least one source,...
Definition MSData.hpp:235
std::string id
an identifier for this instrument configuration.
Definition MSData.hpp:232
SoftwarePtr softwarePtr
reference to a previously defined software element.
Definition MSData.hpp:238
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition MSData.hpp:850
std::vector< ScanSettingsPtr > scanSettingsPtrs
list with the descriptions of the acquisition settings applied prior to the start of data acquisition...
Definition MSData.hpp:874
const std::string & version() const
returns the version of this mzML document; for a document created programmatically,...
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
Definition MSData.hpp:886
std::vector< SoftwarePtr > softwarePtrs
list and descriptions of software used to acquire and/or process the data in this mzML file.
Definition MSData.hpp:871
std::string accession
an optional accession number for the mzML document.
Definition MSData.hpp:852
std::string version_
Definition MSData.hpp:907
std::string id
an optional id for the mzML document. It is recommended to use LSIDs when possible.
Definition MSData.hpp:855
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:862
std::vector< InstrumentConfigurationPtr > instrumentConfigurationPtrs
list and descriptions of instrument configurations.
Definition MSData.hpp:877
std::vector< ParamGroupPtr > paramGroupPtrs
container for a list of referenceableParamGroups
Definition MSData.hpp:865
std::vector< SamplePtr > samplePtrs
list and descriptions of samples.
Definition MSData.hpp:868
std::vector< DataProcessingPtr > dataProcessingPtrs
list and descriptions of data processing applied to this data.
Definition MSData.hpp:880
std::vector< CV > cvs
container for one or more controlled vocabulary definitions.
Definition MSData.hpp:859
The method of precursor ion selection and activation.
Definition MSData.hpp:312
std::vector< SelectedIon > selectedIons
this list of precursor ions that were selected.
Definition MSData.hpp:329
IsolationWindow isolationWindow
this element captures the isolation (or 'selection') window configured to isolate one or more precurs...
Definition MSData.hpp:326
Activation activation
the type and energy level used for activation.
Definition MSData.hpp:332
std::string spectrumID
reference to the id attribute of the spectrum from which the precursor was selected.
Definition MSData.hpp:323
Description of the default peak processing method. This element describes the base method used in the...
Definition MSData.hpp:255
int order
this attributes allows a series of consecutive steps to be placed in the correct order.
Definition MSData.hpp:257
SoftwarePtr softwarePtr
this attribute MUST reference the 'id' of the appropriate SoftwareType.
Definition MSData.hpp:260
product ion information
Definition MSData.hpp:348
IsolationWindow isolationWindow
this element captures the isolation (or 'selection') window configured to isolate one or more precurs...
Definition MSData.hpp:350
A run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
Definition MSData.hpp:810
SourceFilePtr defaultSourceFilePtr
default source file reference
Definition MSData.hpp:824
std::string id
a unique identifier for this run.
Definition MSData.hpp:812
std::string startTimeStamp
the optional start timestamp of the run, in UT.
Definition MSData.hpp:821
InstrumentConfigurationPtr defaultInstrumentConfigurationPtr
this attribute MUST reference the 'id' of the default instrument configuration. If a scan does not re...
Definition MSData.hpp:815
SamplePtr samplePtr
this attribute MUST reference the 'id' of the appropriate sample.
Definition MSData.hpp:818
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
Definition MSData.hpp:830
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here....
Definition MSData.hpp:827
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile.
Definition MSData.hpp:370
InstrumentConfigurationPtr instrumentConfigurationPtr
this attribute MUST reference the 'id' attribute of the appropriate instrument configuration.
Definition MSData.hpp:384
std::vector< ScanWindow > scanWindows
container for a list of select windows.
Definition MSData.hpp:387
List and descriptions of scans.
Definition MSData.hpp:396
std::vector< Scan > scans
Definition MSData.hpp:397
Description of the acquisition settings of the instrument prior to the start of the run.
Definition MSData.hpp:207
std::vector< Target > targets
target list (or 'inclusion list') configured prior to the run.
Definition MSData.hpp:215
std::string id
a unique identifier for this acquisition setting.
Definition MSData.hpp:209
std::vector< SourceFilePtr > sourceFilePtrs
container for a list of source file references.
Definition MSData.hpp:212
A piece of software.
Definition MSData.hpp:180
std::string id
an identifier for this software that is unique across all SoftwareTypes.
Definition MSData.hpp:182
std::string version
the software version.
Definition MSData.hpp:185
The structure that captures the generation of a peak list (including the underlying acquisitions)
Definition MSData.hpp:506
SourceFilePtr sourceFilePtr
this attribute can optionally reference the 'id' of the appropriate sourceFile.
Definition MSData.hpp:514
std::vector< Product > products
list and descriptions of product ion information
Definition MSData.hpp:523
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the 'id' of the appropriate dataProcessing.
Definition MSData.hpp:511
size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition MSData.hpp:508
ScanList scanList
list of scans
Definition MSData.hpp:517
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition MSData.hpp:526
std::vector< Precursor > precursors
list and descriptions of precursors to the spectrum currently being described.
Definition MSData.hpp:520
std::string id
a unique identifier for this spectrum. It should be expected that external files may use this identif...
Definition MSData.hpp:476
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
Definition MSData.hpp:473
Simple writeable in-memory implementation of SpectrumList.
Definition MSData.hpp:717
std::vector< SpectrumPtr > spectra
Definition MSData.hpp:718
#define unit_assert(x)
Definition unit.hpp:85
#define TEST_PROLOG_EX(argc, argv, suffix)
Definition unit.hpp:157
#define TEST_EPILOG
Definition unit.hpp:183
#define TEST_FAILED(x)
Definition unit.hpp:177
#define unit_assert_equal(x, y, epsilon)
Definition unit.hpp:99