ProteoWizard
ReferencesTest.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
24#include "References.hpp"
28
29
30using namespace pwiz::util;
31using namespace pwiz::cv;
32using namespace pwiz::msdata;
33
34
35ostream* os_ = 0;
36
37
39{
40 if (os_) *os_ << "testParamContainer()\n";
41
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
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
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")));
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
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
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
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
522
523
524int 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
MS_reflectron_on
reflectron on: Reflectron is on.
Definition cv.hpp:636
MS_reflectron_off
reflectron off: Reflectron is off.
Definition cv.hpp:633
int main(int argc, char *argv[])
void testParamContainer()
void testScanSettings()
void testPrecursor()
void testProduct()
void testRun()
void testScan()
void testFileDescription()
void testInstrumentConfiguration()
void testComponentList()
void testSpectrum()
void testChromatogram()
ostream * os_
void test()
void testDataProcessing()
void testScanList()
void testBinaryDataArray()
void testMSData()
boost::shared_ptr< ParamGroup > ParamGroupPtr
PWIZ_API_DECL void resolve(ParamContainer &paramContainer, const MSData &msd)
@ 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< Sample > SamplePtr
Definition MSData.hpp:118
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition MSData.hpp:417
boost::shared_ptr< InstrumentConfiguration > InstrumentConfigurationPtr
Definition MSData.hpp:250
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition MSData.hpp:76
The base class for elements that may contain cvParams, userParams, or paramGroup references.
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
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,...
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
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
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i....
Definition MSData.hpp:132
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>
Component & analyzer(size_t index)
returns the analyzer component with ordinal <index+1>
Structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam),...
Definition MSData.hpp:80
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
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
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
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
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
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
Description of the default peak processing method. This element describes the base method used in the...
Definition MSData.hpp:255
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
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
Expansible description of the sample used to generate the dataset, named in sampleName.
Definition MSData.hpp:102
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::vector< SourceFilePtr > sourceFilePtrs
container for a list of source file references.
Definition MSData.hpp:212
A piece of software.
Definition MSData.hpp:180
Description of the source file, including location and type.
Definition MSData.hpp:55
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
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
#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