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

Go to the source code of this file.

Functions

void testContact ()
 
void testInstrument ()
 
void testConfiguration ()
 
void testPrediction ()
 
void testValidation ()
 
void testEvidence ()
 
void testRetentionTime ()
 
void testProtein ()
 
void testModification ()
 
void testPeptide ()
 
void testCompound ()
 
void testTransition ()
 
void testTarget ()
 
void testSoftware ()
 
void testTraData ()
 
void test ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_ = 0
 

Function Documentation

§ testContact()

void testContact ( )

Definition at line 37 of file DiffTest.cpp.

References pwiz::data::ParamContainer::cvParams, diff(), pwiz::tradata::Contact::id, MS_m_z, os_, unit_assert, and pwiz::data::ParamContainer::userParams.

38 {
39  if (os_) *os_ << "testContact()\n";
40 
41  Contact a, b;
42  a.userParams.push_back(UserParam("common"));
43  b.userParams.push_back(UserParam("common"));
44  a.cvParams.push_back(MS_m_z);
45  b.cvParams.push_back(MS_m_z);
46 
47  a.id = b.id = "foo";
48 
50  unit_assert(!diff);
51 
52  a.id = "bar";
53 
54  diff(a, b);
55  if (os_) *os_ << diff << endl;
57 }
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
std::string id
Identifier for the contact to be used for referencing within a document.
Definition: TraData.hpp:49
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
ostream * os_
Definition: DiffTest.cpp:40
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
#define unit_assert(x)
Definition: unit.hpp:85

§ testInstrument()

void testInstrument ( )

Definition at line 60 of file DiffTest.cpp.

References pwiz::data::ParamContainer::cvParams, diff(), pwiz::tradata::Instrument::id, MS_m_z, os_, unit_assert, and pwiz::data::ParamContainer::userParams.

Referenced by test().

61 {
62  if (os_) *os_ << "testInstrument()\n";
63 
64  Instrument a, b;
65  a.userParams.push_back(UserParam("common"));
66  b.userParams.push_back(UserParam("common"));
67  a.cvParams.push_back(MS_m_z);
68  b.cvParams.push_back(MS_m_z);
69 
70  a.id = b.id = "foo";
71 
73  unit_assert(!diff);
74 
75  a.id = "bar";
76 
77  diff(a, b);
78  if (os_) *os_ << diff << endl;
80 }
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
Instrument on which transitions are validated.
Definition: TraData.hpp:132
std::string id
Identifier for the instrument to be used for referencing within a document.
Definition: TraData.hpp:135
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
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
ostream * os_
Definition: DiffTest.cpp:40
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
#define unit_assert(x)
Definition: unit.hpp:85

§ testConfiguration()

void testConfiguration ( )

Definition at line 83 of file DiffTest.cpp.

References pwiz::tradata::Configuration::contactPtr, pwiz::data::ParamContainer::cvParams, diff(), pwiz::tradata::Configuration::instrumentPtr, MS_m_z, os_, unit_assert, and pwiz::data::ParamContainer::userParams.

Referenced by test().

84 {
85  if (os_) *os_ << "testConfiguration()\n";
86 
87  Configuration a, b;
88  a.userParams.push_back(UserParam("common"));
89  b.userParams.push_back(UserParam("common"));
90  a.cvParams.push_back(MS_m_z);
91  b.cvParams.push_back(MS_m_z);
92  a.instrumentPtr = InstrumentPtr(new Instrument("common"));
93  b.instrumentPtr = InstrumentPtr(new Instrument("common"));
94  a.contactPtr = ContactPtr(new Contact("common"));
95  b.contactPtr = ContactPtr(new Contact("common"));
96 
98  unit_assert(!diff);
99 
100  a.instrumentPtr->id = "different";
101 
102  diff(a, b);
103  if (os_) *os_ << diff << endl;
104  unit_assert(diff);
105 }
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
Instrument on which transitions are validated.
Definition: TraData.hpp:132
Instrument configuration used in the validation or optimization of the transitions.
Definition: TraData.hpp:147
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
InstrumentPtr instrumentPtr
Reference to an instrument for which this configuration information is appropriate.
Definition: TraData.hpp:155
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:253
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
ostream * os_
Definition: DiffTest.cpp:40
boost::shared_ptr< Contact > ContactPtr
Definition: TraData.hpp:57
ContactPtr contactPtr
Reference to a contact person originating this information.
Definition: TraData.hpp:152
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
boost::shared_ptr< Instrument > InstrumentPtr
Definition: TraData.hpp:143
#define unit_assert(x)
Definition: unit.hpp:85

§ testPrediction()

void testPrediction ( )

Definition at line 108 of file DiffTest.cpp.

References pwiz::tradata::Prediction::contactPtr, pwiz::data::ParamContainer::cvParams, diff(), MS_m_z, os_, pwiz::tradata::Prediction::softwarePtr, unit_assert, and pwiz::data::ParamContainer::userParams.

Referenced by test().

109 {
110  if (os_) *os_ << "testPrediction()\n";
111 
112  Prediction a, b;
113  a.userParams.push_back(UserParam("common"));
114  b.userParams.push_back(UserParam("common"));
115  a.cvParams.push_back(MS_m_z);
116  b.cvParams.push_back(MS_m_z);
117  a.contactPtr = ContactPtr(new Contact("common"));
118  b.contactPtr = ContactPtr(new Contact("common"));
119 
121  unit_assert(!diff);
122 
123  a.softwarePtr = SoftwarePtr(new Software("different"));
124 
125  diff(a, b);
126  if (os_) *os_ << diff << endl;
127  unit_assert(diff);
128 }
boost::shared_ptr< Software > SoftwarePtr
Definition: MSData.hpp:197
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
Information about a prediction for a suitable transition using some software.
Definition: TraData.hpp:102
SoftwarePtr softwarePtr
Reference to a software package from which this prediction is derived.
Definition: TraData.hpp:105
void diff(const string &filename1, const string &filename2)
ContactPtr contactPtr
Reference to a contact person that generated this prediction.
Definition: TraData.hpp:108
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
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
ostream * os_
Definition: DiffTest.cpp:40
boost::shared_ptr< Contact > ContactPtr
Definition: TraData.hpp:57
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
#define unit_assert(x)
Definition: unit.hpp:85

§ testValidation()

void testValidation ( )

Definition at line 131 of file DiffTest.cpp.

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

Referenced by test().

132 {
133  if (os_) *os_ << "testValidation()\n";
134 
135  Validation a, b;
136  a.userParams.push_back(UserParam("common"));
137  b.userParams.push_back(UserParam("common"));
138  a.cvParams.push_back(MS_m_z);
139  b.cvParams.push_back(MS_m_z);
140 
142  unit_assert(!diff);
143 
144  b.set(MS_peak_intensity, 42);
145 
146  diff(a, b);
147  if (os_) *os_ << diff << endl;
148  unit_assert(diff);
149 }
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
Information about the state of validation of a transition on a given instrument model.
Definition: TraData.hpp:124
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
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:253
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
ostream * os_
Definition: DiffTest.cpp:40
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
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

§ testEvidence()

void testEvidence ( )

Definition at line 152 of file DiffTest.cpp.

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

Referenced by test().

153 {
154  if (os_) *os_ << "testEvidence()\n";
155 
156  Evidence a, b;
157  a.userParams.push_back(UserParam("common"));
158  b.userParams.push_back(UserParam("common"));
159  a.cvParams.push_back(MS_m_z);
160  b.cvParams.push_back(MS_m_z);
161 
163  unit_assert(!diff);
164 
165  a.set(MS_peak_intensity, 42);
166 
167  diff(a, b);
168  if (os_) *os_ << diff << endl;
169  unit_assert(diff);
170 }
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
Information about empirical mass spectrometer observations of the peptide.
Definition: TraData.hpp:116
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
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:253
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
ostream * os_
Definition: DiffTest.cpp:40
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
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

§ testRetentionTime()

void testRetentionTime ( )

Definition at line 173 of file DiffTest.cpp.

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

Referenced by test().

174 {
175  if (os_) *os_ << "testRetentionTime()\n";
176 
177  RetentionTime a, b;
178  a.userParams.push_back(UserParam("common"));
179  b.userParams.push_back(UserParam("common"));
180  a.cvParams.push_back(MS_m_z);
181  b.cvParams.push_back(MS_m_z);
182 
184  unit_assert(!diff);
185 
186  a.set(MS_peak_intensity, 42);
187 
188  diff(a, b);
189  if (os_) *os_ << diff << endl;
190  unit_assert(diff);
191 }
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
std::vector< UserParam > userParams
a collection of uncontrolled user terms
Definition: ParamTypes.hpp:253
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
ostream * os_
Definition: DiffTest.cpp:40
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
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

§ testProtein()

void testProtein ( )

Definition at line 194 of file DiffTest.cpp.

References diff(), pwiz::proteome::Protein::id, MS_m_z, os_, pwiz::proteome::Peptide::sequence(), and unit_assert.

Referenced by test().

195 {
196  if (os_) *os_ << "testProtein()\n";
197 
198  Protein a, b;
199  a.userParams.push_back(UserParam("common"));
200  b.userParams.push_back(UserParam("common"));
201  a.cvParams.push_back(MS_m_z);
202  b.cvParams.push_back(MS_m_z);
203  a.sequence = b.sequence = "ABCD";
204  a.id = b.id = "foo";
205 
207  unit_assert(!diff);
208 
209  a.sequence = "DCBA";
210 
211  diff(a, b);
212  if (os_) *os_ << diff << endl;
213  unit_assert(diff);
214 }
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
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
ostream * os_
Definition: DiffTest.cpp:40
#define unit_assert(x)
Definition: unit.hpp:85
const std::string & sequence() const
returns the sequence of amino acids making up the peptide

§ testModification()

void testModification ( )

Definition at line 217 of file DiffTest.cpp.

References diff(), os_, and unit_assert.

218 {
219  if (os_) *os_ << "testModification()\n";
220 
221  Modification a, b;
222  a.location = b.location = 7;
223  a.monoisotopicMassDelta = b.monoisotopicMassDelta = 42;
224  a.averageMassDelta = b.averageMassDelta = 42;
225 
227  unit_assert(!diff);
228 
229  a.monoisotopicMassDelta = 84;
230 
231  diff(a, b);
232  if (os_) *os_ << diff << endl;
233  unit_assert(diff);
234 }
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
represents a post-translational modification (PTM) modification formula or masses must be provided at...
void diff(const string &filename1, const string &filename2)
ostream * os_
Definition: DiffTest.cpp:40
#define unit_assert(x)
Definition: unit.hpp:85

§ testPeptide()

void testPeptide ( )

Definition at line 237 of file DiffTest.cpp.

References diff(), MS_m_z, MS_peak_intensity, os_, pwiz::proteome::Peptide::sequence(), and unit_assert.

238 {
239  if (os_) *os_ << "testPeptide()\n";
240 
241  Peptide a, b;
242  a.userParams.push_back(UserParam("common"));
243  b.userParams.push_back(UserParam("common"));
244  a.cvParams.push_back(MS_m_z);
245  b.cvParams.push_back(MS_m_z);
246  a.evidence.set(MS_peak_intensity, 42);
247  b.evidence.set(MS_peak_intensity, 42);
248  a.sequence = b.sequence = "ABCD";
249  a.id = b.id = "foo";
250 
252  unit_assert(!diff);
253 
254  a.sequence = "DCBA";
255 
256  diff(a, b);
257  if (os_) *os_ << diff << endl;
258  unit_assert(diff);
259 }
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)
represents a peptide or polypeptide (a sequence of amino acids)
Definition: Peptide.hpp:61
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
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
ostream * os_
Definition: DiffTest.cpp:40
#define unit_assert(x)
Definition: unit.hpp:85
const std::string & sequence() const
returns the sequence of amino acids making up the peptide

§ testCompound()

void testCompound ( )

Definition at line 262 of file DiffTest.cpp.

References pwiz::data::ParamContainer::cvParams, diff(), pwiz::tradata::Compound::id, MS_m_z, os_, pwiz::tradata::Compound::retentionTimes, unit_assert, and pwiz::data::ParamContainer::userParams.

Referenced by test().

263 {
264  if (os_) *os_ << "testCompound()\n";
265 
266  Compound a, b;
267  a.userParams.push_back(UserParam("common"));
268  b.userParams.push_back(UserParam("common"));
269  a.cvParams.push_back(MS_m_z);
270  b.cvParams.push_back(MS_m_z);
271  a.id = b.id = "foo";
272 
274  unit_assert(!diff);
275 
276  b.retentionTimes.push_back(RetentionTime());
277 
278  diff(a, b);
279  if (os_) *os_ << diff << endl;
280  unit_assert(diff);
281 }
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
std::string id
Identifier for the compound to be used for referencing within a document.
Definition: TraData.hpp:243
void diff(const string &filename1, const string &filename2)
Chemical compound other than a peptide for which one or more transitions.
Definition: TraData.hpp:240
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
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
ostream * os_
Definition: DiffTest.cpp:40
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
Definition: ParamTypes.hpp:250
std::vector< RetentionTime > retentionTimes
List of retention time information entries.
Definition: TraData.hpp:246
#define unit_assert(x)
Definition: unit.hpp:85

§ testTransition()

void testTransition ( )

Definition at line 284 of file DiffTest.cpp.

References pwiz::tradata::Transition::configurationList, diff(), pwiz::tradata::Transition::id, MS_peak_intensity, MS_selected_ion_m_z, os_, pwiz::tradata::Transition::peptidePtr, pwiz::tradata::Transition::precursor, pwiz::tradata::Transition::product, pwiz::data::ParamContainer::set(), unit_assert, and pwiz::tradata::Configuration::validations.

Referenced by test().

285 {
286  if (os_) *os_ << "testTransition()\n";
287 
288  Transition a, b;
289  a.id = b.id = "T1";
290  a.precursor.set(MS_selected_ion_m_z, 123.45);
291  b.precursor.set(MS_selected_ion_m_z, 123.45);
292  a.product.set(MS_selected_ion_m_z, 456.78);
293  b.product.set(MS_selected_ion_m_z, 456.78);
294  Validation v; v.set(MS_peak_intensity, 42);
295  Configuration c; c.validations.push_back(v);
296  a.configurationList.push_back(c);
297  b.configurationList.push_back(c);
298  a.peptidePtr = PeptidePtr(new Peptide("common"));
299  b.peptidePtr = PeptidePtr(new Peptide("common"));
300 
302  unit_assert(!diff);
303 
304  b.peptidePtr->sequence = "different";
305 
306  diff(a, b);
307  if (os_) *os_ << diff << endl;
308  unit_assert(diff);
309 }
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
Information about the state of validation of a transition on a given instrument model.
Definition: TraData.hpp:124
Instrument configuration used in the validation or optimization of the transitions.
Definition: TraData.hpp:147
std::string id
String label for this transition.
Definition: TraData.hpp:276
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of an selected ion.
Definition: cv.hpp:2749
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)
represents a peptide or polypeptide (a sequence of amino acids)
Definition: Peptide.hpp:61
ostream * os_
Definition: DiffTest.cpp:40
Product product
Product (Q3) of the transition.
Definition: TraData.hpp:288
PeptidePtr peptidePtr
Reference to a peptide which this transition is intended to identify.
Definition: TraData.hpp:279
boost::shared_ptr< Peptide > PeptidePtr
Definition: TraData.hpp:236
std::vector< Validation > validations
Definition: TraData.hpp:149
std::vector< Configuration > configurationList
List of insutrument configurations used in the validation or optimization of the transitions.
Definition: TraData.hpp:300
Precursor precursor
Precursor (Q1) of the transition.
Definition: TraData.hpp:285
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

§ testTarget()

void testTarget ( )

Definition at line 311 of file DiffTest.cpp.

References pwiz::tradata::Target::configurationList, diff(), pwiz::tradata::Target::id, MS_peak_intensity, MS_selected_ion_m_z, os_, pwiz::tradata::Target::peptidePtr, pwiz::tradata::Target::precursor, pwiz::data::ParamContainer::set(), unit_assert, and pwiz::tradata::Configuration::validations.

Referenced by test().

312 {
313  if (os_) *os_ << "testTarget()\n";
314 
315  Target a, b;
316  a.id = b.id = "T1";
317  a.precursor.set(MS_selected_ion_m_z, 123.45);
318  b.precursor.set(MS_selected_ion_m_z, 123.45);
319  Validation v; v.set(MS_peak_intensity, 42);
320  Configuration c; c.validations.push_back(v);
321  a.configurationList.push_back(c);
322  b.configurationList.push_back(c);
323  a.peptidePtr = PeptidePtr(new Peptide("common"));
324  b.peptidePtr = PeptidePtr(new Peptide("common"));
325 
327  unit_assert(!diff);
328 
329  b.peptidePtr->sequence = "different";
330 
331  diff(a, b);
332  if (os_) *os_ << diff << endl;
333  unit_assert(diff);
334 }
Precursor precursor
Precursor (Q1) of the target.
Definition: TraData.hpp:320
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
Information about the state of validation of a transition on a given instrument model.
Definition: TraData.hpp:124
A peptide or compound that is to be included or excluded from a target list of precursor m/z values...
Definition: TraData.hpp:308
Instrument configuration used in the validation or optimization of the transitions.
Definition: TraData.hpp:147
PeptidePtr peptidePtr
Reference to a peptide for which this target is the trigger.
Definition: TraData.hpp:314
std::string id
String label for this target.
Definition: TraData.hpp:311
MS_selected_ion_m_z
selected ion m/z: Mass-to-charge ratio of an selected ion.
Definition: cv.hpp:2749
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)
represents a peptide or polypeptide (a sequence of amino acids)
Definition: Peptide.hpp:61
ostream * os_
Definition: DiffTest.cpp:40
boost::shared_ptr< Peptide > PeptidePtr
Definition: TraData.hpp:236
std::vector< Validation > validations
Definition: TraData.hpp:149
std::vector< Configuration > configurationList
List of instrument configurations used in the validation or optimization of the target.
Definition: TraData.hpp:326
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

§ testSoftware()

void testSoftware ( )

Definition at line 337 of file DiffTest.cpp.

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

338 {
339  if (os_) *os_ << "testSoftware()\n";
340 
341  Software a, b;
342 
343  a.id = "msdata";
344  a.version = "4.20";
346  b = a;
347 
349  unit_assert(!diff);
350 
351  b.version = "4.21";
352 
353  diff(a, b);
354  if (os_) *os_ << diff << endl;
355  unit_assert(diff);
356 }
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
std::string version
Version of the software program described.
Definition: TraData.hpp:76
std::string id
Identifier for the software to be used for referencing within a document.
Definition: TraData.hpp:73
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
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

§ testTraData()

void testTraData ( )

Definition at line 411 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::tradata::TraData::cvs, diff(), pwiz::tradata::Publication::id, os_, pwiz::tradata::TraData::publications, pwiz::data::ParamContainer::set(), pwiz::tradata::TraData::softwarePtrs, unit_assert, and UO_dalton.

Referenced by test().

412 {
413  if (os_) *os_ << "testTraData()\n";
414 
415  TraData a, b;
416 
418  unit_assert(!diff);
419 
420  a.cvs.push_back(CV());
421  b.softwarePtrs.push_back(SoftwarePtr(new Software("software")));
422 
423  Publication pub;
424  pub.id = "PUBMED1";
425  pub.set(UO_dalton, 123);
426  a.publications.push_back(pub);
427  b.publications.push_back(pub);
428 
429  diff(a, b);
430  if (os_) *os_ << diff << endl;
431  unit_assert(diff);
432 
433  unit_assert(diff.a_b.cvs.size() == 1);
434  unit_assert(diff.b_a.cvs.empty());
435 
436  unit_assert(diff.a_b.softwarePtrs.empty());
437  unit_assert(!diff.b_a.softwarePtrs.empty());
438 
439  unit_assert(diff.a_b.publications.empty());
440  unit_assert(diff.b_a.publications.empty());
441 }
boost::shared_ptr< Software > SoftwarePtr
Definition: MSData.hpp:197
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition: diff_std.hpp:142
Information about an ontology or CV source and a short &#39;lookup&#39; tag to refer to.
Definition: cv.hpp:13353
std::vector< SoftwarePtr > softwarePtrs
List of software packages used in the generation of one of more transitions described in the document...
Definition: TraData.hpp:369
void diff(const string &filename1, const string &filename2)
std::vector< Publication > publications
List of publications from which the transitions were collected or wherein they are published...
Definition: TraData.hpp:363
ostream * os_
Definition: DiffTest.cpp:40
std::vector< CV > cvs
List of controlled vocabularies used in a TraML document note: one of the <cv> elements in this list ...
Definition: TraData.hpp:357
UO_dalton
dalton: An independently to the base SI units defined mass unit which is equal to one twelfth of the ...
Definition: cv.hpp:13153
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
Identifier for the publication to be used for referencing within a document.
Definition: TraData.hpp:63

§ test()

void test ( )

Definition at line 444 of file DiffTest.cpp.

References testCompound(), testConfiguration(), testContact(), testEvidence(), testInstrument(), testModification(), testPeptide(), testPrediction(), testProtein(), testRetentionTime(), testSoftware(), testTarget(), testTraData(), testTransition(), and testValidation().

445 {
446  testContact();
447  testInstrument();
448  testSoftware();
450  testPrediction();
451  testValidation();
452  testEvidence();
454  testProtein();
456  testPeptide();
457  testCompound();
458  testTransition();
459  testTarget();
460  //testPrecursor();
461  //testProduct();
462  testTraData();
463 }
void testContact()
Definition: DiffTest.cpp:1008
void testPrediction()
Definition: DiffTest.cpp:108
void testSoftware()
Definition: DiffTest.cpp:227
void testEvidence()
Definition: DiffTest.cpp:152
void testPeptide()
Definition: DiffTest.cpp:1133
void testTransition()
Definition: DiffTest.cpp:284
void testModification()
Definition: DiffTest.cpp:1121
void testInstrument()
Definition: DiffTest.cpp:60
void testTarget()
Definition: DiffTest.cpp:311
void testConfiguration()
Definition: DiffTest.cpp:83
void testCompound()
Definition: DiffTest.cpp:262
void testRetentionTime()
Definition: DiffTest.cpp:173
void testProtein()
Definition: DiffTest.cpp:194
void testValidation()
Definition: DiffTest.cpp:131
void testTraData()
Definition: DiffTest.cpp:411

§ main()

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

Definition at line 466 of file DiffTest.cpp.

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

467 {
468  TEST_PROLOG_EX(argc, argv, "_TraData")
469 
470  try
471  {
472  if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
473  test();
474  }
475  catch (exception& e)
476  {
477  TEST_FAILED(e.what())
478  }
479  catch (...)
480  {
481  TEST_FAILED("Caught unknown exception.")
482  }
483 
485 }
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 34 of file DiffTest.cpp.