ProteoWizard
Functions | Variables
ReferencesTest.cpp File Reference
#include "References.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "pwiz/utility/misc/Std.hpp"
#include "pwiz/utility/minimxml/XMLWriter.hpp"

Go to the source code of this file.

Functions

void testParamContainer ()
 
void testFileDescription ()
 
void testComponentList ()
 
void testInstrumentConfiguration ()
 
void testDataProcessing ()
 
void testScanSettings ()
 
void testPrecursor ()
 
void testProduct ()
 
void testScan ()
 
void testScanList ()
 
void testBinaryDataArray ()
 
void testSpectrum ()
 
void testChromatogram ()
 
void testRun ()
 
void testMSData ()
 
void test ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_ = 0
 

Function Documentation

◆ testParamContainer()

void testParamContainer ( )

Definition at line 38 of file ReferencesTest.cpp.

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 }

References MS_reflectron_off, MS_reflectron_on, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), and unit_assert.

Referenced by test().

◆ testFileDescription()

void testFileDescription ( )

Definition at line 64 of file ReferencesTest.cpp.

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 }

References pwiz::msdata::FileDescription::contacts, pwiz::msdata::FileDescription::fileContent, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::FileDescription::sourceFilePtrs, and unit_assert.

Referenced by test().

◆ testComponentList()

void testComponentList ( )

Definition at line 110 of file ReferencesTest.cpp.

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 }

References pwiz::msdata::ComponentList::analyzer(), pwiz::msdata::ComponentType_Analyzer, pwiz::msdata::ComponentType_Detector, pwiz::msdata::ComponentType_Source, pwiz::msdata::ComponentList::detector(), os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::ComponentList::source(), and unit_assert.

Referenced by test().

◆ testInstrumentConfiguration()

void testInstrumentConfiguration ( )

Definition at line 134 of file ReferencesTest.cpp.

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 }

References pwiz::msdata::InstrumentConfiguration::componentList, pwiz::msdata::ComponentType_Source, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::InstrumentConfiguration::softwarePtr, pwiz::msdata::MSData::softwarePtrs, pwiz::msdata::ComponentList::source(), and unit_assert.

Referenced by test().

◆ testDataProcessing()

void testDataProcessing ( )

Definition at line 162 of file ReferencesTest.cpp.

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 }

References os_, pwiz::msdata::MSData::paramGroupPtrs, pwiz::msdata::DataProcessing::processingMethods, pwiz::identdata::References::resolve(), pwiz::msdata::MSData::softwarePtrs, and unit_assert.

Referenced by test().

◆ testScanSettings()

void testScanSettings ( )

Definition at line 188 of file ReferencesTest.cpp.

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 }

References pwiz::msdata::MSData::fileDescription, os_, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::FileDescription::sourceFilePtrs, pwiz::msdata::ScanSettings::sourceFilePtrs, pwiz::msdata::ScanSettings::targets, and unit_assert.

Referenced by test().

◆ testPrecursor()

void testPrecursor ( )

Definition at line 219 of file ReferencesTest.cpp.

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 }

References pwiz::msdata::Precursor::activation, pwiz::msdata::Precursor::isolationWindow, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::Precursor::selectedIons, and unit_assert.

Referenced by test().

◆ testProduct()

void testProduct ( )

Definition at line 248 of file ReferencesTest.cpp.

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 }

References pwiz::msdata::Product::isolationWindow, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), and unit_assert.

Referenced by test().

◆ testScan()

void testScan ( )

Definition at line 267 of file ReferencesTest.cpp.

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 }

References pwiz::msdata::Scan::instrumentConfigurationPtr, pwiz::msdata::MSData::instrumentConfigurationPtrs, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::Scan::scanWindows, and unit_assert.

Referenced by test().

◆ testScanList()

void testScanList ( )

Definition at line 295 of file ReferencesTest.cpp.

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 }

References os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::ScanList::scans, and unit_assert.

Referenced by test().

◆ testBinaryDataArray()

void testBinaryDataArray ( )

Definition at line 320 of file ReferencesTest.cpp.

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 }

References pwiz::msdata::BinaryDataArray::dataProcessingPtr, pwiz::msdata::MSData::dataProcessingPtrs, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), and unit_assert.

Referenced by test().

◆ testSpectrum()

void testSpectrum ( )

Definition at line 346 of file ReferencesTest.cpp.

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 }

References pwiz::msdata::Spectrum::binaryDataArrayPtrs, pwiz::msdata::Spectrum::dataProcessingPtr, pwiz::msdata::MSData::dataProcessingPtrs, pwiz::msdata::MSData::fileDescription, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::msdata::Spectrum::precursors, pwiz::msdata::Spectrum::products, pwiz::identdata::References::resolve(), pwiz::msdata::Spectrum::scanList, pwiz::msdata::Spectrum::sourceFilePtr, pwiz::msdata::FileDescription::sourceFilePtrs, and unit_assert.

Referenced by test().

◆ testChromatogram()

void testChromatogram ( )

Definition at line 398 of file ReferencesTest.cpp.

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 }

References pwiz::msdata::Chromatogram::binaryDataArrayPtrs, pwiz::msdata::Chromatogram::dataProcessingPtr, pwiz::msdata::MSData::dataProcessingPtrs, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), and unit_assert.

Referenced by test().

◆ testRun()

void testRun ( )

Definition at line 428 of file ReferencesTest.cpp.

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 }

References pwiz::msdata::Run::defaultInstrumentConfigurationPtr, pwiz::msdata::Run::defaultSourceFilePtr, pwiz::msdata::MSData::fileDescription, pwiz::msdata::MSData::instrumentConfigurationPtrs, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::Run::samplePtr, pwiz::msdata::MSData::samplePtrs, pwiz::msdata::FileDescription::sourceFilePtrs, and unit_assert.

Referenced by test().

◆ testMSData()

void testMSData ( )

Definition at line 464 of file ReferencesTest.cpp.

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 }

References pwiz::msdata::MSData::dataProcessingPtrs, pwiz::msdata::FileDescription::fileContent, pwiz::msdata::MSData::fileDescription, pwiz::msdata::MSData::instrumentConfigurationPtrs, os_, pwiz::data::ParamContainer::paramGroupPtrs, pwiz::msdata::MSData::paramGroupPtrs, pwiz::identdata::References::resolve(), pwiz::msdata::MSData::run, pwiz::msdata::MSData::samplePtrs, and unit_assert.

Referenced by test().

◆ test()

void test ( )

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 524 of file ReferencesTest.cpp.

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 }

References os_, test(), TEST_EPILOG, TEST_FAILED, and TEST_PROLOG_EX.

Variable Documentation

◆ os_

ostream* os_ = 0

Definition at line 35 of file ReferencesTest.cpp.

pwiz::data::UserParam
Uncontrolled user parameters (essentially allowing free text). Before using these,...
Definition: ParamTypes.hpp:185
pwiz::msdata::BinaryDataArrayPtr
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: MSData.hpp:417
pwiz::msdata::ComponentList::source
Component & source(size_t index)
returns the source component with ordinal <index+1>
testSpectrum
void testSpectrum()
Definition: ReferencesTest.cpp:346
pwiz::msdata::Chromatogram::binaryDataArrayPtrs
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: MSData.hpp:592
testParamContainer
void testParamContainer()
Definition: ReferencesTest.cpp:38
test
void test()
Definition: ReferencesTest.cpp:212
pwiz::msdata::InstrumentConfiguration::componentList
ComponentList componentList
list with the different components used in the mass spectrometer. At least one source,...
Definition: MSData.hpp:235
pwiz::msdata::MSData::softwarePtrs
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
testScanList
void testScanList()
Definition: ReferencesTest.cpp:295
pwiz::msdata::Spectrum
The structure that captures the generation of a peak list (including the underlying acquisitions)
Definition: MSData.hpp:505
pwiz::msdata::Software
A piece of software.
Definition: MSData.hpp:179
pwiz::msdata::ProcessingMethod
Description of the default peak processing method. This element describes the base method used in the...
Definition: MSData.hpp:254
pwiz::msdata::SourceFile
Description of the source file, including location and type.
Definition: MSData.hpp:54
pwiz::msdata::Product::isolationWindow
IsolationWindow isolationWindow
this element captures the isolation (or 'selection') window configured to isolate one or more precurs...
Definition: MSData.hpp:350
pwiz::msdata::ScanSettings::sourceFilePtrs
std::vector< SourceFilePtr > sourceFilePtrs
container for a list of source file references.
Definition: MSData.hpp:212
pwiz::msdata::Run
A run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
Definition: MSData.hpp:809
pwiz::msdata::Product
product ion information
Definition: MSData.hpp:347
pwiz::msdata::Contact
Structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam),...
Definition: MSData.hpp:80
pwiz::msdata::ScanList
List and descriptions of scans.
Definition: MSData.hpp:395
pwiz::msdata::Scan::instrumentConfigurationPtr
InstrumentConfigurationPtr instrumentConfigurationPtr
this attribute MUST reference the 'id' attribute of the appropriate instrument configuration.
Definition: MSData.hpp:384
pwiz::identdata::References::resolve
PWIZ_API_DECL void resolve(ContactRole &cr, IdentData &mzid)
pwiz::msdata::FileDescription::sourceFilePtrs
std::vector< SourceFilePtr > sourceFilePtrs
list and descriptions of the source files this mzML document was generated or derived from.
Definition: MSData.hpp:90
pwiz::msdata::MSData::run
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
Definition: MSData.hpp:886
testScan
void testScan()
Definition: ReferencesTest.cpp:267
pwiz::msdata::Scan::scanWindows
std::vector< ScanWindow > scanWindows
container for a list of select windows.
Definition: MSData.hpp:387
pwiz::msdata::Run::defaultSourceFilePtr
SourceFilePtr defaultSourceFilePtr
default source file reference
Definition: MSData.hpp:824
os_
ostream * os_
Definition: ReferencesTest.cpp:36
pwiz::msdata::BinaryDataArray::dataProcessingPtr
DataProcessingPtr dataProcessingPtr
this optional attribute may reference the 'id' attribute of the appropriate dataProcessing.
Definition: MSData.hpp:407
pwiz::msdata::Chromatogram::dataProcessingPtr
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the 'id' of the appropriate dataProcessing.
Definition: MSData.hpp:583
pwiz::msdata::DataProcessing::processingMethods
std::vector< ProcessingMethod > processingMethods
description of the default peak processing method(s). This element describes the base method used in ...
Definition: MSData.hpp:279
testProduct
void testProduct()
Definition: ReferencesTest.cpp:248
pwiz::msdata::Precursor::isolationWindow
IsolationWindow isolationWindow
this element captures the isolation (or 'selection') window configured to isolate one or more precurs...
Definition: MSData.hpp:326
pwiz::msdata::ComponentList
List with the different components used in the mass spectrometer. At least one source,...
Definition: MSData.hpp:156
testScanSettings
void testScanSettings()
Definition: ReferencesTest.cpp:188
pwiz::data::ParamGroup
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:346
pwiz::msdata::Chromatogram
A single chromatogram.
Definition: MSData.hpp:577
pwiz::data::ParamGroupPtr
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:239
pwiz::msdata::Spectrum::sourceFilePtr
SourceFilePtr sourceFilePtr
this attribute can optionally reference the 'id' of the appropriate sourceFile.
Definition: MSData.hpp:514
pwiz::msdata::ScanWindow
TODO.
Definition: MSData.hpp:361
TEST_EPILOG
#define TEST_EPILOG
Definition: unit.hpp:183
pwiz::msdata::ScanSettings::targets
std::vector< Target > targets
target list (or 'inclusion list') configured prior to the run.
Definition: MSData.hpp:215
pwiz::msdata::Spectrum::dataProcessingPtr
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the 'id' of the appropriate dataProcessing.
Definition: MSData.hpp:511
pwiz::msdata::ComponentType_Detector
@ ComponentType_Detector
Definition: MSData.hpp:126
pwiz::msdata::FileDescription::fileContent
FileContent fileContent
this summarizes the different types of spectra that can be expected in the file. This is expected to ...
Definition: MSData.hpp:87
testInstrumentConfiguration
void testInstrumentConfiguration()
Definition: ReferencesTest.cpp:134
pwiz::data::ParamContainer
The base class for elements that may contain cvParams, userParams, or paramGroup references.
Definition: ParamTypes.hpp:244
pwiz::msdata::MSData::fileDescription
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
testPrecursor
void testPrecursor()
Definition: ReferencesTest.cpp:219
pwiz::msdata::SamplePtr
boost::shared_ptr< Sample > SamplePtr
Definition: MSData.hpp:118
pwiz::msdata::ComponentType_Source
@ ComponentType_Source
Definition: MSData.hpp:124
pwiz::msdata::FileDescription
Information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
Definition: MSData.hpp:84
testBinaryDataArray
void testBinaryDataArray()
Definition: ReferencesTest.cpp:320
pwiz::msdata::Spectrum::products
std::vector< Product > products
list and descriptions of product ion information
Definition: MSData.hpp:523
pwiz::msdata::Component
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i....
Definition: MSData.hpp:131
pwiz::msdata::ComponentType_Analyzer
@ ComponentType_Analyzer
Definition: MSData.hpp:125
pwiz::msdata::Precursor::activation
Activation activation
the type and energy level used for activation.
Definition: MSData.hpp:332
pwiz::msdata::Spectrum::binaryDataArrayPtrs
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: MSData.hpp:526
pwiz::msdata::ScanSettings
Description of the acquisition settings of the instrument prior to the start of the run.
Definition: MSData.hpp:206
pwiz::msdata::FileDescription::contacts
std::vector< Contact > contacts
structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam),...
Definition: MSData.hpp:93
pwiz::msdata::ComponentList::detector
Component & detector(size_t index)
returns the detector component with ordinal <index+1>
pwiz::msdata::Spectrum::scanList
ScanList scanList
list of scans
Definition: MSData.hpp:517
pwiz::msdata::Scan
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile.
Definition: MSData.hpp:369
pwiz::msdata::SourceFilePtr
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition: MSData.hpp:76
pwiz::msdata::ScanList::scans
std::vector< Scan > scans
Definition: MSData.hpp:397
TEST_FAILED
#define TEST_FAILED(x)
Definition: unit.hpp:177
pwiz::msdata::Sample
Expansible description of the sample used to generate the dataset, named in sampleName.
Definition: MSData.hpp:101
pwiz::msdata::DataProcessingPtr
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:288
MS_reflectron_on
MS_reflectron_on
reflectron on: Reflectron is on.
Definition: cv.hpp:636
pwiz::msdata::MSData::samplePtrs
std::vector< SamplePtr > samplePtrs
list and descriptions of samples.
Definition: MSData.hpp:868
pwiz::msdata::BinaryDataArray
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:404
pwiz::msdata::Target
TODO.
Definition: MSData.hpp:202
pwiz::msdata::MSData::dataProcessingPtrs
std::vector< DataProcessingPtr > dataProcessingPtrs
list and descriptions of data processing applied to this data.
Definition: MSData.hpp:880
pwiz::data::ParamContainer::paramGroupPtrs
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
Definition: ParamTypes.hpp:247
testChromatogram
void testChromatogram()
Definition: ReferencesTest.cpp:398
pwiz::msdata::MSData::instrumentConfigurationPtrs
std::vector< InstrumentConfigurationPtr > instrumentConfigurationPtrs
list and descriptions of instrument configurations.
Definition: MSData.hpp:877
TEST_PROLOG_EX
#define TEST_PROLOG_EX(argc, argv, suffix)
Definition: unit.hpp:157
pwiz::msdata::InstrumentConfiguration::softwarePtr
SoftwarePtr softwarePtr
reference to a previously defined software element.
Definition: MSData.hpp:238
pwiz::msdata::InstrumentConfiguration
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
Definition: MSData.hpp:229
pwiz::msdata::Spectrum::precursors
std::vector< Precursor > precursors
list and descriptions of precursors to the spectrum currently being described.
Definition: MSData.hpp:520
pwiz::msdata::MSData
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:849
testDataProcessing
void testDataProcessing()
Definition: ReferencesTest.cpp:162
pwiz::msdata::DataProcessing
Description of the way in which a particular software was used.
Definition: MSData.hpp:273
MS_reflectron_off
MS_reflectron_off
reflectron off: Reflectron is off.
Definition: cv.hpp:633
testComponentList
void testComponentList()
Definition: ReferencesTest.cpp:110
testMSData
void testMSData()
Definition: ReferencesTest.cpp:464
pwiz::msdata::Run::samplePtr
SamplePtr samplePtr
this attribute MUST reference the 'id' of the appropriate sample.
Definition: MSData.hpp:818
pwiz::msdata::Precursor::selectedIons
std::vector< SelectedIon > selectedIons
this list of precursor ions that were selected.
Definition: MSData.hpp:329
unit_assert
#define unit_assert(x)
Definition: unit.hpp:85
pwiz::msdata::InstrumentConfigurationPtr
boost::shared_ptr< InstrumentConfiguration > InstrumentConfigurationPtr
Definition: MSData.hpp:250
pwiz::msdata::Precursor
The method of precursor ion selection and activation.
Definition: MSData.hpp:311
pwiz::msdata::Run::defaultInstrumentConfigurationPtr
InstrumentConfigurationPtr defaultInstrumentConfigurationPtr
this attribute MUST reference the 'id' of the default instrument configuration. If a scan does not re...
Definition: MSData.hpp:815
pwiz::msdata::ComponentList::analyzer
Component & analyzer(size_t index)
returns the analyzer component with ordinal <index+1>
testFileDescription
void testFileDescription()
Definition: ReferencesTest.cpp:64
pwiz::msdata::SoftwarePtr
boost::shared_ptr< Software > SoftwarePtr
Definition: MSData.hpp:198
testRun
void testRun()
Definition: ReferencesTest.cpp:428
pwiz::msdata::MSData::paramGroupPtrs
std::vector< ParamGroupPtr > paramGroupPtrs
container for a list of referenceableParamGroups
Definition: MSData.hpp:865