ProteoWizard
Classes | Functions | Variables
DiffTest.cpp File Reference
#include "Diff.hpp"
#include "TextWriter.hpp"
#include "examples.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "pwiz/utility/misc/Std.hpp"
#include <cstring>

Go to the source code of this file.

Classes

struct  MSDataWithSettableVersion
 

Functions

void testFileContent ()
 
void testSourceFile ()
 
void testFileDescription ()
 
void testSample ()
 
void testComponent ()
 
void testSource ()
 
void testComponentList ()
 
void testSoftware ()
 
void testInstrumentConfiguration ()
 
void testProcessingMethod ()
 
void testDataProcessing ()
 
void testScanSettings ()
 
void testPrecursor ()
 
void testProduct ()
 
void testScan ()
 
void testScanList ()
 
void testBinaryDataArray ()
 
void testSpectrum ()
 
void testChromatogram ()
 
void testSpectrumList ()
 
void testChromatogramList ()
 
void testRun ()
 
void testMSData ()
 
void testBinaryDataOnly ()
 
template<typename list_type >
double getMaxPrecisionDiff (const list_type &list)
 
void testMaxPrecisionDiff ()
 
void testMSDiffUpdate ()
 
void test ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_ = 0
 
static const char * userParamName_MaxBinaryDataArrayDifference_ = "Maximum binary data array difference"
 

Function Documentation

§ testFileContent()

void testFileContent ( )

Definition at line 41 of file DiffTest.cpp.

References pwiz::data::Diff< object_type, config_type, object_result_type >::a_b, pwiz::data::Diff< object_type, config_type, object_result_type >::b_a, diff(), os_, unit_assert, and pwiz::data::ParamContainer::userParams.

Referenced by test().

42 {
43  if (os_) *os_ << "testFileContent()\n";
44 
45  FileContent a, b;
46  a.userParams.push_back(UserParam("common"));
47  b.userParams.push_back(UserParam("common"));
48 
50  unit_assert(!diff);
51 
52  a.userParams.push_back(UserParam("different", "1"));
53  b.userParams.push_back(UserParam("different", "2"));
54 
55  diff(a, b);
56  if (os_) *os_ << diff << endl;
58 
59  unit_assert(diff.a_b.userParams.size() == 1);
60  unit_assert(diff.a_b.userParams[0] == UserParam("different","1"));
61  unit_assert(diff.b_a.userParams.size() == 1);
62  unit_assert(diff.b_a.userParams[0] == UserParam("different","2"));
63 }
This summarizes the different types of spectra that can be expected in the file. This is expected to ...
Definition: MSData.hpp:49
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:253
ostream * os_
Definition: DiffTest.cpp:40
#define unit_assert(x)
Definition: unit.hpp:85

§ testSourceFile()

void testSourceFile ( )

Definition at line 66 of file DiffTest.cpp.

References diff(), pwiz::identdata::SourceFile::location, os_, unit_assert, and pwiz::data::ParamContainer::userParams.

67 {
68  if (os_) *os_ << "testSourceFile()\n";
69 
70  SourceFile a("id1","name1","location1"), b("id1","name1","location1");
71  a.userParams.push_back(UserParam("common"));
72  b.userParams.push_back(UserParam("common"));
73 
75  unit_assert(!diff);
76 
77  b.location = "location2";
78  diff(a, b);
79  if (os_) *os_ << diff << endl;
81 }
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
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
ostream * os_
Definition: DiffTest.cpp:40
Implementation of SourceFileType from the mzIdentML schema.
Definition: IdentData.hpp:923
#define unit_assert(x)
Definition: unit.hpp:85

§ testFileDescription()

void testFileDescription ( )

Definition at line 84 of file DiffTest.cpp.

References pwiz::data::Diff< object_type, config_type, object_result_type >::a_b, pwiz::data::Diff< object_type, config_type, object_result_type >::b_a, pwiz::msdata::FileDescription::contacts, pwiz::data::ParamContainer::cvParams, diff(), pwiz::msdata::FileDescription::fileContent, MS_contact_name, MS_Thermo_RAW_format, os_, pwiz::msdata::FileDescription::sourceFilePtrs, unit_assert, and pwiz::data::ParamContainer::userParams.

Referenced by test().

85 {
86  if (os_) *os_ << "testFileDescription()\n";
87 
88  FileDescription a, b;
89 
90  a.fileContent.userParams.push_back(UserParam("user param 1"));
91  b.fileContent.userParams.push_back(UserParam("user param 1"));
92 
93  Contact contact1, contact2, contact3, contact4;
94  contact1.cvParams.push_back(CVParam(MS_contact_name, "Darren"));
95  contact2.cvParams.push_back(CVParam(MS_contact_name, "Laura Jane"));
96  contact3.cvParams.push_back(CVParam(MS_contact_name, "Emma Lee"));
97  contact4.cvParams.push_back(CVParam(MS_contact_name, "Isabelle Lynn"));
98 
99  // verify vector_diff_diff with differently ordered vectors
100  a.contacts.push_back(contact2);
101  a.contacts.push_back(contact1);
102  b.contacts.push_back(contact1);
103  b.contacts.push_back(contact2);
104 
105  SourceFilePtr source1(new SourceFile("id1"));
106  SourceFilePtr source2a(new SourceFile("id2"));
107  SourceFilePtr source2b(new SourceFile("id2"));
108  source2a->cvParams.push_back(MS_Thermo_RAW_format);
109 
110  a.sourceFilePtrs.push_back(source1);
111  b.sourceFilePtrs.push_back(source1);
112 
114  unit_assert(!diff);
115 
116  a.contacts.push_back(contact3);
117  b.contacts.push_back(contact4);
118 
119  a.sourceFilePtrs.push_back(source2a);
120  b.sourceFilePtrs.push_back(source2b);
121 
122  diff(a, b);
123  if (os_) *os_ << diff << endl;
124 
125  unit_assert(diff);
126  unit_assert(diff.a_b.contacts.size() == 1);
127  unit_assert(diff.a_b.contacts[0].cvParam(MS_contact_name).value == "Emma Lee");
128  unit_assert(diff.b_a.contacts.size() == 1);
129  unit_assert(diff.b_a.contacts[0].cvParam(MS_contact_name).value == "Isabelle Lynn");
130 
131  unit_assert(diff.a_b.sourceFilePtrs.size() == 1);
132  unit_assert(diff.a_b.sourceFilePtrs[0]->hasCVParam(MS_Thermo_RAW_format));
133  unit_assert(diff.b_a.sourceFilePtrs.size() == 1);
134  unit_assert(!diff.b_a.sourceFilePtrs[0]->hasCVParam(MS_Thermo_RAW_format));
135 }
Implementation of ContactType from mzIdentML.
Definition: IdentData.hpp:117
std::vector< SourceFilePtr > sourceFilePtrs
list and descriptions of the source files this mzML document was generated or derived from...
Definition: MSData.hpp:89
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
MS_Thermo_RAW_format
Thermo RAW format: Thermo Scientific RAW file format.
Definition: cv.hpp:2146
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 diff(const string &filename1, const string &filename2)
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:253
Information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
Definition: MSData.hpp:83
ostream * os_
Definition: DiffTest.cpp:40
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
std::vector< Contact > contacts
structure allowing the use of a controlled (cvParam) or uncontrolled vocabulary (userParam), or a reference to a predefined set of these in this mzML file (paramGroupRef)
Definition: MSData.hpp:92
Implementation of SourceFileType from the mzIdentML schema.
Definition: IdentData.hpp:923
MS_contact_name
contact name: Name of the contact person or organization.
Definition: cv.hpp:2257
#define unit_assert(x)
Definition: unit.hpp:85
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition: MSData.hpp:75

§ testSample()

void testSample ( )

Definition at line 138 of file DiffTest.cpp.

References diff(), MS_peak_intensity, os_, unit_assert, and pwiz::data::ParamContainer::userParams.

139 {
140  if (os_) *os_ << "testSample()\n";
141 
142  Sample a("id1","name1"), b("id1","name1");
143  a.userParams.push_back(UserParam("common"));
144  b.userParams.push_back(UserParam("common"));
145 
147  unit_assert(!diff);
148 
149  a.cvParams.push_back(MS_peak_intensity);
150  diff(a, b);
151  if (os_) *os_ << diff << endl;
152  unit_assert(diff);
153 }
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
MS_peak_intensity
peak intensity: Intensity of ions as measured by the height or area of a peak in a mass spectrum...
Definition: cv.hpp:241
void diff(const string &filename1, const string &filename2)
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
ostream * os_
Definition: DiffTest.cpp:40
Implementation of the SampleType from the mzIdentML schema.
Definition: IdentData.hpp:195
#define unit_assert(x)
Definition: unit.hpp:85

§ testComponent()

void testComponent ( )

Definition at line 156 of file DiffTest.cpp.

References diff(), pwiz::msdata::Component::order, os_, unit_assert, and pwiz::data::ParamContainer::userParams.

Referenced by test().

157 {
158  if (os_) *os_ << "testComponent()\n";
159 
160  Component a, b;
161  a.userParams.push_back(UserParam("common"));
162  b.userParams.push_back(UserParam("common"));
163 
165  unit_assert(!diff);
166 
167  a.order = 420;
168  b.order = 421;
169  diff(a, b);
170  if (os_) *os_ << diff << endl;
171  unit_assert(diff);
172 }
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i...
Definition: MSData.hpp:130
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
int order
this attribute MUST be used to indicate the order in which the components are encountered from source...
Definition: MSData.hpp:136
void diff(const string &filename1, const string &filename2)
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:253
ostream * os_
Definition: DiffTest.cpp:40
#define unit_assert(x)
Definition: unit.hpp:85

§ testSource()

void testSource ( )

Definition at line 175 of file DiffTest.cpp.

References diff(), pwiz::msdata::Component::order, os_, unit_assert, and pwiz::data::ParamContainer::userParams.

Referenced by test().

176 {
177  if (os_) *os_ << "testSource()\n";
178 
179  Component a, b;
180  a.userParams.push_back(UserParam("common"));
181  b.userParams.push_back(UserParam("common"));
182 
184  unit_assert(!diff);
185 
186  a.order = 420;
187  b.order = 421;
188  diff(a, b);
189  if (os_) *os_ << diff << endl;
190  unit_assert(diff);
191 }
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i...
Definition: MSData.hpp:130
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
int order
this attribute MUST be used to indicate the order in which the components are encountered from source...
Definition: MSData.hpp:136
void diff(const string &filename1, const string &filename2)
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:253
ostream * os_
Definition: DiffTest.cpp:40
#define unit_assert(x)
Definition: unit.hpp:85

§ testComponentList()

void testComponentList ( )

Definition at line 194 of file DiffTest.cpp.

References pwiz::msdata::ComponentType_Analyzer, pwiz::msdata::ComponentType_Detector, pwiz::msdata::ComponentType_Source, diff(), os_, and unit_assert.

Referenced by test().

195 {
196  if (os_) *os_ << "testComponentList()\n";
197 
198  ComponentList a, b;
199 
200  a.push_back(Component(ComponentType_Source, 1));
201  b.push_back(Component(ComponentType_Source, 1));
202  a.push_back(Component(ComponentType_Analyzer, 2));
203  b.push_back(Component(ComponentType_Analyzer, 2));
204  a.push_back(Component(ComponentType_Detector, 3));
205  b.push_back(Component(ComponentType_Detector, 3));
206 
207  a[0].userParams.push_back(UserParam("common"));
208  b[0].userParams.push_back(UserParam("common"));
209 
211  unit_assert(!diff);
212 
213  a[1].userParams.push_back(UserParam("common"));
214  b[1].userParams.push_back(UserParam("common"));
215  a[1].userParams.push_back(UserParam("a only"));
216  b[1].userParams.push_back(UserParam("b only"));
217 
218  a[2].userParams.push_back(UserParam("a only"));
219  b[2].userParams.push_back(UserParam("b only"));
220 
221  diff(a, b);
222  if (os_) *os_ << diff << endl;
223  unit_assert(diff);
224 }
A component of an instrument corresponding to a source (i.e. ion source), an analyzer (i...
Definition: MSData.hpp:130
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
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
ostream * os_
Definition: DiffTest.cpp:40
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
#define unit_assert(x)
Definition: unit.hpp:85

§ testSoftware()

void testSoftware ( )

Definition at line 227 of file DiffTest.cpp.

References diff(), pwiz::msdata::Software::id, MS_ionization_type, os_, pwiz::data::ParamContainer::set(), unit_assert, and pwiz::msdata::Software::version.

Referenced by test().

228 {
229  if (os_) *os_ << "testSoftware()\n";
230 
231  Software a, b;
232 
233  a.id = "msdata";
234  a.version = "4.20";
236  b = a;
237 
239  unit_assert(!diff);
240 
241  b.version = "4.21";
242 
243  diff(a, b);
244  if (os_) *os_ << diff << endl;
245  unit_assert(diff);
246 }
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:124
ostream * os_
Definition: DiffTest.cpp:40
std::string version
the software version.
Definition: MSData.hpp:184
A piece of software.
Definition: MSData.hpp:178
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
#define unit_assert(x)
Definition: unit.hpp:85
std::string id
an identifier for this software that is unique across all SoftwareTypes.
Definition: MSData.hpp:181

§ testInstrumentConfiguration()

void testInstrumentConfiguration ( )

Definition at line 249 of file DiffTest.cpp.

References pwiz::msdata::InstrumentConfiguration::componentList, pwiz::data::ParamContainer::cvParams, pwiz::msdata::ComponentList::detector(), diff(), pwiz::msdata::InstrumentConfiguration::id, MS_electron_multiplier, MS_instrument_serial_number, MS_LCQ_Deca, MS_nanoelectrospray, MS_quadrupole_ion_trap, MS_reflectron_off, pwiz::msdata::Component::order, os_, pwiz::data::ParamContainer::set(), pwiz::msdata::InstrumentConfiguration::softwarePtr, pwiz::msdata::ComponentList::source(), and unit_assert.

Referenced by test().

250 {
252 
253  a.id = "LCQ Deca";
254  a.cvParams.push_back(MS_LCQ_Deca);
255  a.cvParams.push_back(CVParam(MS_instrument_serial_number, 23433));
259 
260  b = a;
261 
262  a.softwarePtr = SoftwarePtr(new Software("XCalibur"));
263  a.softwarePtr->version = "4.20";
264 
265  b.softwarePtr = SoftwarePtr(new Software("XCalibur"));
266  b.softwarePtr->version = "4.20";
267 
269  unit_assert(!diff);
270 
272  b.componentList.source(0).order = 2;
273  b.componentList.detector(0).order = 1;
274 
275  diff(a, b);
276  if (os_) *os_ << diff << endl;
277  unit_assert(diff);
278 }
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
boost::shared_ptr< Software > SoftwarePtr
Definition: MSData.hpp:197
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
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
MS_nanoelectrospray
nanoelectrospray: Electrospray ionization at a flow rate less than ~25 nL/min. Nanoelectrospray is sy...
Definition: cv.hpp:1612
MS_electron_multiplier
electron multiplier: A device to amplify the current of a beam or packet of charged particles or phot...
Definition: cv.hpp:1060
int order
this attribute MUST be used to indicate the order in which the components are encountered from source...
Definition: MSData.hpp:136
MS_LCQ_Deca
LCQ Deca: ThermoFinnigan LCQ Deca.
Definition: cv.hpp:2119
Component & source(size_t index)
returns the source component with ordinal <index+1>
void diff(const string &filename1, const string &filename2)
MS_instrument_serial_number
instrument serial number: Serial Number of the instrument.
Definition: cv.hpp:2041
ostream * os_
Definition: DiffTest.cpp:40
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
A piece of software.
Definition: MSData.hpp:178
Description of a particular hardware configuration of a mass spectrometer. Each configuration MUST ha...
Definition: MSData.hpp:228
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
MS_quadrupole_ion_trap
quadrupole ion trap: Quadrupole Ion Trap mass analyzer captures the ions in a three dimensional ion t...
Definition: cv.hpp:385
Component & detector(size_t index)
returns the detector component with ordinal <index+1>
MS_reflectron_off
reflectron off: Reflectron is off.
Definition: cv.hpp:472
std::string id
an identifier for this instrument configuration.
Definition: MSData.hpp:231
#define unit_assert(x)
Definition: unit.hpp:85
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44

§ testProcessingMethod()

void testProcessingMethod ( )

Definition at line 281 of file DiffTest.cpp.

References diff(), pwiz::msdata::ProcessingMethod::order, os_, pwiz::msdata::ProcessingMethod::softwarePtr, unit_assert, and pwiz::data::ParamContainer::userParams.

Referenced by test().

282 {
283  if (os_) *os_ << "testProcessingMethod()\n";
284 
285  ProcessingMethod a, b;
286  a.userParams.push_back(UserParam("common"));
287  b.userParams.push_back(UserParam("common"));
288 
290  unit_assert(!diff);
291 
292  a.order = 420;
293  b.order = 421;
294  diff(a, b);
295  if (os_) *os_ << diff << endl;
296  unit_assert(diff);
297 
298  b.order = 420;
299  diff(a, b);
300  if (os_) *os_ << diff << endl;
301  unit_assert(!diff);
302 
303  a.softwarePtr = SoftwarePtr(new Software("pwiz"));
304  b.softwarePtr = SoftwarePtr(new Software("pwiz2"));
305  diff(a, b);
306  if (os_) *os_ << diff << endl;
307  unit_assert(diff);
308 }
boost::shared_ptr< Software > SoftwarePtr
Definition: MSData.hpp:197
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
SoftwarePtr softwarePtr
this attribute MUST reference the &#39;id&#39; of the appropriate SoftwareType.
Definition: MSData.hpp:259
void diff(const string &filename1, const string &filename2)
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
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:253
int order
this attributes allows a series of consecutive steps to be placed in the correct order.
Definition: MSData.hpp:256
ostream * os_
Definition: DiffTest.cpp:40
A piece of software.
Definition: MSData.hpp:178
#define unit_assert(x)
Definition: unit.hpp:85

§ testDataProcessing()

void testDataProcessing ( )

Definition at line 311 of file DiffTest.cpp.

References diff(), pwiz::msdata::DataProcessing::id, os_, pwiz::msdata::DataProcessing::processingMethods, pwiz::msdata::ProcessingMethod::softwarePtr, unit_assert, and pwiz::data::ParamContainer::userParams.

Referenced by test().

312 {
313  if (os_) *os_ << "testDataProcessing()\n";
314 
315  DataProcessing a, b;
316  a.id = "dp1";
317 
318  b = a;
319 
320  ProcessingMethod pm1, pm2, pm3;
321  pm1.userParams.push_back(UserParam("abc"));
322  pm2.userParams.push_back(UserParam("def"));
323  pm3.userParams.push_back(UserParam("ghi"));
324 
325  pm1.softwarePtr = SoftwarePtr(new Software("msdata"));
326  pm1.softwarePtr->version = "4.20";
327 
328  pm2.softwarePtr = SoftwarePtr(new Software("msdata"));
329  pm2.softwarePtr->version = "4.20";
330 
331  a.processingMethods.push_back(pm1);
332  a.processingMethods.push_back(pm2);
333  b.processingMethods.push_back(pm2);
334  b.processingMethods.push_back(pm1);
335 
337  unit_assert(!diff);
338 
339  pm2.softwarePtr = SoftwarePtr(new Software("Xcalibur"));
340  a.processingMethods.push_back(pm3);
341 
342  diff(a, b);
343 
344  if (os_) *os_ << diff << endl;
345  unit_assert(diff);
346 }
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
boost::shared_ptr< Software > SoftwarePtr
Definition: MSData.hpp:197
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
std::vector< ProcessingMethod > processingMethods
description of the default peak processing method(s). This element describes the base method used in ...
Definition: MSData.hpp:278
SoftwarePtr softwarePtr
this attribute MUST reference the &#39;id&#39; of the appropriate SoftwareType.
Definition: MSData.hpp:259
void diff(const string &filename1, const string &filename2)
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
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:253
ostream * os_
Definition: DiffTest.cpp:40
std::string id
a unique identifier for this data processing that is unique across all DataProcessingTypes.
Definition: MSData.hpp:275
A piece of software.
Definition: MSData.hpp:178
#define unit_assert(x)
Definition: unit.hpp:85

§ testScanSettings()

void testScanSettings ( )

Definition at line 349 of file DiffTest.cpp.

References pwiz::data::Diff< object_type, config_type, object_result_type >::a_b, pwiz::data::Diff< object_type, config_type, object_result_type >::b_a, diff(), pwiz::msdata::ScanSettings::id, os_, pwiz::msdata::ScanSettings::sourceFilePtrs, pwiz::msdata::ScanSettings::targets, and unit_assert.

Referenced by test().

350 {
351  if (os_) *os_ << "testScanSettings()\n";
352 
353  ScanSettings a, b;
354  a.id = "as1";
355 
356  b = a;
357 
359  unit_assert(!diff);
360 
361  b.sourceFilePtrs.push_back(SourceFilePtr(new SourceFile("source file")));
362  a.targets.resize(2);
363 
364  diff(a, b);
365 
366  if (os_) *os_ << diff << endl;
367  unit_assert(diff);
368  unit_assert(diff.a_b.sourceFilePtrs.empty());
369  unit_assert(diff.b_a.sourceFilePtrs.size() == 1);
370  unit_assert(diff.a_b.targets.size() == 2);
371  unit_assert(diff.b_a.targets.empty());
372 }
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
std::vector< Target > targets
target list (or &#39;inclusion list&#39;) configured prior to the run.
Definition: MSData.hpp:214
ostream * os_
Definition: DiffTest.cpp:40
std::string id
a unique identifier for this acquisition setting.
Definition: MSData.hpp:208
std::vector< SourceFilePtr > sourceFilePtrs
container for a list of source file references.
Definition: MSData.hpp:211
Implementation of SourceFileType from the mzIdentML schema.
Definition: IdentData.hpp:923
Description of the acquisition settings of the instrument prior to the start of the run...
Definition: MSData.hpp:205
#define unit_assert(x)
Definition: unit.hpp:85
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition: MSData.hpp:75

§ testPrecursor()

void testPrecursor ( )

Definition at line 375 of file DiffTest.cpp.

References pwiz::data::Diff< object_type, config_type, object_result_type >::a_b, pwiz::msdata::Precursor::activation, pwiz::data::Diff< object_type, config_type, object_result_type >::b_a, pwiz::data::ParamContainer::cvParam(), pwiz::data::ParamContainer::cvParams, diff(), pwiz::msdata::Precursor::isolationWindow, MS_ionization_type, MS_m_z, MS_reflectron_off, MS_reflectron_on, os_, pwiz::msdata::Precursor::selectedIons, pwiz::data::ParamContainer::set(), pwiz::msdata::Precursor::spectrumID, unit_assert, pwiz::data::ParamContainer::userParams, and pwiz::data::CVParam::valueAs().

Referenced by test().

376 {
377  if (os_) *os_ << "testPrecursor()\n";
378 
379  Precursor a, b;
380 
381  a.spectrumID = "1234";
382  a.activation.cvParams.push_back(CVParam(MS_ionization_type, 420));
383  a.selectedIons.resize(1);
384  a.selectedIons[0].cvParams.push_back(MS_reflectron_on);
385  a.cvParams.push_back(MS_reflectron_off);
386  b = a;
387 
389  unit_assert(!diff);
390 
391  a.cvParams.push_back(MS_reflectron_on);
392  a.selectedIons[0].userParams.push_back(UserParam("aaaa"));
393  b.activation.userParams.push_back(UserParam("bbbb"));
394  b.isolationWindow.set(MS_m_z, 200);
395 
396  diff(a, b);
397 
398  if (os_) *os_ << diff << endl;
399  unit_assert(diff);
400  unit_assert(!diff.a_b.selectedIons.empty());
401  unit_assert(!diff.a_b.selectedIons[0].userParams.empty());
402  unit_assert(!diff.b_a.selectedIons.empty());
403  unit_assert(diff.b_a.isolationWindow.cvParam(MS_m_z).valueAs<int>() == 200);
404 }
The method of precursor ion selection and activation.
Definition: MSData.hpp:310
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
IsolationWindow isolationWindow
this element captures the isolation (or &#39;selection&#39;) window configured to isolate one or more precurs...
Definition: MSData.hpp:325
void diff(const string &filename1, const string &filename2)
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
Definition: ParamTypes.hpp:185
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:253
std::string spectrumID
reference to the id attribute of the spectrum from which the precursor was selected.
Definition: MSData.hpp:322
MS_m_z
m/z: Three-character symbol m/z is used to denote the quantity formed by dividing the mass of an ion ...
Definition: cv.hpp:223
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:124
ostream * os_
Definition: DiffTest.cpp:40
Activation activation
the type and energy level used for activation.
Definition: MSData.hpp:331
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
MS_reflectron_on
reflectron on: Reflectron is on.
Definition: cv.hpp:475
std::vector< SelectedIon > selectedIons
this list of precursor ions that were selected.
Definition: MSData.hpp:328
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
MS_reflectron_off
reflectron off: Reflectron is off.
Definition: cv.hpp:472
#define unit_assert(x)
Definition: unit.hpp:85
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44

§ testProduct()

void testProduct ( )

Definition at line 407 of file DiffTest.cpp.

References pwiz::data::Diff< object_type, config_type, object_result_type >::a_b, pwiz::data::Diff< object_type, config_type, object_result_type >::b_a, pwiz::data::ParamContainer::cvParams, diff(), pwiz::msdata::Product::isolationWindow, MS_ionization_type, MS_m_z, os_, pwiz::data::ParamContainer::set(), and unit_assert.

Referenced by test().

408 {
409  if (os_) *os_ << "testProduct()\n";
410 
411  Product a, b;
412 
414  b = a;
415 
417  unit_assert(!diff);
418 
419  b.isolationWindow.set(MS_m_z, 200);
420 
421  diff(a, b);
422 
423  if (os_) *os_ << diff << endl;
424  unit_assert(diff);
425  unit_assert(diff.a_b.isolationWindow.cvParams.empty());
426  unit_assert(diff.b_a.isolationWindow.cvParams.size() == 1);
427 }
IsolationWindow isolationWindow
this element captures the isolation (or &#39;selection&#39;) window configured to isolate one or more precurs...
Definition: MSData.hpp:349
product ion information
Definition: MSData.hpp:346
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
MS_m_z
m/z: Three-character symbol m/z is used to denote the quantity formed by dividing the mass of an ion ...
Definition: cv.hpp:223
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:124
ostream * os_
Definition: DiffTest.cpp:40
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
#define unit_assert(x)
Definition: unit.hpp:85

§ testScan()

void testScan ( )

Definition at line 430 of file DiffTest.cpp.

References pwiz::data::Diff< object_type, config_type, object_result_type >::b_a, pwiz::data::ParamContainer::cvParams, diff(), pwiz::msdata::Scan::instrumentConfigurationPtr, MS_ionization_type, MS_m_z, os_, pwiz::msdata::Scan::scanWindows, and unit_assert.

Referenced by test().

431 {
432  if (os_) *os_ << "testScan()\n";
433 
434  Scan a, b;
435 
437  ip->id = "LTQ FT";
438 
439  a.cvParams.push_back(CVParam(MS_ionization_type, 420));
441  a.scanWindows.push_back(ScanWindow());
442  b = a;
443 
445  unit_assert(!diff);
446 
447  b.scanWindows.push_back(ScanWindow(250.0, 2000.0, MS_m_z));
448  diff(a, b);
449 
450  if (os_) *os_ << diff << endl;
451  unit_assert(diff);
452  unit_assert(diff.b_a.scanWindows.size() == 1);
453 }
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile...
Definition: MSData.hpp:368
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
void diff(const string &filename1, const string &filename2)
MS_m_z
m/z: Three-character symbol m/z is used to denote the quantity formed by dividing the mass of an ion ...
Definition: cv.hpp:223
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:124
ostream * os_
Definition: DiffTest.cpp:40
std::vector< ScanWindow > scanWindows
container for a list of select windows.
Definition: MSData.hpp:386
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
InstrumentConfigurationPtr instrumentConfigurationPtr
this attribute MUST reference the &#39;id&#39; attribute of the appropriate instrument configuration.
Definition: MSData.hpp:383
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
#define unit_assert(x)
Definition: unit.hpp:85
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44

§ testScanList()

void testScanList ( )

Definition at line 456 of file DiffTest.cpp.

References pwiz::data::ParamContainer::cvParams, diff(), MS_filter_string, MS_reflectron_on, MS_scan_start_time, os_, pwiz::msdata::ScanList::scans, pwiz::data::ParamContainer::set(), unit_assert, and UO_minute.

Referenced by test().

457 {
458  if (os_) *os_ << "testScanList()\n";
459 
460  ScanList a, b;
461 
462  Scan a1;
463  a1.set(MS_filter_string, "booger");
464  a1.set(MS_scan_start_time, "4.20", UO_minute);
465 
466  Scan a2;
467  a1.set(MS_filter_string, "goober");
468  a1.set(MS_scan_start_time, "6.66", UO_minute);
469 
470  a.scans.push_back(a1);
471  a.scans.push_back(a2);
472  b.scans.push_back(a2);
473  b.scans.push_back(a1);
474 
476  unit_assert(!diff);
477 
478  a.cvParams.push_back(MS_reflectron_on);
479 
480  diff(a, b);
481 
482  if (os_) *os_ << diff << endl;
483  unit_assert(diff);
484 }
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile...
Definition: MSData.hpp:368
MS_scan_start_time
scan start time: The time that an analyzer started a scan, relative to the start of the MS run...
Definition: cv.hpp:148
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
MS_filter_string
filter string: A string unique to Thermo instrument describing instrument settings for the scan...
Definition: cv.hpp:1990
void diff(const string &filename1, const string &filename2)
ostream * os_
Definition: DiffTest.cpp:40
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
MS_reflectron_on
reflectron on: Reflectron is on.
Definition: cv.hpp:475
UO_minute
minute: A time unit which is equal to 60 seconds.
Definition: cv.hpp:12589
std::vector< Scan > scans
Definition: MSData.hpp:396
List and descriptions of scans.
Definition: MSData.hpp:394
void set(CVID cvid, const std::string &value="", CVID units=CVID_Unknown)
set/add a CVParam (not recursive)
#define unit_assert(x)
Definition: unit.hpp:85

§ testBinaryDataArray()

void testBinaryDataArray ( )

Definition at line 487 of file DiffTest.cpp.

References pwiz::msdata::BinaryDataArray::data, pwiz::msdata::BinaryDataArray::dataProcessingPtr, diff(), os_, pwiz::data::BaseDiffConfig::precision, and unit_assert.

Referenced by test().

488 {
489  if (os_) *os_ << "testBinaryDataArray()\n";
490 
491  vector<double> data;
492  for (int i=0; i<10; i++) data.push_back(i);
493 
494  BinaryDataArray a, b;
495  a.data = data;
497  b = a;
498 
499  DiffConfig config;
500  config.precision = 1e-4;
501 
502  a.data[9] = 1.00001e10;
503  b.data[9] = 1.00000e10;
504 
505  // we want to verify relative precision diff (1e-5),
506  // not absolute diff (1e5)
507 
509  if (diff && os_) *os_ << diff << endl;
510  unit_assert(!diff);
511 
512  b.data[9] = 1.0002e10;
513 
514  diff(a, b);
515 
516  if (diff && os_) *os_ << diff << endl;
517  unit_assert(diff);
518 }
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
DataProcessingPtr dataProcessingPtr
this optional attribute may reference the &#39;id&#39; attribute of the appropriate dataProcessing.
Definition: MSData.hpp:406
void diff(const string &filename1, const string &filename2)
ostream * os_
Definition: DiffTest.cpp:40
std::vector< double > data
the binary data.
Definition: MSData.hpp:409
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:403
#define unit_assert(x)
Definition: unit.hpp:85

§ testSpectrum()

void testSpectrum ( )

Definition at line 521 of file DiffTest.cpp.

References pwiz::msdata::Spectrum::binaryDataArrayPtrs, pwiz::msdata::Spectrum::dataProcessingPtr, pwiz::msdata::Spectrum::defaultArrayLength, diff(), pwiz::msdata::SpectrumIdentity::id, pwiz::msdata::SpectrumIdentity::index, MS_filter_string, MS_ionization_type, MS_m_z, MS_scan_start_time, os_, pwiz::data::BaseDiffConfig::precision, pwiz::msdata::Spectrum::precursors, pwiz::msdata::Spectrum::products, pwiz::msdata::Spectrum::scanList, pwiz::msdata::ScanList::scans, pwiz::msdata::Spectrum::sourceFilePtr, unit_assert, and UO_minute.

Referenced by test().

522 {
523  if (os_) *os_ << "testSpectrum()\n";
524 
525  Spectrum a, b;
526 
527  a.id = "goober";
528  a.index = 1;
530  a.scanList.scans.push_back(Scan());
531  a.scanList.scans.back().instrumentConfigurationPtr = InstrumentConfigurationPtr(new InstrumentConfiguration("LTQ FT"));
532  a.scanList.scans.back().paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("CommonMS1SpectrumParams")));
533  a.scanList.scans.back().cvParams.push_back(CVParam(MS_scan_start_time, 5.890500, UO_minute));
534  a.scanList.scans.back().cvParams.push_back(CVParam(MS_filter_string, "+ c NSI Full ms [ 400.00-1800.00]"));
535  a.scanList.scans.back().scanWindows.push_back(ScanWindow(400.0, 1800.0, MS_m_z));
536 
537  b = a;
538 
539  DiffConfig config;
540  config.precision = 1e-6;
541  Diff<Spectrum, DiffConfig> diff(a, b, config);
542  if (diff) cout << diff;
543  unit_assert(!diff);
544 
545  b.index = 4;
546  b.defaultArrayLength = 22;
548  b.sourceFilePtr = SourceFilePtr(new SourceFile("test.raw"));
549  a.precursors.push_back(Precursor());
550  a.precursors.back().spectrumID = "666";
551  b.products.push_back(Product());
552  b.products.back().isolationWindow.set(MS_ionization_type, 420);
554  a.binaryDataArrayPtrs.back()->data.resize(6);
556  b.binaryDataArrayPtrs.back()->data.resize(7);
557  b.binaryDataArrayPtrs.push_back(a.binaryDataArrayPtrs[0]);
558 
559  diff(a, b);
560 
561  if (os_) *os_ << diff << endl;
562  unit_assert(diff);
563 
564  unit_assert(diff.a_b.index == 1);
565  unit_assert(diff.a_b.id == "goober");
566  unit_assert(diff.a_b.defaultArrayLength == 0);
567  unit_assert(diff.a_b.dataProcessingPtr->id == "msdata 2");
568  unit_assert(diff.a_b.precursors.size() == 1);
569  unit_assert(diff.a_b.products.empty());
570  unit_assert(diff.a_b.binaryDataArrayPtrs.empty());
571 
572  unit_assert(diff.b_a.index == 4);
573  unit_assert(diff.b_a.id == "goober");
574  unit_assert(diff.b_a.defaultArrayLength == 22);
575  unit_assert(diff.b_a.dataProcessingPtr->id == "msdata");
576  unit_assert(diff.b_a.precursors.empty());
577  unit_assert(diff.b_a.products.size() == 1);
578  unit_assert(diff.b_a.binaryDataArrayPtrs.empty());
579 
580  b = a;
581 
582  unit_assert(a.binaryDataArrayPtrs.size() == 1);
583  b.binaryDataArrayPtrs[0] = BinaryDataArrayPtr(new BinaryDataArray);
584  b.binaryDataArrayPtrs[0]->data.resize(6);
585 
586  a.binaryDataArrayPtrs[0]->data[0] = 420;
587  b.binaryDataArrayPtrs[0]->data[0] = 420 + 1e-12;
588 
589  diff(a,b);
590  if (os_ && diff) *os_ << diff << endl;
591  unit_assert(!diff);
592 
593  b.binaryDataArrayPtrs[0]->data[0] += 1e-3;
594  diff(a,b);
595  if (os_ && diff) *os_ << diff << endl;
596  unit_assert(diff);
597 }
std::vector< Product > products
list and descriptions of product ion information
Definition: MSData.hpp:522
product ion information
Definition: MSData.hpp:346
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
ScanList scanList
list of scans
Definition: MSData.hpp:516
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:239
Scan or acquisition from original raw file used to create this peak list, as specified in sourceFile...
Definition: MSData.hpp:368
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
MS_scan_start_time
scan start time: The time that an analyzer started a scan, relative to the start of the MS run...
Definition: cv.hpp:148
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
std::vector< Precursor > precursors
list and descriptions of precursors to the spectrum currently being described.
Definition: MSData.hpp:519
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
MS_filter_string
filter string: A string unique to Thermo instrument describing instrument settings for the scan...
Definition: cv.hpp:1990
void diff(const string &filename1, const string &filename2)
std::string id
a unique identifier for this spectrum. It should be expected that external files may use this identif...
Definition: MSData.hpp:475
size_t defaultArrayLength
default length of binary data arrays contained in this element.
Definition: MSData.hpp:507
MS_m_z
m/z: Three-character symbol m/z is used to denote the quantity formed by dividing the mass of an ion ...
Definition: cv.hpp:223
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
Definition: cv.hpp:124
ostream * os_
Definition: DiffTest.cpp:40
size_t index
the zero-based, consecutive index of the spectrum in the SpectrumList.
Definition: MSData.hpp:472
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Definition: ParamTypes.hpp:324
UO_minute
minute: A time unit which is equal to 60 seconds.
Definition: cv.hpp:12589
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
Implementation of SourceFileType from the mzIdentML schema.
Definition: IdentData.hpp:923
SourceFilePtr sourceFilePtr
this attribute can optionally reference the &#39;id&#39; of the appropriate sourceFile.
Definition: MSData.hpp:513
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
#define unit_assert(x)
Definition: unit.hpp:85
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: MSData.hpp:416
represents a tag-value pair, where the tag comes from the controlled vocabulary
Definition: ParamTypes.hpp:44
boost::shared_ptr< SourceFile > SourceFilePtr
Description of the source file, including location and type.
Definition: MSData.hpp:75

§ testChromatogram()

void testChromatogram ( )

Definition at line 600 of file DiffTest.cpp.

References pwiz::msdata::Chromatogram::binaryDataArrayPtrs, pwiz::msdata::Chromatogram::dataProcessingPtr, diff(), pwiz::msdata::ChromatogramIdentity::id, pwiz::msdata::ChromatogramIdentity::index, os_, pwiz::data::BaseDiffConfig::precision, and unit_assert.

Referenced by test().

601 {
602  if (os_) *os_ << "testChromatogram()\n";
603 
604  Chromatogram a, b;
605 
606  a.id = "goober";
607  a.index = 1;
610  a.binaryDataArrayPtrs.back()->data.resize(6);
611 
612  b = a;
613 
614  DiffConfig config;
615  config.precision = 1e-6;
616  Diff<Chromatogram, DiffConfig> diff(a, b, config);
617  if (diff) cout << diff;
618  unit_assert(!diff);
619 
621  b.binaryDataArrayPtrs[0]->data.resize(6);
622 
623  a.binaryDataArrayPtrs[0]->data[0] = 420;
624  b.binaryDataArrayPtrs[0]->data[0] = 420 + 1e-12;
625 
626  diff(a,b);
627  if (os_ && diff) *os_ << diff << endl;
628  unit_assert(!diff);
629 
630  b.binaryDataArrayPtrs[0]->data[0] += 1e-3;
631  diff(a,b);
632  if (os_ && diff) *os_ << diff << endl;
633  unit_assert(diff);
634 }
std::string id
a unique identifier for this chromatogram. It should be expected that external files may use this ide...
Definition: MSData.hpp:494
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
size_t index
the zero-based, consecutive index of the chromatogram in the ChromatogramList.
Definition: MSData.hpp:491
A single chromatogram.
Definition: MSData.hpp:573
void diff(const string &filename1, const string &filename2)
ostream * os_
Definition: DiffTest.cpp:40
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:403
DataProcessingPtr dataProcessingPtr
this attribute can optionally reference the &#39;id&#39; of the appropriate dataProcessing.
Definition: MSData.hpp:579
std::vector< BinaryDataArrayPtr > binaryDataArrayPtrs
list of binary data arrays.
Definition: MSData.hpp:588
#define unit_assert(x)
Definition: unit.hpp:85
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: MSData.hpp:416

§ testSpectrumList()

void testSpectrumList ( )

Definition at line 637 of file DiffTest.cpp.

References pwiz::data::Diff< object_type, config_type, object_result_type >::a_b, pwiz::data::Diff< object_type, config_type, object_result_type >::b_a, diff(), pwiz::msdata::SpectrumListSimple::dp, os_, pwiz::data::BaseDiffConfig::precision, pwiz::msdata::SpectrumListSimple::spectra, and unit_assert.

Referenced by test().

638 {
639  if (os_) *os_ << "testSpectrumList()\n";
640 
641  SpectrumListSimple aSimple, bSimple;
642 
643  SpectrumPtr spectrum1a = SpectrumPtr(new Spectrum);
644  spectrum1a->id = "420";
645 
646  SpectrumPtr spectrum1b = SpectrumPtr(new Spectrum);
647  spectrum1b->id = "420";
648 
649  aSimple.spectra.push_back(spectrum1a);
650  bSimple.spectra.push_back(spectrum1b);
651 
652  SpectrumList& a = aSimple;
653  SpectrumList& b = bSimple;
654 
656  unit_assert(!diff);
657 
658  // check: dataProcessingPtr
659 
660  aSimple.dp = DataProcessingPtr(new DataProcessing("dp"));
661  diff(a, b);
662  unit_assert(diff);
663 
664  DiffConfig config_ignore;
665  config_ignore.ignoreDataProcessing = true;
666  Diff<SpectrumList, DiffConfig, SpectrumListSimple> diff_ignore(a, b, config_ignore);
667  unit_assert(!diff_ignore);
668 
669  aSimple.dp = DataProcessingPtr();
670  diff(a, b);
671  unit_assert(!diff);
672 
673  // check: different SpectrumList::size()
674 
675  SpectrumPtr spectrum2 = SpectrumPtr(new Spectrum);
676  spectrum2->id = "421";
677  aSimple.spectra.push_back(spectrum2);
678 
679  diff(a, b);
680  if (os_) *os_ << diff << endl;
681  unit_assert(diff);
682  unit_assert(diff.a_b.spectra.size() == 1);
683  unit_assert(diff.a_b.spectra[0]->userParams.size() == 1);
684 
685  // check: same SpectrumList::size(), different last scan number
686 
687  SpectrumPtr spectrum3 = SpectrumPtr(new Spectrum);
688  spectrum3->id = "422";
689  bSimple.spectra.push_back(spectrum3);
690 
691  diff(a, b);
692  if (os_) *os_ << diff << endl;
693  unit_assert(diff);
694  unit_assert(diff.a_b.spectra.size() == 1);
695  unit_assert(diff.a_b.spectra[0]->id == "421");
696  unit_assert(diff.b_a.spectra.size() == 1);
697  unit_assert(diff.b_a.spectra[0]->id == "422");
698 
699  // check: scan numbers match, binary data slightly different
700 
701  spectrum3->id = "421";
704  b1->data.resize(10);
705  b2->data.resize(10);
706  for (int i=0; i<10; i++)
707  b1->data[i] = b2->data[i] = i;
708  b2->data[2] += 1e-7;
709  spectrum2->binaryDataArrayPtrs.push_back(b1);
710  spectrum3->binaryDataArrayPtrs.push_back(b2);
711 
712  DiffConfig config;
713  config.precision = 1e-6;
714 
716  unit_assert(!diffWide);
717 
718  config.precision = 1e-12;
720  if (os_) *os_ << diffNarrow << endl;
721  unit_assert(diffNarrow);
722 }
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:569
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW...
Definition: MSData.hpp:656
void diff(const string &filename1, const string &filename2)
ostream * os_
Definition: DiffTest.cpp:40
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:403
std::vector< SpectrumPtr > spectra
Definition: MSData.hpp:714
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
Definition: MSData.hpp:504
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:712
#define unit_assert(x)
Definition: unit.hpp:85
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: MSData.hpp:416

§ testChromatogramList()

void testChromatogramList ( )

Definition at line 725 of file DiffTest.cpp.

References pwiz::data::Diff< object_type, config_type, object_result_type >::a_b, pwiz::data::Diff< object_type, config_type, object_result_type >::b_a, pwiz::msdata::ChromatogramListSimple::chromatograms, diff(), pwiz::msdata::ChromatogramListSimple::dp, os_, pwiz::data::BaseDiffConfig::precision, and unit_assert.

Referenced by test().

726 {
727  if (os_) *os_ << "testChromatogramList()\n";
728 
729  ChromatogramListSimple aSimple, bSimple;
730 
731  ChromatogramPtr chromatogram1a = ChromatogramPtr(new Chromatogram);
732  chromatogram1a->id = "420";
733 
734  ChromatogramPtr chromatogram1b = ChromatogramPtr(new Chromatogram);
735  chromatogram1b->id = "420";
736 
737  aSimple.chromatograms.push_back(chromatogram1a);
738  bSimple.chromatograms.push_back(chromatogram1b);
739 
740  ChromatogramList& a = aSimple;
741  ChromatogramList& b = bSimple;
742 
744  DiffConfig config_ignore;
745  config_ignore.ignoreChromatograms = true;
746 
747  Diff<ChromatogramList, DiffConfig, ChromatogramListSimple> diffIgnore(a, b, config_ignore);
748  unit_assert(!diff);
749  unit_assert(!diffIgnore);
750 
751  // check: dataProcessingPtr
752 
753  aSimple.dp = DataProcessingPtr(new DataProcessing("dp"));
754  diff(a, b);
755  unit_assert(diff);
756 
757  DiffConfig config_ignore_dp;
758  config_ignore_dp.ignoreDataProcessing = true;
759  Diff<ChromatogramList, DiffConfig, ChromatogramListSimple> diff_ignore_dp(a, b, config_ignore_dp);
760  unit_assert(!diff_ignore_dp);
761 
762  aSimple.dp = DataProcessingPtr();
763  diff(a, b);
764  unit_assert(!diff);
765 
766  // check: different ChromatogramList::size()
767 
768  ChromatogramPtr chromatogram2 = ChromatogramPtr(new Chromatogram);
769  chromatogram2->id = "421";
770  aSimple.chromatograms.push_back(chromatogram2);
771 
772  diff(a, b);
773  if (os_) *os_ << diff << endl;
774  unit_assert(diff);
775  unit_assert(diff.a_b.chromatograms.size() == 1);
776  unit_assert(diff.a_b.chromatograms[0]->userParams.size() == 1);
777 
778  diffIgnore(a,b);
779  if (os_) *os_ << diffIgnore << endl;
780  unit_assert(!diffIgnore);
781 
782  // check: same ChromatogramList::size(), different last scan number
783 
784  ChromatogramPtr chromatogram3 = ChromatogramPtr(new Chromatogram);
785  chromatogram3->id = "422";
786  bSimple.chromatograms.push_back(chromatogram3);
787 
788  diff(a, b);
789  if (os_) *os_ << diff << endl;
790  unit_assert(diff);
791  unit_assert(diff.a_b.chromatograms.size() == 1);
792  unit_assert(diff.a_b.chromatograms[0]->id == "421");
793  unit_assert(diff.b_a.chromatograms.size() == 1);
794  unit_assert(diff.b_a.chromatograms[0]->id == "422");
795 
796  diffIgnore(a,b);
797  unit_assert(!diffIgnore);
798 
799  // check: scan numbers match, binary data slightly different
800 
801  chromatogram3->id = "421";
804  b1->data.resize(10);
805  b2->data.resize(10);
806  for (int i=0; i<10; i++)
807  b1->data[i] = b2->data[i] = i;
808  b2->data[2] += 1e-7;
809  chromatogram2->binaryDataArrayPtrs.push_back(b1);
810  chromatogram3->binaryDataArrayPtrs.push_back(b2);
811 
812  DiffConfig config;
813  config.precision = 1e-6;
814 
816  unit_assert(!diffWide);
817 
818  config.precision = 1e-12;
820  if (os_) *os_ << diffNarrow << endl;
821  unit_assert(diffNarrow);
822 
823  diffIgnore(a,b);
824  unit_assert(!diffIgnore);
825 }
Interface for accessing chromatograms, which may be stored in memory or backed by a data file (RAW...
Definition: MSData.hpp:752
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
std::vector< ChromatogramPtr > chromatograms
Definition: MSData.hpp:788
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
A single chromatogram.
Definition: MSData.hpp:573
void diff(const string &filename1, const string &filename2)
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:786
ostream * os_
Definition: DiffTest.cpp:40
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:403
#define unit_assert(x)
Definition: unit.hpp:85
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:620
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: MSData.hpp:416

§ testRun()

void testRun ( )

Definition at line 828 of file DiffTest.cpp.

References pwiz::data::Diff< object_type, config_type, object_result_type >::a_b, pwiz::data::Diff< object_type, config_type, object_result_type >::b_a, pwiz::msdata::Run::chromatogramListPtr, pwiz::msdata::Run::defaultInstrumentConfigurationPtr, pwiz::msdata::Run::defaultSourceFilePtr, diff(), pwiz::msdata::Run::id, os_, pwiz::msdata::Run::samplePtr, pwiz::msdata::Run::spectrumListPtr, pwiz::msdata::Run::startTimeStamp, and unit_assert.

Referenced by test().

829 {
830  if (os_) *os_ << "testRun()\n";
831 
832  Run a, b;
833 
834  a.id = "goober";
835  a.startTimeStamp = "20 April 2004 4:20pm";
836  b.id = "goober";
837  b.startTimeStamp = "20 April 2004 4:20pm";
838 
840  unit_assert(!diff);
841 
842  b.id = "raisinet";
843 
844  shared_ptr<SpectrumListSimple> spectrumList1(new SpectrumListSimple);
845  spectrumList1->spectra.push_back(SpectrumPtr(new Spectrum));
846  spectrumList1->spectra.back()->id = "spectrum1";
847  a.spectrumListPtr = spectrumList1;
848 
849  shared_ptr<ChromatogramListSimple> chromatogramList1(new ChromatogramListSimple);
850  chromatogramList1->chromatograms.push_back(ChromatogramPtr(new Chromatogram));
851  chromatogramList1->chromatograms.back()->id = "chromatogram1";
852  b.chromatogramListPtr = chromatogramList1;
853 
854  // same ref id
857 
858  b.samplePtr = SamplePtr(new Sample("sample"));
859  a.defaultSourceFilePtr = SourceFilePtr(new SourceFile("source file"));
860 
861  diff(a, b);
862  if (os_) *os_ << diff << endl;
863  unit_assert(diff);
864 
865  unit_assert(diff.a_b.spectrumListPtr->size() == 1);
866  unit_assert(diff.a_b.spectrumListPtr->spectrum(0)->userParams.size() == 1);
867 
868  unit_assert(diff.a_b.chromatogramListPtr.get());
869  unit_assert(diff.a_b.chromatogramListPtr->size() == 1);
870  unit_assert(diff.a_b.chromatogramListPtr->chromatogram(0)->userParams.size() == 1);
871 
872  unit_assert(!diff.a_b.defaultInstrumentConfigurationPtr.get());
873  unit_assert(!diff.b_a.defaultInstrumentConfigurationPtr.get());
874 
875  unit_assert(!diff.a_b.samplePtr.get());
876  unit_assert(!diff.b_a.samplePtr->empty());
877 
878  unit_assert(diff.a_b.defaultSourceFilePtr.get());
879  unit_assert(!diff.b_a.defaultSourceFilePtr.get());
880 
881  unit_assert(diff.a_b.startTimeStamp.empty());
882  unit_assert(diff.b_a.startTimeStamp.empty());
883 }
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
Definition: MSData.hpp:826
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:569
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
A single chromatogram.
Definition: MSData.hpp:573
std::string id
a unique identifier for this run.
Definition: MSData.hpp:808
void diff(const string &filename1, const string &filename2)
SourceFilePtr defaultSourceFilePtr
default source file reference
Definition: MSData.hpp:820
A run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:805
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:786
ostream * os_
Definition: DiffTest.cpp:40
std::string startTimeStamp
the optional start timestamp of the run, in UT.
Definition: MSData.hpp:817
Implementation of the SampleType from the mzIdentML schema.
Definition: IdentData.hpp:195
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
Implementation of SourceFileType from the mzIdentML schema.
Definition: IdentData.hpp:923
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
boost::shared_ptr< Sample > SamplePtr
Definition: MSData.hpp:117
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
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:712
#define unit_assert(x)
Definition: unit.hpp:85
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:620
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

§ testMSData()

void testMSData ( )

Definition at line 888 of file DiffTest.cpp.

References pwiz::data::Diff< object_type, config_type, object_result_type >::a_b, pwiz::msdata::MSData::accession, pwiz::data::Diff< object_type, config_type, object_result_type >::b_a, pwiz::data::ParamContainer::cvParams, pwiz::msdata::MSData::cvs, pwiz::msdata::MSData::dataProcessingPtrs, diff(), pwiz::msdata::FileDescription::empty(), pwiz::msdata::Run::empty(), pwiz::msdata::FileDescription::fileContent, pwiz::msdata::MSData::fileDescription, pwiz::msdata::Run::id, pwiz::msdata::MSData::id, pwiz::msdata::MSData::instrumentConfigurationPtrs, MS_reflectron_on, os_, pwiz::msdata::MSData::paramGroupPtrs, pwiz::msdata::MSData::run, pwiz::msdata::MSData::samplePtrs, pwiz::msdata::MSData::scanSettingsPtrs, pwiz::msdata::MSData::softwarePtrs, unit_assert, and MSDataWithSettableVersion::version().

Referenced by test().

889 {
890  if (os_) *os_ << "testMSData()\n";
891 
893 
894  a.id = "goober";
895  b.id = "goober";
896 
898  unit_assert(!diff);
899 
900  a.accession = "different";
901  b.version("version");
902  a.cvs.push_back(CV());
904  a.paramGroupPtrs.push_back(ParamGroupPtr(new ParamGroup("pg")));
905  b.samplePtrs.push_back(SamplePtr(new Sample("sample")));
906  a.instrumentConfigurationPtrs.push_back(InstrumentConfigurationPtr(new InstrumentConfiguration("instrumentConfiguration")));
907  b.softwarePtrs.push_back(SoftwarePtr(new Software("software")));
908  a.dataProcessingPtrs.push_back(DataProcessingPtr(new DataProcessing("dataProcessing")));
909  b.run.id = "run";
910  b.scanSettingsPtrs.push_back(ScanSettingsPtr(new ScanSettings("scanSettings")));
911 
912  diff(a, b);
913  if (os_) *os_ << diff << endl;
914  unit_assert(diff);
915 
916  unit_assert(diff.a_b.accession == "different");
917  unit_assert(diff.b_a.accession.empty());
918 
919  unit_assert(diff.a_b.id == (a.id + " (" + a.version() + ")"));
920  unit_assert(diff.b_a.id == (b.id + " (" + b.version() + ")"));
921 
922  unit_assert(diff.a_b.cvs.size() == 1);
923  unit_assert(diff.b_a.cvs.empty());
924 
925  unit_assert(diff.a_b.fileDescription.empty());
926  unit_assert(!diff.b_a.fileDescription.empty());
927 
928  unit_assert(!diff.a_b.paramGroupPtrs.empty());
929  unit_assert(diff.b_a.paramGroupPtrs.empty());
930 
931  unit_assert(diff.a_b.samplePtrs.empty());
932  unit_assert(!diff.b_a.samplePtrs.empty());
933 
934  unit_assert(!diff.a_b.instrumentConfigurationPtrs.empty());
935  unit_assert(diff.b_a.instrumentConfigurationPtrs.empty());
936 
937  unit_assert(diff.a_b.softwarePtrs.empty());
938  unit_assert(!diff.b_a.softwarePtrs.empty());
939 
940  unit_assert(!diff.a_b.dataProcessingPtrs.empty());
941  unit_assert(diff.b_a.dataProcessingPtrs.empty());
942 
943  unit_assert(diff.a_b.run.empty());
944  unit_assert(!diff.b_a.run.empty());
945 
946  unit_assert(diff.a_b.scanSettingsPtrs.empty());
947  unit_assert(!diff.b_a.scanSettingsPtrs.empty());
948 }
Description of the way in which a particular software was used.
Definition: MSData.hpp:272
boost::shared_ptr< Software > SoftwarePtr
Definition: MSData.hpp:197
boost::shared_ptr< ParamGroup > ParamGroupPtr
Definition: ParamTypes.hpp:239
std::vector< InstrumentConfigurationPtr > instrumentConfigurationPtrs
list and descriptions of instrument configurations.
Definition: MSData.hpp:873
boost::shared_ptr< ScanSettings > ScanSettingsPtr
Definition: MSData.hpp:224
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: MSData.hpp:287
Information about an ontology or CV source and a short &#39;lookup&#39; tag to refer to.
Definition: cv.hpp:13353
void version(const string &v)
Definition: DiffTest.cpp:886
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
std::vector< ScanSettingsPtr > scanSettingsPtrs
list with the descriptions of the acquisition settings applied prior to the start of data acquisition...
Definition: MSData.hpp:870
std::string id
an optional id for the mzML document. It is recommended to use LSIDs when possible.
Definition: MSData.hpp:851
std::string id
a unique identifier for this run.
Definition: MSData.hpp:808
void diff(const string &filename1, const string &filename2)
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
std::string accession
an optional accession number for the mzML document.
Definition: MSData.hpp:848
ostream * os_
Definition: DiffTest.cpp:40
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
std::vector< CV > cvs
container for one or more controlled vocabulary definitions.
Definition: MSData.hpp:855
A piece of software.
Definition: MSData.hpp:178
MS_reflectron_on
reflectron on: Reflectron is on.
Definition: cv.hpp:475
Implementation of the SampleType from the mzIdentML schema.
Definition: IdentData.hpp:195
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< ParamGroupPtr > paramGroupPtrs
container for a list of referenceableParamGroups
Definition: MSData.hpp:861
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
std::vector< DataProcessingPtr > dataProcessingPtrs
list and descriptions of data processing applied to this data.
Definition: MSData.hpp:876
boost::shared_ptr< Sample > SamplePtr
Definition: MSData.hpp:117
#define unit_assert(x)
Definition: unit.hpp:85

§ testBinaryDataOnly()

void testBinaryDataOnly ( )

Definition at line 951 of file DiffTest.cpp.

References pwiz::msdata::Run::chromatogramListPtr, pwiz::identdata::examples::initializeTiny(), os_, pwiz::msdata::MSData::run, pwiz::msdata::Precursor::selectedIons, pwiz::msdata::Run::spectrumListPtr, and unit_assert.

Referenced by test().

952 {
953  MSData tiny;
955 
956  MSData tinier;
959  tinier.run.spectrumListPtr = sl;
960  tinier.run.chromatogramListPtr = cl;
961 
962  for (unsigned int i=0; i<tiny.run.spectrumListPtr->size(); i++)
963  {
964  SpectrumPtr from = tiny.run.spectrumListPtr->spectrum(i, true);
965  sl->spectra.push_back(SpectrumPtr(new Spectrum));
966  SpectrumPtr& to = sl->spectra.back();
967 
968  for (vector<BinaryDataArrayPtr>::const_iterator it=from->binaryDataArrayPtrs.begin();
969  it!=from->binaryDataArrayPtrs.end(); ++it)
970  {
971  // copy BinaryDataArray::data from tiny to tinier
972  to->binaryDataArrayPtrs.push_back(BinaryDataArrayPtr(new BinaryDataArray));
973  to->binaryDataArrayPtrs.back()->data = (*it)->data;
974  }
975 
976  // copy "important" scan metadata
977 
978  to->defaultArrayLength = from->defaultArrayLength;
979  to->scanList = from->scanList;
980 
981  to->precursors.resize(from->precursors.size());
982  for (size_t precursorIndex=0; precursorIndex<from->precursors.size(); ++precursorIndex)
983  {
984  Precursor& precursorTo = to->precursors[precursorIndex];
985  Precursor& precursorFrom = from->precursors[precursorIndex];
986  precursorTo.selectedIons = precursorFrom.selectedIons;
987  }
988  }
989 
990  for (unsigned int i=0; i<tiny.run.chromatogramListPtr->size(); i++)
991  {
992  ChromatogramPtr from = tiny.run.chromatogramListPtr->chromatogram(i, true);
993  cl->chromatograms.push_back(ChromatogramPtr(new Chromatogram));
994  ChromatogramPtr& to = cl->chromatograms.back();
995 
996  for (vector<BinaryDataArrayPtr>::const_iterator it=from->binaryDataArrayPtrs.begin();
997  it!=from->binaryDataArrayPtrs.end(); ++it)
998  {
999  // copy BinaryDataArray::data from tiny to tinier
1000  to->binaryDataArrayPtrs.push_back(BinaryDataArrayPtr(new BinaryDataArray));
1001  to->binaryDataArrayPtrs.back()->data = (*it)->data;
1002  }
1003 
1004  // copy "important" scan metadata
1005 
1006  to->defaultArrayLength = from->defaultArrayLength;
1007  }
1008 
1009  if (os_)
1010  {
1011  *os_ << "tinier::";
1012  TextWriter(*os_,0)(tinier);
1013  }
1014 
1015  Diff<MSData, DiffConfig> diff_full(tiny, tinier);
1016  unit_assert(diff_full);
1017 
1018  DiffConfig config;
1019  config.ignoreMetadata = true;
1020  config.ignoreIdentity = true;
1021 
1022  Diff<MSData, DiffConfig> diff_data(tiny, tinier, config);
1023  if (os_ && diff_data) *os_ << diff_data << endl;
1024  unit_assert(!diff_data);
1025 }
The method of precursor ion selection and activation.
Definition: MSData.hpp:310
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
Definition: MSData.hpp:826
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:569
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
boost::shared_ptr< ChromatogramListSimple > ChromatogramListSimplePtr
Definition: MSData.hpp:801
A single chromatogram.
Definition: MSData.hpp:573
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:786
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
ostream * os_
Definition: DiffTest.cpp:40
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:403
std::vector< SelectedIon > selectedIons
this list of precursor ions that were selected.
Definition: MSData.hpp:328
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
boost::shared_ptr< SpectrumListSimple > SpectrumListSimplePtr
Definition: MSData.hpp:727
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
Definition: MSData.hpp:504
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:712
#define unit_assert(x)
Definition: unit.hpp:85
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:620
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: MSData.hpp:416

§ getMaxPrecisionDiff()

template<typename list_type >
double getMaxPrecisionDiff ( const list_type &  list)

Definition at line 1032 of file DiffTest.cpp.

References userParamName_MaxBinaryDataArrayDifference_.

Referenced by testMaxPrecisionDiff().

1033 {
1034  if (list.dp.get() &&
1035  !list.dp->processingMethods.empty() &&
1036  !list.dp->processingMethods.back().userParam(userParamName_MaxBinaryDataArrayDifference_).empty())
1037  return lexical_cast<double>(list.dp->processingMethods.back().userParam(userParamName_MaxBinaryDataArrayDifference_).value);
1038  return 0;
1039 }
static const char * userParamName_MaxBinaryDataArrayDifference_
Definition: DiffTest.cpp:1028

§ testMaxPrecisionDiff()

void testMaxPrecisionDiff ( )

Definition at line 1042 of file DiffTest.cpp.

References pwiz::data::Diff< object_type, config_type, object_result_type >::a_b, pwiz::data::Diff< object_type, config_type, object_result_type >::b_a, pwiz::msdata::Run::chromatogramListPtr, diff(), pwiz::data::diff_impl::diff(), epsilon, getMaxPrecisionDiff(), boost::lexical_cast(), os_, pwiz::data::BaseDiffConfig::precision, pwiz::msdata::Run::spectrumListPtr, unit_assert, unit_assert_equal, pwiz::data::ParamContainer::userParam(), pwiz::data::ParamContainer::userParams, and pwiz::data::UserParam::value.

Referenced by test().

1044 {
1045  if (os_)
1046  {
1047  *os_ <<"testMaxPrecisionDiff()\n";
1048  }
1049 
1051 
1058 
1059  std::vector<double> data1;
1060  std::vector<double> data2;
1061 
1062  data1.push_back(3.0);
1063  data2.push_back(3.0000001);
1064 
1065  e->data = data1;
1066  f->data = data2;
1067 
1068  DiffConfig config;
1069  config.precision=1e-6;
1070 
1071  Diff<BinaryDataArray, DiffConfig> diff_toosmall(*e,*f,config);
1072 
1073  //not diff for diff of 1e-7
1074  unit_assert(!diff_toosmall);
1075 
1076  data1.push_back(2.0);
1077  data2.push_back(2.0001);
1078 
1079  c->data = data1;
1080  d->data = data2;
1081 
1082  data1.push_back(1.0);
1083  data2.push_back(1.001);
1084 
1085  a->data = data1;
1086  b->data = data2;
1087 
1089 
1090  //diff
1091  unit_assert(diff);
1092 
1093  if(os_) *os_<<diff<<endl;
1094 
1095 
1096  Diff<BinaryDataArray, DiffConfig> diff2(*c,*d,config);
1097 
1098  //diff
1099  unit_assert(diff2);
1100 
1101  if(os_) *os_<<diff2<<endl;
1102 
1103  // BinaryDataArray UserParam is set
1104  unit_assert(!diff.a_b.userParams.empty());
1105  unit_assert(!diff.b_a.userParams.empty());
1106 
1107  // and correctly
1108  double maxBin_a_b=boost::lexical_cast<double>(diff.a_b.userParam("Binary data array difference").value);
1109  double maxBin_b_a=boost::lexical_cast<double>(diff.a_b.userParam("Binary data array difference").value);
1110 
1111  unit_assert_equal(maxBin_a_b,.001,epsilon);
1112  unit_assert_equal(maxBin_b_a,.001,epsilon);
1113 
1114  Run run_a, run_b;
1115 
1116  shared_ptr<SpectrumListSimple> sls_a(new SpectrumListSimple);
1117  shared_ptr<SpectrumListSimple> sls_b(new SpectrumListSimple);
1118 
1119  SpectrumPtr spa(new Spectrum);
1120  SpectrumPtr spb(new Spectrum);
1121  SpectrumPtr spc(new Spectrum);
1122  SpectrumPtr spd(new Spectrum);
1123 
1124  spa->binaryDataArrayPtrs.push_back(a);
1125  spb->binaryDataArrayPtrs.push_back(b);
1126  spc->binaryDataArrayPtrs.push_back(c);
1127  spd->binaryDataArrayPtrs.push_back(d);
1128 
1129  sls_a->spectra.push_back(spa);
1130  sls_a->spectra.push_back(spc);
1131  sls_b->spectra.push_back(spb);
1132  sls_b->spectra.push_back(spc);
1133 
1134  shared_ptr<ChromatogramListSimple> cls_a(new ChromatogramListSimple);
1135  shared_ptr<ChromatogramListSimple> cls_b(new ChromatogramListSimple);
1136 
1137  ChromatogramPtr cpa(new Chromatogram);
1138  ChromatogramPtr cpb(new Chromatogram);
1139  ChromatogramPtr cpc(new Chromatogram);
1140  ChromatogramPtr cpd(new Chromatogram);
1141 
1142  cpa->binaryDataArrayPtrs.push_back(a);
1143  cpb->binaryDataArrayPtrs.push_back(b);
1144  cpc->binaryDataArrayPtrs.push_back(c);
1145  cpd->binaryDataArrayPtrs.push_back(d);
1146 
1147  cls_a->chromatograms.push_back(cpa);
1148  cls_a->chromatograms.push_back(cpc);
1149  cls_b->chromatograms.push_back(cpb);
1150  cls_b->chromatograms.push_back(cpd);
1151 
1152  run_a.spectrumListPtr = sls_a;
1153  run_b.spectrumListPtr = sls_b;
1154 
1155  run_a.chromatogramListPtr = cls_a;
1156  run_b.chromatogramListPtr = cls_b;
1157 
1158  // Run user param is written for both Spectrum and Chromatogram binary data array difference user params, if present, with the correct value (max of the Spectrum and Chromatogram user params over the SpectrumList/ ChromatogramList respectively)
1159 
1160  Diff<Run, DiffConfig> diff_run(run_a,run_b,config);
1161 
1162  // diff
1163 
1164  unit_assert(diff_run);
1165 
1166 
1167  // Run user params are set
1168 
1169  unit_assert(!diff_run.a_b.userParams.empty());
1170  unit_assert(!diff_run.b_a.userParams.empty());
1171 
1172 
1173  // and correctly
1174 
1175  double maxSpecList_a_b=boost::lexical_cast<double>(diff_run.a_b.userParam("Spectrum binary data array difference").value);
1176  double maxSpecList_b_a=boost::lexical_cast<double>(diff_run.b_a.userParam("Spectrum binary data array difference").value);
1177 
1178  double maxChrList_a_b=boost::lexical_cast<double>(diff_run.a_b.userParam("Chromatogram binary data array difference").value);
1179  double maxChrList_b_a=boost::lexical_cast<double>(diff_run.b_a.userParam("Chromatogram binary data array difference").value);
1180 
1181  unit_assert_equal(maxSpecList_a_b,.001,epsilon);
1182  unit_assert_equal(maxSpecList_b_a,.001,epsilon);
1183  unit_assert_equal(maxChrList_a_b,.001,epsilon);
1184  unit_assert_equal(maxChrList_b_a,.001,epsilon);
1185 
1186  // test that Spectrum UserParam is written upon finding a binary data diff, with the correct value
1187 
1188  // user params are set
1189  unit_assert(!diff_run.a_b.spectrumListPtr->spectrum(0)->userParams.empty());
1190  unit_assert(!diff_run.b_a.spectrumListPtr->spectrum(0)->userParams.empty()); //user params are set
1191 
1192  // and correctly
1193 
1194  double maxSpec_a_b=boost::lexical_cast<double>(diff_run.a_b.spectrumListPtr->spectrum(0)->userParam("Binary data array difference").value);
1195  double maxSpec_b_a=boost::lexical_cast<double>(diff_run.b_a.spectrumListPtr->spectrum(0)->userParam("Binary data array difference").value);
1196 
1197  unit_assert_equal(maxSpec_a_b,.001,epsilon);
1198  unit_assert_equal(maxSpec_b_a,.001,epsilon);
1199 
1200 
1201  // test that Chromatogram UserParam is written upon finding a binary data diff, with the correct value
1202 
1203  // user params are set
1204  unit_assert(!diff_run.a_b.chromatogramListPtr->chromatogram(0)->userParams.empty());
1205  unit_assert(!diff_run.b_a.chromatogramListPtr->chromatogram(0)->userParams.empty());
1206 
1207  // and correctly
1208 
1209  double maxChr_a_b=boost::lexical_cast<double>(diff_run.a_b.chromatogramListPtr->chromatogram(0)->userParam("Binary data array difference").value);
1210  double maxChr_b_a=boost::lexical_cast<double>(diff_run.b_a.chromatogramListPtr->chromatogram(0)->userParam("Binary data array difference").value);
1211 
1212  unit_assert_equal(maxChr_a_b,.001,epsilon);
1213  unit_assert_equal(maxChr_b_a,.001,epsilon);
1214 
1215  if(os_) *os_<<diff_run<<endl;
1216 
1217 
1218 
1219  // test that maxPrecisionDiff is being returned correctly for a zero diff within diff_impl::diff(SpectrumList, SpectrumList, SpectrumList, SpectrumList, DiffConfig)
1220 
1221  shared_ptr<SpectrumListSimple> sls_a_a(new SpectrumListSimple);
1222  shared_ptr<SpectrumListSimple> sls_A_A(new SpectrumListSimple);
1223 
1224  pwiz::data::diff_impl::diff(*sls_a, *sls_a,*sls_a_a,*sls_A_A,config);
1225  double maxPrecisionNonDiffSpec = getMaxPrecisionDiff(*sls_a_a);
1226  unit_assert_equal(maxPrecisionNonDiffSpec,0,epsilon);
1227 
1228 
1229  // test that maxPrecisionDiff is being returned correctly for a non-zero diff within diff_impl::diff(SpectrumList, SpectrumList, SpectrumList, SpectrumList, DiffConfig)
1230 
1231  shared_ptr<SpectrumListSimple> sls_a_b(new SpectrumListSimple);
1232  shared_ptr<SpectrumListSimple> sls_b_a(new SpectrumListSimple);
1233 
1234  pwiz::data::diff_impl::diff(*sls_a, *sls_b,*sls_a_b,*sls_b_a,config);
1235  double maxPrecisionDiffSpec = getMaxPrecisionDiff(*sls_a_b);
1236  unit_assert_equal(maxPrecisionDiffSpec,.001,epsilon);
1237 
1238 
1239  // test that maxPrecisionDiff is being returned correctly for a zero diff within diff_impl::diff(ChromatogramList, ChromatogramList, ChromatogramList, ChromatogramList, DiffConfig)
1240 
1241  shared_ptr<ChromatogramListSimple> cls_a_a(new ChromatogramListSimple);
1242  shared_ptr<ChromatogramListSimple> cls_A_A(new ChromatogramListSimple);
1243 
1244  pwiz::data::diff_impl::diff(*cls_a, *cls_a,*cls_a_a,*cls_A_A,config);
1245  double maxPrecisionNonDiffChr = getMaxPrecisionDiff(*cls_a_a);
1246  unit_assert_equal(maxPrecisionNonDiffChr,0,epsilon);
1247 
1248  // test that maxPrecisionDiff is being returned correctly for a non-zero diff within diff_impl::diff(ChromatogramList, ChromatogramList, ChromatogramList, ChromatogramList, DiffConfig)
1249 
1250  shared_ptr<ChromatogramListSimple> cls_a_b(new ChromatogramListSimple);
1251  shared_ptr<ChromatogramListSimple> cls_b_a(new ChromatogramListSimple);
1252 
1253  pwiz::data::diff_impl::diff(*cls_a,*cls_b,*cls_a_b,*cls_b_a,config);
1254  double maxPrecisionDiffChr = getMaxPrecisionDiff(*cls_a_b);
1255  unit_assert_equal(maxPrecisionDiffChr,.001,epsilon);
1256 
1257 
1258 }
double getMaxPrecisionDiff(const list_type &list)
Definition: DiffTest.cpp:1032
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
Definition: MSData.hpp:826
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:569
const double epsilon
Definition: DiffTest.cpp:41
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
#define unit_assert_equal(x, y, epsilon)
Definition: unit.hpp:99
A single chromatogram.
Definition: MSData.hpp:573
float lexical_cast(const std::string &str)
void diff(const string &filename1, const string &filename2)
A run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:805
Simple writeable in-memory implementation of ChromatogramList.
Definition: MSData.hpp:786
ostream * os_
Definition: DiffTest.cpp:40
The structure into which encoded binary data goes. Byte ordering is always little endian (Intel style...
Definition: MSData.hpp:403
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
The structure that captures the generation of a peak list (including the underlying acquisitions) ...
Definition: MSData.hpp:504
Simple writeable in-memory implementation of SpectrumList.
Definition: MSData.hpp:712
#define unit_assert(x)
Definition: unit.hpp:85
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:620
boost::shared_ptr< BinaryDataArray > BinaryDataArrayPtr
Definition: MSData.hpp:416
PWIZ_API_DECL void diff(const std::string &a, const std::string &b, std::string &a_b, std::string &b_a, const BaseDiffConfig &config)

§ testMSDiffUpdate()

void testMSDiffUpdate ( )

Definition at line 1261 of file DiffTest.cpp.

References pwiz::msdata::Run::chromatogramListPtr, pwiz::msdata::Run::id, pwiz::msdata::MSData::id, pwiz::identdata::examples::initializeTiny(), os_, pwiz::msdata::MSData::run, pwiz::msdata::Run::spectrumListPtr, and unit_assert.

Referenced by test().

1262 {
1263  if(os_) *os_<<"testMSDiffUpdate()"<<endl;
1264 
1265  MSData tiny1;
1266  MSData tiny2;
1267 
1268  examples::initializeTiny(tiny1);
1269  examples::initializeTiny(tiny2);
1270 
1271  Diff<MSData, DiffConfig> diff_initial(tiny1,tiny2);
1272  unit_assert(!diff_initial);
1273 
1274  //inflict metadata differences
1275 
1276  tiny1.id="ego";
1277  tiny1.run.id="superego";
1278 
1279  //inflict spectral differences
1280 
1281  SpectrumPtr tiny1_s0 = tiny1.run.spectrumListPtr->spectrum(0);
1282  SpectrumPtr tiny2_s1 = tiny2.run.spectrumListPtr->spectrum(1);
1283 
1284  tiny1_s0->id = "tiny1";
1285  tiny2_s1->id = "tiny2";
1286 
1287  //inflict chromatogram differences
1288 
1289  ChromatogramPtr tiny1_c0=tiny1.run.chromatogramListPtr->chromatogram(0);
1290 
1291  tiny1_c0->id="zumas";
1292 
1293  //test metadata, spectral, chromatogram differences
1294 
1295  Diff<MSData, DiffConfig> diff_changed(tiny1,tiny2);
1296  unit_assert(diff_changed);
1297 
1298  if(os_) *os_<<diff_changed<<endl;
1299 
1300  tiny1.run.spectrumListPtr.reset();
1301 
1302  Diff<MSData, DiffConfig> diff_changed_changed(tiny1,tiny2);
1303  unit_assert(diff_changed_changed);
1304 
1305  if(os_) *os_<<diff_changed_changed<<endl;
1306 }
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
Definition: MSData.hpp:826
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: MSData.hpp:569
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
std::string id
an optional id for the mzML document. It is recommended to use LSIDs when possible.
Definition: MSData.hpp:851
std::string id
a unique identifier for this run.
Definition: MSData.hpp:808
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
Definition: MSData.hpp:882
ostream * os_
Definition: DiffTest.cpp:40
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
Definition: MSData.hpp:823
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Definition: MSData.hpp:845
#define unit_assert(x)
Definition: unit.hpp:85
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: MSData.hpp:620

§ test()

void test ( )

Definition at line 1309 of file DiffTest.cpp.

References testBinaryDataArray(), testBinaryDataOnly(), testChromatogram(), testChromatogramList(), testComponent(), testComponentList(), testDataProcessing(), testFileContent(), testFileDescription(), testInstrumentConfiguration(), testMaxPrecisionDiff(), testMSData(), testMSDiffUpdate(), testPrecursor(), testProcessingMethod(), testProduct(), testRun(), testSample(), testScan(), testScanList(), testScanSettings(), testSoftware(), testSource(), testSourceFile(), testSpectrum(), and testSpectrumList().

1310 {
1311  testFileContent();
1312  testSourceFile();
1314  testSample();
1315  testComponent();
1316  testSource();
1318  testSoftware();
1322  testScanSettings();
1323  testPrecursor();
1324  testProduct();
1325  testScan();
1326  testScanList();
1328  testSpectrum();
1329  testChromatogram();
1330  testSpectrumList();
1332  testRun();
1333  testMSData();
1336  testMSDiffUpdate();
1337 }
void testScan()
Definition: DiffTest.cpp:430
void testComponent()
Definition: DiffTest.cpp:156
void testComponentList()
Definition: DiffTest.cpp:194
void testScanList()
Definition: DiffTest.cpp:456
void testSoftware()
Definition: DiffTest.cpp:227
void testFileDescription()
Definition: DiffTest.cpp:84
void testMSDiffUpdate()
Definition: DiffTest.cpp:1261
void testBinaryDataArray()
Definition: DiffTest.cpp:487
void testProcessingMethod()
Definition: DiffTest.cpp:281
void testSpectrumList()
Definition: DiffTest.cpp:637
void testSource()
Definition: DiffTest.cpp:175
void testPrecursor()
Definition: DiffTest.cpp:375
void testMaxPrecisionDiff()
Definition: DiffTest.cpp:1042
void testInstrumentConfiguration()
Definition: DiffTest.cpp:249
void testSample()
Definition: DiffTest.cpp:1151
void testSourceFile()
Definition: DiffTest.cpp:601
void testProduct()
Definition: DiffTest.cpp:407
void testFileContent()
Definition: DiffTest.cpp:41
void testChromatogram()
Definition: DiffTest.cpp:600
void testScanSettings()
Definition: DiffTest.cpp:349
void testMSData()
Definition: DiffTest.cpp:888
void testDataProcessing()
Definition: DiffTest.cpp:311
void testSpectrum()
Definition: DiffTest.cpp:521
void testBinaryDataOnly()
Definition: DiffTest.cpp:951
void testRun()
Definition: DiffTest.cpp:828
void testChromatogramList()
Definition: DiffTest.cpp:725

§ main()

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

Definition at line 1340 of file DiffTest.cpp.

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

1341 {
1342  TEST_PROLOG_EX(argc, argv, "_MSData")
1343 
1344  try
1345  {
1346  if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
1347  test();
1348  }
1349  catch (exception& e)
1350  {
1351  TEST_FAILED(e.what())
1352  }
1353  catch (...)
1354  {
1355  TEST_FAILED("Caught unknown exception.")
1356  }
1357 
1358  TEST_EPILOG
1359 }
void test()
Definition: DiffTest.cpp:1319
#define TEST_EPILOG
Definition: unit.hpp:182
ostream * os_
Definition: DiffTest.cpp:40
#define TEST_PROLOG_EX(argc, argv, suffix)
Definition: unit.hpp:157
#define TEST_FAILED(x)
Definition: unit.hpp:176

Variable Documentation

§ os_

ostream* os_ = 0

Definition at line 38 of file DiffTest.cpp.

§ userParamName_MaxBinaryDataArrayDifference_

const char* userParamName_MaxBinaryDataArrayDifference_ = "Maximum binary data array difference"
static

Definition at line 1028 of file DiffTest.cpp.

Referenced by getMaxPrecisionDiff().