ProteoWizard
ReferencesTest.cpp
Go to the documentation of this file.
1 //
2 // $Id: ReferencesTest.cpp 4129 2012-11-20 00:05:37Z 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 "References.hpp"
28 
29 
30 using namespace pwiz::util;
31 using namespace pwiz::cv;
32 using namespace pwiz::msdata;
33 
34 
35 ostream* os_ = 0;
36 
37 
39 {
40  if (os_) *os_ << "testParamContainer()\n";
41 
42  ParamContainer pc;
43  pc.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg1")));
44  pc.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg2")));
45 
46  MSData msd;
47  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg2")));
48  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg1")));
49  msd.paramGroupPtrs[0]->cvParams.push_back(MS_reflectron_on);
50  msd.paramGroupPtrs[1]->cvParams.push_back(MS_reflectron_off);
51 
52  unit_assert(pc.paramGroupPtrs[0]->cvParams.empty());
53  unit_assert(pc.paramGroupPtrs[1]->cvParams.empty());
54 
55  References::resolve(pc, msd);
56 
57  unit_assert(pc.paramGroupPtrs[0]->cvParams.size() == 1);
58  unit_assert(pc.paramGroupPtrs[0]->cvParams[0] == MS_reflectron_off);
59  unit_assert(pc.paramGroupPtrs[1]->cvParams.size() == 1);
60  unit_assert(pc.paramGroupPtrs[1]->cvParams[0] == MS_reflectron_on);
61 }
62 
63 
65 {
66  if (os_) *os_ << "testFileDescription()\n";
67 
68  FileDescription fd;
69  fd.fileContent.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg1")));
70  fd.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile));
71  fd.sourceFilePtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg2")));
72  fd.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile));
73  fd.sourceFilePtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg3")));
74  fd.contacts.push_back(Contact());
75  fd.contacts.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg4")));
76  fd.contacts.push_back(Contact());
77  fd.contacts.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg5")));
78 
79  MSData msd;
80  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg5")));
81  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user5"));
82  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg4")));
83  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user4"));
84  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg3")));
85  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user3"));
86  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg2")));
87  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user2"));
88  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg1")));
89  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user1"));
90 
91  References::resolve(fd, msd);
92 
93  unit_assert(!fd.fileContent.paramGroupPtrs[0]->userParams.empty() &&
94  fd.fileContent.paramGroupPtrs[0]->userParams[0].name == "user1");
95 
96  unit_assert(!fd.sourceFilePtrs[0]->paramGroupPtrs[0]->userParams.empty() &&
97  fd.sourceFilePtrs[0]->paramGroupPtrs[0]->userParams[0].name == "user2");
98 
99  unit_assert(!fd.sourceFilePtrs[1]->paramGroupPtrs[0]->userParams.empty() &&
100  fd.sourceFilePtrs[1]->paramGroupPtrs[0]->userParams[0].name == "user3");
101 
102  unit_assert(!fd.contacts[0].paramGroupPtrs[0]->userParams.empty() &&
103  fd.contacts[0].paramGroupPtrs[0]->userParams[0].name == "user4");
104 
105  unit_assert(!fd.contacts[1].paramGroupPtrs[0]->userParams.empty() &&
106  fd.contacts[1].paramGroupPtrs[0]->userParams[0].name == "user5");
107 }
108 
109 
111 {
112  if (os_) *os_ << "testComponentList()\n";
113 
114  ComponentList componentList;
115  componentList.push_back(Component(ComponentType_Source, 1));
116  componentList.push_back(Component(ComponentType_Analyzer, 2));
117  componentList.push_back(Component(ComponentType_Detector, 3));
118  componentList.source(0).paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
119  componentList.analyzer(0).paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
120  componentList.detector(0).paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
121 
122  MSData msd;
123  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
124  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
125 
126  References::resolve(componentList, msd);
127 
128  unit_assert(!componentList.source(0).paramGroupPtrs[0]->userParams.empty());
129  unit_assert(!componentList.analyzer(0).paramGroupPtrs[0]->userParams.empty());
130  unit_assert(!componentList.detector(0).paramGroupPtrs[0]->userParams.empty());
131 }
132 
133 
135 {
136  if (os_) *os_ << "testInstrumentConfiguration()\n";
137 
138  InstrumentConfiguration instrumentConfiguration;
139  instrumentConfiguration.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
140  instrumentConfiguration.componentList.push_back(Component(ComponentType_Source, 1));
141  instrumentConfiguration.componentList.source(0).paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
142  instrumentConfiguration.softwarePtr = SoftwarePtr(new Software("msdata"));
143 
144  MSData msd;
145  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
146  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
147  msd.softwarePtrs.push_back(SoftwarePtr(new Software("booger")));
148  msd.softwarePtrs.push_back(SoftwarePtr(new Software("msdata")));
149  msd.softwarePtrs[1]->version = "4.20";
150 
151  unit_assert(instrumentConfiguration.softwarePtr->version.empty());
152  unit_assert(instrumentConfiguration.paramGroupPtrs[0]->userParams.empty());
153 
154  References::resolve(instrumentConfiguration, msd);
155 
156  unit_assert(!instrumentConfiguration.paramGroupPtrs[0]->userParams.empty());
157  unit_assert(!instrumentConfiguration.componentList.source(0).paramGroupPtrs[0]->userParams.empty());
158  unit_assert(instrumentConfiguration.softwarePtr->version == "4.20");
159 }
160 
161 
163 {
164  if (os_) *os_ << "testDataProcessing()\n";
165 
166  DataProcessing dataProcessing;
167  dataProcessing.processingMethods.push_back(ProcessingMethod());
168  dataProcessing.processingMethods.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
169  dataProcessing.processingMethods.back().softwarePtr = SoftwarePtr(new Software("msdata"));
170 
171  MSData msd;
172  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
173  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
174  msd.softwarePtrs.push_back(SoftwarePtr(new Software("booger")));
175  msd.softwarePtrs.push_back(SoftwarePtr(new Software("msdata")));
176  msd.softwarePtrs[1]->version = "4.20";
177 
178  unit_assert(dataProcessing.processingMethods.back().softwarePtr->version.empty());
179  unit_assert(dataProcessing.processingMethods.back().paramGroupPtrs[0]->userParams.empty());
180 
181  References::resolve(dataProcessing, msd);
182 
183  unit_assert(!dataProcessing.processingMethods.back().paramGroupPtrs[0]->userParams.empty());
184  unit_assert(dataProcessing.processingMethods.back().softwarePtr->version == "4.20");
185 }
186 
187 
189 {
190  if (os_) *os_ << "testScanSettings()\n";
191 
192  ScanSettings scanSettings;
193  scanSettings.targets.push_back(Target());
194  scanSettings.targets.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
195  scanSettings.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf2")));
196  scanSettings.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf1")));
197 
198  MSData msd;
199  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
200  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
201  msd.fileDescription.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf1")));
202  msd.fileDescription.sourceFilePtrs.back()->name = "goo1.raw";
203  msd.fileDescription.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf2")));
204  msd.fileDescription.sourceFilePtrs.back()->name = "goo2.raw";
205 
206  unit_assert(scanSettings.targets.back().paramGroupPtrs[0]->userParams.empty());
207  unit_assert(scanSettings.sourceFilePtrs[0]->name.empty());
208  unit_assert(scanSettings.sourceFilePtrs[1]->name.empty());
209 
210  References::resolve(scanSettings, msd);
211 
212  unit_assert(!scanSettings.targets.back().paramGroupPtrs.empty());
213  unit_assert(!scanSettings.targets.back().paramGroupPtrs[0]->userParams.empty());
214  unit_assert(scanSettings.sourceFilePtrs[0]->name == "goo2.raw");
215  unit_assert(scanSettings.sourceFilePtrs[1]->name == "goo1.raw");
216 }
217 
218 
220 {
221  if (os_) *os_ << "testPrecursor()\n";
222 
223  Precursor precursor;
224  precursor.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
225  precursor.selectedIons.resize(1);
226  precursor.selectedIons[0].paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
227  precursor.activation.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
228  precursor.isolationWindow.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
229 
230  MSData msd;
231  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
232  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
233 
234  unit_assert(precursor.paramGroupPtrs[0]->userParams.empty());
235  unit_assert(precursor.selectedIons[0].paramGroupPtrs[0]->userParams.empty());
236  unit_assert(precursor.activation.paramGroupPtrs[0]->userParams.empty());
237  unit_assert(precursor.isolationWindow.paramGroupPtrs[0]->userParams.empty());
238 
239  References::resolve(precursor, msd);
240 
241  unit_assert(!precursor.paramGroupPtrs[0]->userParams.empty());
242  unit_assert(!precursor.selectedIons[0].paramGroupPtrs[0]->userParams.empty());
243  unit_assert(!precursor.activation.paramGroupPtrs[0]->userParams.empty());
244  unit_assert(!precursor.isolationWindow.paramGroupPtrs[0]->userParams.empty());
245 }
246 
247 
249 {
250  if (os_) *os_ << "testProduct()\n";
251 
252  Product product;
253  product.isolationWindow.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
254 
255  MSData msd;
256  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
257  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
258 
259  unit_assert(product.isolationWindow.paramGroupPtrs[0]->userParams.empty());
260 
261  References::resolve(product, msd);
262 
263  unit_assert(!product.isolationWindow.paramGroupPtrs[0]->userParams.empty());
264 }
265 
266 
267 void testScan()
268 {
269  if (os_) *os_ << "testScan()\n";
270 
271  Scan scan;
272  scan.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
274  scan.scanWindows.push_back(ScanWindow());
275  scan.scanWindows.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
276 
277  MSData msd;
278  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
279  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
280  msd.instrumentConfigurationPtrs.push_back(InstrumentConfigurationPtr(new InstrumentConfiguration("instrumentConfiguration")));
281  msd.instrumentConfigurationPtrs.back()->userParams.push_back(UserParam("user"));
282 
283  unit_assert(scan.paramGroupPtrs[0]->userParams.empty());
284  unit_assert(scan.instrumentConfigurationPtr->userParams.empty());
285  unit_assert(scan.scanWindows.back().paramGroupPtrs.back()->userParams.empty());
286 
287  References::resolve(scan, msd);
288 
289  unit_assert(!scan.paramGroupPtrs[0]->userParams.empty());
290  unit_assert(!scan.instrumentConfigurationPtr->userParams.empty());
291  unit_assert(!scan.scanWindows.back().paramGroupPtrs.back()->userParams.empty());
292 }
293 
294 
296 {
297  if (os_) *os_ << "testScanList()\n";
298 
299  ScanList scanList;
300  scanList.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
301 
302  scanList.scans.push_back(Scan());
303  Scan& scan = scanList.scans.back();
304  scan.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
305 
306  MSData msd;
307  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
308  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
309 
310  unit_assert(scanList.paramGroupPtrs[0]->userParams.empty());
311  unit_assert(scan.paramGroupPtrs[0]->userParams.empty());
312 
313  References::resolve(scanList, msd);
314 
315  unit_assert(!scanList.paramGroupPtrs[0]->userParams.empty());
316  unit_assert(!scan.paramGroupPtrs[0]->userParams.empty());
317 }
318 
319 
321 {
322  if (os_) *os_ << "testBinaryDataArray()\n";
323 
324  BinaryDataArray binaryDataArray;
325  binaryDataArray.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
326  binaryDataArray.dataProcessingPtr = DataProcessingPtr(new DataProcessing("msdata"));
327 
328  MSData msd;
329  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
330  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
331  msd.dataProcessingPtrs.push_back(DataProcessingPtr(new DataProcessing("msdata")));
332  msd.dataProcessingPtrs.back()->processingMethods.push_back(ProcessingMethod());
333  msd.dataProcessingPtrs.back()->processingMethods.back().softwarePtr = SoftwarePtr(new Software("software"));
334 
335  unit_assert(binaryDataArray.paramGroupPtrs.back()->userParams.empty());
336  unit_assert(binaryDataArray.dataProcessingPtr->processingMethods.empty());
337 
338  References::resolve(binaryDataArray, msd);
339 
340  unit_assert(!binaryDataArray.paramGroupPtrs.back()->userParams.empty());
341  unit_assert(binaryDataArray.dataProcessingPtr->processingMethods.size() == 1);
342  unit_assert(binaryDataArray.dataProcessingPtr->processingMethods.back().softwarePtr.get());
343 }
344 
345 
347 {
348  if (os_) *os_ << "testSpectrum()\n";
349 
350  Spectrum spectrum;
351  spectrum.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
352  spectrum.dataProcessingPtr = DataProcessingPtr(new DataProcessing("dp"));
353  spectrum.sourceFilePtr = SourceFilePtr(new SourceFile("sf"));
354  spectrum.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
355 
356  spectrum.scanList.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
357  spectrum.precursors.push_back(Precursor());
358  spectrum.precursors.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
359  spectrum.products.push_back(Product());
360  spectrum.products.back().isolationWindow.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
361 
362  spectrum.binaryDataArrayPtrs.push_back(BinaryDataArrayPtr(new BinaryDataArray));
363  spectrum.binaryDataArrayPtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
364 
365 
366  MSData msd;
367  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
368  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
369  msd.dataProcessingPtrs.push_back(DataProcessingPtr(new DataProcessing("dp")));
370  msd.dataProcessingPtrs.back()->processingMethods.push_back(ProcessingMethod());
371  msd.dataProcessingPtrs.back()->processingMethods.back().softwarePtr = SoftwarePtr(new Software("software"));
372  msd.fileDescription.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf")));
373  msd.fileDescription.sourceFilePtrs.back()->name = "goo.raw";
374 
375  unit_assert(spectrum.paramGroupPtrs.back()->userParams.empty());
376  unit_assert(spectrum.dataProcessingPtr->processingMethods.empty());
377  unit_assert(spectrum.sourceFilePtr->name.empty());
378  unit_assert(spectrum.paramGroupPtrs.back()->userParams.empty());
379  unit_assert(spectrum.scanList.paramGroupPtrs.back()->userParams.empty());
380  unit_assert(spectrum.precursors.back().paramGroupPtrs.back()->userParams.empty());
381  unit_assert(spectrum.products.back().isolationWindow.paramGroupPtrs.back()->userParams.empty());
382  unit_assert(spectrum.binaryDataArrayPtrs.back()->paramGroupPtrs.back()->userParams.empty());
383 
384  References::resolve(spectrum, msd);
385 
386  unit_assert(!spectrum.paramGroupPtrs.back()->userParams.empty());
387  unit_assert(spectrum.dataProcessingPtr->processingMethods.size() == 1);
388  unit_assert(spectrum.dataProcessingPtr->processingMethods.back().softwarePtr.get());
389  unit_assert(spectrum.sourceFilePtr->name == "goo.raw");
390  unit_assert(!spectrum.paramGroupPtrs.back()->userParams.empty());
391  unit_assert(!spectrum.scanList.paramGroupPtrs.back()->userParams.empty());
392  unit_assert(!spectrum.precursors.back().paramGroupPtrs.back()->userParams.empty());
393  unit_assert(!spectrum.products.back().isolationWindow.paramGroupPtrs.back()->userParams.empty());
394  unit_assert(!spectrum.binaryDataArrayPtrs.back()->paramGroupPtrs.back()->userParams.empty());
395 }
396 
397 
399 {
400  if (os_) *os_ << "testChromatogram()\n";
401 
402  Chromatogram chromatogram;
403  chromatogram.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
404  chromatogram.dataProcessingPtr = DataProcessingPtr(new DataProcessing("dp"));
405  chromatogram.binaryDataArrayPtrs.push_back(BinaryDataArrayPtr(new BinaryDataArray));
406  chromatogram.binaryDataArrayPtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
407 
408  MSData msd;
409  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
410  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
411  msd.dataProcessingPtrs.push_back(DataProcessingPtr(new DataProcessing("dp")));
412  msd.dataProcessingPtrs.back()->processingMethods.push_back(ProcessingMethod());
413  msd.dataProcessingPtrs.back()->processingMethods.back().softwarePtr = SoftwarePtr(new Software("software"));
414 
415  unit_assert(chromatogram.paramGroupPtrs.back()->userParams.empty());
416  unit_assert(chromatogram.dataProcessingPtr->processingMethods.empty());
417  unit_assert(chromatogram.binaryDataArrayPtrs.back()->paramGroupPtrs.back()->userParams.empty());
418 
419  References::resolve(chromatogram, msd);
420 
421  unit_assert(!chromatogram.paramGroupPtrs.back()->userParams.empty());
422  unit_assert(chromatogram.dataProcessingPtr->processingMethods.size() == 1);
423  unit_assert(chromatogram.dataProcessingPtr->processingMethods.back().softwarePtr.get());
424  unit_assert(!chromatogram.binaryDataArrayPtrs.back()->paramGroupPtrs.back()->userParams.empty());
425 }
426 
427 
428 void testRun()
429 {
430  if (os_) *os_ << "testRun()\n";
431 
432  Run run;
433  run.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
435  run.samplePtr = SamplePtr(new Sample("sample"));
437 
438  MSData msd;
439  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
440  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
441  msd.instrumentConfigurationPtrs.push_back(InstrumentConfigurationPtr(new InstrumentConfiguration("instrumentConfiguration")));
442  msd.instrumentConfigurationPtrs.back()->userParams.push_back(UserParam("user"));
443  msd.samplePtrs.push_back(SamplePtr(new Sample("sample")));
444  msd.samplePtrs.back()->name = "sample name";
445  msd.fileDescription.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf1")));
446  msd.fileDescription.sourceFilePtrs.back()->name = "goo1.raw";
447  msd.fileDescription.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("sf2")));
448  msd.fileDescription.sourceFilePtrs.back()->name = "goo2.raw";
449 
450  unit_assert(run.paramGroupPtrs.back()->userParams.empty());
451  unit_assert(run.defaultInstrumentConfigurationPtr->userParams.empty());
452  unit_assert(run.samplePtr->name.empty());
453  unit_assert(run.defaultSourceFilePtr->name.empty());
454 
455  References::resolve(run, msd);
456 
457  unit_assert(!run.paramGroupPtrs.back()->userParams.empty());
458  unit_assert(!run.defaultInstrumentConfigurationPtr->userParams.empty());
459  unit_assert(run.samplePtr->name == "sample name");
460  unit_assert(run.defaultSourceFilePtr->name == "goo2.raw");
461 }
462 
463 
465 {
466  if (os_) *os_ << "testMSData()\n";
467 
468  MSData msd;
469 
471  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
472  msd.paramGroupPtrs.back()->userParams.push_back(UserParam("user"));
473  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg1")));
474  msd.paramGroupPtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
475  msd.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg2")));
476  msd.paramGroupPtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
477  msd.samplePtrs.push_back(SamplePtr(new Sample("sample")));
478  msd.samplePtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
479  msd.instrumentConfigurationPtrs.push_back(InstrumentConfigurationPtr(new InstrumentConfiguration("instrumentConfiguration")));
480  msd.instrumentConfigurationPtrs.back()->paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
481  msd.dataProcessingPtrs.push_back(DataProcessingPtr(new DataProcessing("dp")));
482  msd.dataProcessingPtrs.back()->processingMethods.push_back(ProcessingMethod());
483  msd.dataProcessingPtrs.back()->processingMethods.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
484  msd.run.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
485 
486  unit_assert(msd.paramGroupPtrs[1]->paramGroupPtrs.back()->userParams.empty());
487  unit_assert(msd.paramGroupPtrs[2]->paramGroupPtrs.back()->userParams.empty());
488  unit_assert(msd.samplePtrs.back()->paramGroupPtrs.back()->userParams.empty());
489  unit_assert(msd.instrumentConfigurationPtrs.back()->paramGroupPtrs.back()->userParams.empty());
490  unit_assert(msd.dataProcessingPtrs.back()->processingMethods.back().paramGroupPtrs.back()->userParams.empty());
491  unit_assert(msd.run.paramGroupPtrs.back()->userParams.empty());
492 
493  References::resolve(msd);
494 
495  unit_assert(!msd.paramGroupPtrs[1]->paramGroupPtrs.back()->userParams.empty());
496  unit_assert(!msd.paramGroupPtrs[2]->paramGroupPtrs.back()->userParams.empty());
497  unit_assert(!msd.samplePtrs.back()->paramGroupPtrs.back()->userParams.empty());
498  unit_assert(!msd.instrumentConfigurationPtrs.back()->paramGroupPtrs.back()->userParams.empty());
499  unit_assert(!msd.dataProcessingPtrs.back()->processingMethods.back().paramGroupPtrs.back()->userParams.empty());
500  unit_assert(!msd.run.paramGroupPtrs.back()->userParams.empty());
501 }
502 
503 
504 void test()
505 {
512  testPrecursor();
513  testProduct();
514  testScan();
515  testScanList();
517  testSpectrum();
519  testRun();
520  testMSData();
521 }
522 
523 
524 int main(int argc, char* argv[])
525 {
526  TEST_PROLOG_EX(argc, argv, "_MSData")
527 
528  try
529  {
530  if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
531  test();
532  }
533  catch (exception& e)
534  {
535  TEST_FAILED(e.what())
536  }
537  catch (...)
538  {
539  TEST_FAILED("Caught unknown exception.")
540  }
541 
543 }
544 
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
std::vector< Product > products
list and descriptions of product ion information
Definition: MSData.hpp:522
product ion information
Definition: MSData.hpp:346
std::vector< SourceFilePtr > sourceFilePtrs
list and descriptions of the source files this mzML document was generated or derived from...
Definition: MSData.hpp:89
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
void testDataProcessing()
boost::shared_ptr< Software > SoftwarePtr
Definition: MSData.hpp:197
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:239
Description of the source file, including location and type.
Definition: MSData.hpp:53
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
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: MSData.hpp:525
void testInstrumentConfiguration()
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
void testComponentList()
void testScanList()
void testPrecursor()
void testMSData()
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
int main(int argc, char *argv[])
void testBinaryDataArray()
IsolationWindow isolationWindow
this element captures the isolation (or &#39;selection&#39;) window configured to isolate one or more precurs...
Definition: MSData.hpp:325
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
void testFileDescription()
void testParamContainer()
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
void testSpectrum()
Component & source(size_t index)
returns the source component with ordinal <index+1>
DataProcessingPtr dataProcessingPtr
this optional attribute may reference the &#39;id&#39; attribute of the appropriate dataProcessing.
Definition: MSData.hpp:406
SourceFilePtr defaultSourceFilePtr
default source file reference
Definition: MSData.hpp:820
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
Description of the default peak processing method. This element describes the base method used in the...
Definition: MSData.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
A run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:805
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::vector< Target > targets
target list (or &#39;inclusion list&#39;) configured prior to the run.
Definition: MSData.hpp:214
The base class for elements that may contain cvParams, userParams, or paramGroup references.
Definition: ParamTypes.hpp:244
Activation activation
the type and energy level used for activation.
Definition: MSData.hpp:331
std::vector< ScanWindow > scanWindows
container for a list of select windows.
Definition: MSData.hpp:386
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
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
Definition: ParamTypes.hpp:247
A piece of software.
Definition: MSData.hpp:178
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
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
std::vector< SourceFilePtr > sourceFilePtrs
container for a list of source file references.
Definition: MSData.hpp:211
Component & analyzer(size_t index)
returns the analyzer component with ordinal <index+1>
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:324
std::vector< SamplePtr > samplePtrs
list and descriptions of samples.
Definition: MSData.hpp:864
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
Definition: MSData.hpp:228
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
PWIZ_API_DECL void resolve(ContactRole &cr, IdentData &mzid)
std::vector< SelectedIon > selectedIons
this list of precursor ions that were selected.
Definition: MSData.hpp:328
#define TEST_PROLOG_EX(argc, argv, suffix)
Definition: unit.hpp:157
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
#define TEST_FAILED(x)
Definition: unit.hpp:176
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
void testScanSettings()
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
Expansible description of the sample used to generate the dataset, named in sampleName.
Definition: MSData.hpp:100
void testRun()
SourceFilePtr sourceFilePtr
this attribute can optionally reference the &#39;id&#39; of the appropriate sourceFile.
Definition: MSData.hpp:513
Component & detector(size_t index)
returns the detector component with ordinal <index+1>
boost::shared_ptr< Sample > SamplePtr
Definition: MSData.hpp:117
MS_reflectron_off
reflectron off: Reflectron is off.
Definition: cv.hpp:472
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
SamplePtr samplePtr
this attribute MUST reference the &#39;id&#39; of the appropriate sample.
Definition: MSData.hpp:814
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
void test()
#define unit_assert(x)
Definition: unit.hpp:85
void testProduct()
void testChromatogram()
ostream * os_
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: MSData.hpp:416
Definition: cv.hpp:91
void testScan()
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