ProteoWizard
Functions | Variables
IOTest.cpp File Reference
#include "IO.hpp"
#include "Diff.hpp"
#include "TextWriter.hpp"
#include "examples.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "pwiz/utility/misc/Std.hpp"

Go to the source code of this file.

Functions

template<typename object_type >
void testObject (const object_type &a)
 
void testIdentifiable ()
 
void testIdentifiableParamContainer ()
 
void testCV ()
 
void testBibliographicReference ()
 
void testPerson ()
 
void testOrganization ()
 
void testContactRole ()
 
void testProvider ()
 
void testSample ()
 
void testAnalysisSoftware ()
 
void testAnalysisSampleCollection ()
 
void testDBSequence ()
 
void testModification ()
 
void testSubstitutionModification ()
 
void testPeptide ()
 
void testSequenceCollection ()
 
void testSpectrumIdentification ()
 
void testProteinDetection ()
 
void testAnalysisCollection ()
 
void testSearchModification ()
 
void testEnzyme ()
 
void testEnzymes ()
 
void testResidue ()
 
void testAmbiguousResidue ()
 
void testMassTable ()
 
void testFilter ()
 
void testSpectrumIdentificationProtocol ()
 
void testProteinDetectionProtocol ()
 
void testAnalysisProtocolCollection ()
 
void testSpectraData ()
 
void testSearchDatabase ()
 
void testSourceFile ()
 
void testInputs ()
 
void testMeasure ()
 
void testFragmentArray ()
 
void testIonType ()
 
void testPeptideEvidence ()
 
void testSpectrumIdentificationItem ()
 
void testSpectrumIdentificationResult ()
 
PeptideHypothesis testPeptideHypothesis ()
 
void testProteinDetectionHypothesis ()
 
void testProteinAmbiguityGroup ()
 
void testSpectrumIdentificationList ()
 
void testProteinDetectionList ()
 
void testAnalysisData ()
 
void testDataCollection ()
 
void testIdentData ()
 
void test ()
 
int main (int argc, char *argv[])
 

Variables

ostream * os_ = 0
 

Function Documentation

template<typename object_type >
void testObject ( const object_type &  a)

Definition at line 41 of file IOTest.cpp.

References diff(), os_, pwiz::identdata::IO::read(), unit_assert, and pwiz::identdata::IO::write().

Referenced by testAmbiguousResidue(), testAnalysisCollection(), testAnalysisData(), testAnalysisProtocolCollection(), testAnalysisSampleCollection(), testAnalysisSoftware(), testBibliographicReference(), testComponent(), testComponentList(), testContactRole(), testCV(), testCVParam(), testDataCollection(), testDataProcessing(), testDBSequence(), testEnzyme(), testEnzymes(), testFileDescription(), testFilter(), testFragmentArray(), testIdentData(), testIdentifiable(), testIdentifiableParamContainer(), testInputs(), testInstrumentConfiguration(), testIonType(), testMassTable(), testMeasure(), testModification(), testNamedParamContainer(), testOrganization(), testParamGroup(), testPeptide(), testPeptideEvidence(), testPeptideHypothesis(), testPerson(), testPrecursor(), testProcessingMethod(), testProduct(), testProteinAmbiguityGroup(), testProteinDetection(), testProteinDetectionHypothesis(), testProteinDetectionList(), testProteinDetectionProtocol(), testProvider(), testResidue(), testSample(), testScanSettings(), testSearchDatabase(), testSearchModification(), testSequenceCollection(), testSoftware(), testSourceFile(), testSpectraData(), testSpectrumIdentification(), testSpectrumIdentificationItem(), testSpectrumIdentificationList(), testSpectrumIdentificationProtocol(), testSpectrumIdentificationResult(), testSubstitutionModification(), and testUserParam().

42 {
43  if (os_) *os_ << "testObject(): " << typeid(a).name() << endl;
44 
45  // write 'a' out to a stream
46 
47  ostringstream oss;
48  XMLWriter writer(oss);
49  IO::write(writer, a);
50  if (os_) *os_ << oss.str() << endl;
51 
52  // read 'b' in from stream
53 
54  object_type b;
55  istringstream iss(oss.str());
56  IO::read(iss, b);
57 
58  // compare 'a' and 'b'
59 
61  if (diff && os_) *os_ << "diff:\n" << diff_string<TextWriter>(diff) << endl;
62  unit_assert(!diff);
63 }
void testIdentifiable ( )

Definition at line 66 of file IOTest.cpp.

References pwiz::identdata::Identifiable::id, pwiz::identdata::Identifiable::name, os_, and testObject().

67 {
68  if (os_) *os_ << "testIdentifiable\n" ;
69 
70  Identifiable a;
71  a.id = "id";
72  a.name = "name";
73 
74  testObject(a);
75 }
void testIdentifiableParamContainer ( )

Definition at line 78 of file IOTest.cpp.

References pwiz::identdata::IdentifiableParamContainer::id, MS_TIC, pwiz::identdata::IdentifiableParamContainer::name, os_, pwiz::data::ParamContainer::set(), testObject(), and pwiz::data::ParamContainer::userParams.

Referenced by test().

79 {
80  if (os_) *os_ << "testIdentifiableParamContainer\n" ;
81 
83  a.id = "id";
84  a.name = "name";
85 
86  a.set(MS_TIC, 123);
87  a.userParams.push_back(UserParam("abc", "123", "!@#"));
88 
89  testObject(a);
90 }
void testCV ( )

Definition at line 93 of file IOTest.cpp.

References pwiz::cv::CV::fullName, pwiz::cv::CV::id, os_, testObject(), pwiz::cv::CV::URI, and pwiz::cv::CV::version.

94 {
95  if (os_) *os_ << "testCV\n" ;
96 
97  CV a;
98  a.URI = "abcd";
99  a.id = "efgh";
100  a.fullName = "ijkl";
101  a.version = "mnop";
102 
103  testObject(a);
104 }
void testBibliographicReference ( )
void testPerson ( )

Definition at line 128 of file IOTest.cpp.

References pwiz::identdata::Person::affiliations, pwiz::identdata::Person::firstName, pwiz::identdata::Person::lastName, pwiz::identdata::Person::midInitials, MS_contact_address, MS_contact_email, MS_contact_fax_number, MS_contact_phone_number, MS_contact_toll_free_phone_number, os_, pwiz::data::ParamContainer::set(), and testObject().

129 {
130  if (os_) *os_ << "testPerson\n" ;
131 
132  Person a;
133 
134  a.set(MS_contact_address, "123 abc");
135  a.set(MS_contact_phone_number, "456");
136  a.set(MS_contact_email, "efg@hijk.op");
137  a.set(MS_contact_fax_number, "789");
138  a.set(MS_contact_toll_free_phone_number, "012-345-678");
139 
140  a.lastName = "tuv";
141  a.firstName = "wx";
142  a.midInitials = "yz";
143 
144  a.affiliations.push_back(OrganizationPtr(new Organization("ref")));
145 
146  testObject(a);
147 }
void testOrganization ( )

Definition at line 150 of file IOTest.cpp.

References MS_contact_address, MS_contact_email, MS_contact_fax_number, MS_contact_phone_number, MS_contact_toll_free_phone_number, os_, pwiz::identdata::Organization::parent, pwiz::data::ParamContainer::set(), and testObject().

151 {
152  if (os_) *os_ << "testOrganization\n" ;
153 
154  Organization a;
155 
156  a.set(MS_contact_address, "123 abc");
157  a.set(MS_contact_phone_number, "456");
158  a.set(MS_contact_email, "efg@hijk.op");
159  a.set(MS_contact_fax_number, "789");
160  a.set(MS_contact_toll_free_phone_number, "012-345-678");
161 
162  a.parent = OrganizationPtr(new Organization("ref"));
163 
164  testObject(a);
165 }
void testContactRole ( )

Definition at line 168 of file IOTest.cpp.

References pwiz::identdata::ContactRole::contactPtr, pwiz::data::CVParam::cvid, MS_software_vendor, os_, and testObject().

169 {
170  if (os_) *os_ << "testContactRole\n" ;
171 
172  ContactRole a;
173  a.contactPtr = ContactPtr(new Contact("ref"));
175 
176  testObject(a);
177 }
void testProvider ( )

Definition at line 180 of file IOTest.cpp.

References pwiz::identdata::Provider::contactRolePtr, MS_role_type, os_, and testObject().

181 {
182  if (os_) *os_ << "testProvider\n" ;
183 
184  Provider a;
185 
186  // Reduced to a previously tested object.
187  a.contactRolePtr.reset(new ContactRole(MS_role_type, ContactPtr(new Contact("abc"))));
188 
189  testObject(a);
190 }
void testSample ( )

Definition at line 193 of file IOTest.cpp.

References pwiz::identdata::Sample::contactRole, MS_programmer, MS_septum, MS_software_vendor, os_, pwiz::data::ParamContainer::set(), pwiz::identdata::Sample::subSamples, and testObject().

194 {
195  if (os_) *os_ << "testSample\n" ;
196 
197  Sample a;
198 
199  // Reduced to a previously tested object.
200  a.contactRole.push_back(ContactRolePtr(new ContactRole(MS_software_vendor, ContactPtr(new Contact("abc")))));
201  a.contactRole.push_back(ContactRolePtr(new ContactRole(MS_programmer, ContactPtr(new Contact("def")))));
202  a.set(MS_septum);
203 
204  a.subSamples.push_back(SamplePtr(new Sample("subSample_ref")));
205 
206  testObject(a);
207 }
void testAnalysisSoftware ( )

Definition at line 210 of file IOTest.cpp.

References pwiz::identdata::AnalysisSoftware::contactRolePtr, pwiz::identdata::AnalysisSoftware::customizations, MS_Mascot, MS_software_vendor, os_, pwiz::data::ParamContainer::set(), pwiz::identdata::AnalysisSoftware::softwareName, testObject(), pwiz::identdata::AnalysisSoftware::URI, and pwiz::identdata::AnalysisSoftware::version.

211 {
212  if (os_) *os_ << "testAnalysisSoftware\n" ;
213 
215  a.version = "abcd";
216  a.URI = "efg";
217  a.customizations = "hijk";
218  ContactRolePtr cont = ContactRolePtr(new ContactRole());
219  cont->contactPtr = ContactPtr(new Contact("ref"));
220  cont->cvid = MS_software_vendor;
221  a.contactRolePtr = cont;
223 
224  testObject(a);
225 }
void testAnalysisSampleCollection ( )

Definition at line 228 of file IOTest.cpp.

References os_, and testObject().

229 {
230  if (os_) *os_ << "testAnalysisSampleCollection\n" ;
231 
233  SamplePtr b(new Sample());
234  b->subSamples.push_back(SamplePtr(new Sample("ref")));
235 
236  testObject(a);
237 }
void testDBSequence ( )
void testModification ( )
void testSubstitutionModification ( )
void testPeptide ( )

Definition at line 286 of file IOTest.cpp.

References pwiz::identdata::IdentifiableParamContainer::id, pwiz::identdata::Peptide::modification, MS_peptide, pwiz::identdata::IdentifiableParamContainer::name, pwiz::identdata::Peptide::peptideSequence, pwiz::data::ParamContainer::set(), pwiz::identdata::Peptide::substitutionModification, and testObject().

287 {
288  Peptide a;
289 
290  a.id = "id";
291  a.name = "name";
292  a.peptideSequence = "abc";
293 
294  ModificationPtr mod(new Modification);
295  mod->location = 1;
296  a.modification.push_back(mod);
297 
298  SubstitutionModificationPtr sub(new SubstitutionModification);
299  sub->location = 2;
300  a.substitutionModification.push_back(sub);
301 
302  a.set(MS_peptide);
303 
304  testObject(a);
305 }
void testSequenceCollection ( )

Definition at line 308 of file IOTest.cpp.

References pwiz::identdata::SequenceCollection::dbSequences, pwiz::identdata::SequenceCollection::peptideEvidence, pwiz::identdata::SequenceCollection::peptides, and testObject().

309 {
311 
312  a.dbSequences.push_back(DBSequencePtr(new DBSequence("db_id")));
313  a.peptides.push_back(PeptidePtr(new Peptide("pep_id")));
314  a.peptideEvidence.push_back(PeptideEvidencePtr(new PeptideEvidence("pe1")));
315 
316  testObject(a);
317 }
void testSpectrumIdentification ( )

Definition at line 320 of file IOTest.cpp.

References pwiz::identdata::SpectrumIdentification::activityDate, pwiz::identdata::SpectrumIdentification::inputSpectra, os_, pwiz::identdata::SpectrumIdentification::searchDatabase, pwiz::identdata::SpectrumIdentification::spectrumIdentificationListPtr, pwiz::identdata::SpectrumIdentification::spectrumIdentificationProtocolPtr, and testObject().

321 {
322  if (os_) *os_ << "testSpectrumIdentification\n" ;
323 
326  SpectrumIdentificationProtocolPtr( new SpectrumIdentificationProtocol("sip"));
328  SpectrumIdentificationListPtr(new SpectrumIdentificationList("sil"));
329  a.activityDate = "123";
330  a.inputSpectra.push_back(SpectraDataPtr(new SpectraData("is_sd")));
331  a.searchDatabase.push_back(SearchDatabasePtr(new SearchDatabase("sd_sd")));
332 
333  testObject(a);
334 }
void testProteinDetection ( )

Definition at line 337 of file IOTest.cpp.

References pwiz::identdata::ProteinDetection::activityDate, pwiz::identdata::Identifiable::id, pwiz::identdata::Identifiable::name, os_, pwiz::identdata::ProteinDetection::proteinDetectionListPtr, pwiz::identdata::ProteinDetection::proteinDetectionProtocolPtr, and testObject().

338 {
339  if (os_) *os_ << "testProteinDetection\n" ;
340 
342 
343  a.id = "id";
344  a.name = "name";
345  a.proteinDetectionProtocolPtr = ProteinDetectionProtocolPtr(new ProteinDetectionProtocol("abc"));
346  a.proteinDetectionListPtr = ProteinDetectionListPtr(new ProteinDetectionList("def"));
347  a.activityDate = "ghi";
348 
349  testObject(a);
350 }
void testAnalysisCollection ( )

Definition at line 353 of file IOTest.cpp.

References pwiz::identdata::ProteinDetection::activityDate, os_, pwiz::identdata::AnalysisCollection::proteinDetection, pwiz::identdata::AnalysisCollection::spectrumIdentification, and testObject().

354 {
355  if (os_) *os_ << "testAnalysisCollection\n" ;
356 
358 
359  SpectrumIdentificationPtr b(new SpectrumIdentification());
360  b->activityDate = "abc";
361  a.spectrumIdentification.push_back(b);
362  a.proteinDetection.activityDate = "def";
363 
364  testObject(a);
365 }
void testSearchModification ( )
void testEnzyme ( )
void testEnzymes ( )

Definition at line 405 of file IOTest.cpp.

References pwiz::identdata::Enzymes::enzymes, pwiz::identdata::Enzymes::independent, os_, and testObject().

406 {
407  if (os_) *os_ << "testEnzymes\n" ;
408 
409  Enzymes a;
410 
411  a.independent = "yes";
412  a.enzymes.push_back(EnzymePtr(new Enzyme()));
413  a.enzymes.back()->siteRegexp = "pxegeRetiS";
414 
415  testObject(a);
416 }
void testResidue ( )

Definition at line 419 of file IOTest.cpp.

References pwiz::identdata::Residue::code, pwiz::identdata::Residue::mass, os_, and testObject().

420 {
421  if (os_) *os_ << "testResidue\n" ;
422 
423  Residue a;
424 
425  a.code = 'A';
426  a.mass = 2;
427 
428  testObject(a);
429 }
void testAmbiguousResidue ( )

Definition at line 432 of file IOTest.cpp.

References pwiz::identdata::AmbiguousResidue::code, MS_alternate_single_letter_codes, os_, pwiz::data::ParamContainer::set(), and testObject().

433 {
434  if (os_) *os_ << "testAmbiguousResidue\n" ;
435 
437 
438  a.code = 'B';
440 
441  testObject(a);
442 }
void testMassTable ( )

Definition at line 445 of file IOTest.cpp.

References pwiz::identdata::MassTable::ambiguousResidue, pwiz::identdata::MassTable::id, pwiz::identdata::MassTable::msLevel, pwiz::identdata::MassTable::residues, and testObject().

446 {
447  MassTable a;
448 
449  a.id = "id";
450  a.msLevel.push_back(1);
451 
452  ResiduePtr b(new Residue());
453  b->code = 'B';
454  a.residues.push_back(b);
455 
456  AmbiguousResiduePtr c(new AmbiguousResidue());
457  c->code = 'C';
458  a.ambiguousResidue.push_back(c);
459 
460  testObject(a);
461 }
void testFilter ( )
void testSpectrumIdentificationProtocol ( )

Definition at line 476 of file IOTest.cpp.

References pwiz::identdata::SpectrumIdentificationProtocol::additionalSearchParams, pwiz::identdata::SpectrumIdentificationProtocol::analysisSoftwarePtr, pwiz::data::CVParam::cvid, pwiz::identdata::SpectrumIdentificationProtocol::databaseFilters, pwiz::identdata::SpectrumIdentificationProtocol::enzymes, pwiz::identdata::SpectrumIdentificationProtocol::fragmentTolerance, pwiz::identdata::Identifiable::id, pwiz::identdata::Enzymes::independent, pwiz::identdata::SpectrumIdentificationProtocol::massTable, pwiz::identdata::SpectrumIdentificationProtocol::modificationParams, MS_DB_filter_taxonomy, MS_Mascot_SigThreshold, MS_ms_ms_search, MS_parent_mass_type_mono, MS_search_tolerance_plus_value, pwiz::identdata::SpectrumIdentificationProtocol::parentTolerance, pwiz::identdata::SpectrumIdentificationProtocol::searchType, pwiz::data::ParamContainer::set(), testObject(), pwiz::identdata::SpectrumIdentificationProtocol::threshold, and UO_dalton.

477 {
479 
480  a.id = "id";
481 
482  a.analysisSoftwarePtr = AnalysisSoftwarePtr(new AnalysisSoftware("ref"));
483 
486  a.modificationParams.push_back(SearchModificationPtr(new SearchModification()));
487  a.enzymes.independent = "no";
488  a.massTable.push_back(MassTablePtr(new MassTable("MT_1")));
489  a.massTable.back()->msLevel.push_back(1);
490  a.massTable.back()->msLevel.push_back(2);
494 
495  FilterPtr b(new Filter());
496  b->filterType.set(MS_DB_filter_taxonomy);
497  a.databaseFilters.push_back(b);
498 
499  testObject(a);
500 }
void testProteinDetectionProtocol ( )
void testAnalysisProtocolCollection ( )

Definition at line 517 of file IOTest.cpp.

References pwiz::identdata::AnalysisProtocolCollection::proteinDetectionProtocol, pwiz::identdata::AnalysisProtocolCollection::spectrumIdentificationProtocol, and testObject().

518 {
520 
521  SpectrumIdentificationProtocolPtr b(new SpectrumIdentificationProtocol());
522  b->analysisSoftwarePtr = AnalysisSoftwarePtr(new AnalysisSoftware("ref"));
523  a.spectrumIdentificationProtocol.push_back(b);
524 
525  ProteinDetectionProtocolPtr c(new ProteinDetectionProtocol());
526  c->analysisSoftwarePtr = AnalysisSoftwarePtr(new AnalysisSoftware("ref"));
527  a.proteinDetectionProtocol.push_back(c);
528 
529  testObject(a);
530 }
void testSpectraData ( )
void testSearchDatabase ( )
void testSourceFile ( )
void testInputs ( )

Definition at line 581 of file IOTest.cpp.

References pwiz::identdata::Inputs::searchDatabase, pwiz::identdata::Inputs::sourceFile, pwiz::identdata::Inputs::spectraData, and testObject().

582 {
583  Inputs a;
584 
585  SourceFilePtr b(new SourceFile());
586  b->location = "blah";
587  a.sourceFile.push_back(b);
588 
589  SearchDatabasePtr c(new SearchDatabase());
590  c->version = "1.0b";
591  a.searchDatabase.push_back(c);
592 
593  SpectraDataPtr d(new SpectraData());
594  d->location = "bleh";
595  a.spectraData.push_back(d);
596 
597  testObject(a);
598 }
void testMeasure ( )

Definition at line 601 of file IOTest.cpp.

References pwiz::identdata::IdentifiableParamContainer::id, MS_product_ion_m_z, pwiz::data::ParamContainer::set(), and testObject().

602 {
603  Measure a;
604 
605  a.id = "id";
607 
608  testObject(a);
609 }
void testFragmentArray ( )

Definition at line 612 of file IOTest.cpp.

References pwiz::identdata::FragmentArray::measurePtr, testObject(), and pwiz::identdata::FragmentArray::values.

613 {
614  FragmentArray a;
615 
616  a.values.push_back(1.);
617  a.values.push_back(2.);
618  a.values.push_back(3.);
619  a.values.push_back(4.);
620  a.measurePtr = MeasurePtr(new Measure("ref"));
621 
622  testObject(a);
623 }
void testIonType ( )

Definition at line 626 of file IOTest.cpp.

References pwiz::identdata::IonType::charge, pwiz::data::CVParam::cvid, pwiz::identdata::IonType::fragmentArray, pwiz::identdata::IonType::index, MS_frag__a_ion, and testObject().

627 {
628  IonType a;
629 
630  a.index.push_back(0);
631  a.index.push_back(1);
632  a.index.push_back(2);
633  a.index.push_back(3);
634  a.charge = 2;
635 
636  a.cvid = MS_frag__a_ion;
637  FragmentArrayPtr b(new FragmentArray());
638  a.fragmentArray.push_back(b);
639 
640  testObject(a);
641 }
void testPeptideEvidence ( )
void testSpectrumIdentificationItem ( )

Definition at line 664 of file IOTest.cpp.

References pwiz::identdata::SpectrumIdentificationItem::calculatedMassToCharge, pwiz::identdata::SpectrumIdentificationItem::calculatedPI, pwiz::identdata::SpectrumIdentificationItem::chargeState, pwiz::identdata::SpectrumIdentificationItem::experimentalMassToCharge, pwiz::identdata::SpectrumIdentificationItem::fragmentation, pwiz::identdata::IdentifiableParamContainer::id, pwiz::identdata::SpectrumIdentificationItem::massTablePtr, MS_Mascot_score, pwiz::identdata::SpectrumIdentificationItem::passThreshold, pwiz::identdata::SpectrumIdentificationItem::peptideEvidencePtr, pwiz::identdata::SpectrumIdentificationItem::peptidePtr, pwiz::identdata::SpectrumIdentificationItem::rank, pwiz::identdata::SpectrumIdentificationItem::samplePtr, pwiz::data::ParamContainer::set(), and testObject().

665 {
667 
668  a.id = "id";
669 
670  a.chargeState = 1;
671  a.experimentalMassToCharge = 1.1;
672  a.calculatedMassToCharge = 2.2;
673  a.calculatedPI = 3.3;
674  a.peptidePtr = PeptidePtr(new Peptide("pep_ref"));
675  a.rank = 4;
676  a.passThreshold = true;
677  a.massTablePtr = MassTablePtr(new MassTable("mt_ref"));
678  a.samplePtr = SamplePtr(new Sample("s_ref"));
679  a.peptideEvidencePtr.push_back(PeptideEvidencePtr(new PeptideEvidence("pe_ref")));
680 
681  IonTypePtr c(new IonType());
682  c->charge = 5;
683  a.fragmentation.push_back(c);
684 
685  a.set(MS_Mascot_score, "15.71");
686 
687  testObject(a);
688 }
void testSpectrumIdentificationResult ( )

Definition at line 691 of file IOTest.cpp.

References pwiz::identdata::IdentifiableParamContainer::id, MS_Mascot_score, pwiz::data::ParamContainer::set(), pwiz::identdata::SpectrumIdentificationResult::spectraDataPtr, pwiz::identdata::SpectrumIdentificationResult::spectrumID, pwiz::identdata::SpectrumIdentificationResult::spectrumIdentificationItem, and testObject().

692 {
694 
695  a.id = "id";
696 
697  a.spectrumID = "sid";
698  a.spectraDataPtr = SpectraDataPtr(new SpectraData("sd_ref"));
699 
700  SpectrumIdentificationItemPtr b(new SpectrumIdentificationItem());
701  b->chargeState = 1;
702  a.spectrumIdentificationItem.push_back(b);
703 
704  a.set(MS_Mascot_score, "15.71");
705 
706  testObject(a);
707 }
PeptideHypothesis testPeptideHypothesis ( )

Definition at line 710 of file IOTest.cpp.

References pwiz::identdata::PeptideHypothesis::peptideEvidencePtr, pwiz::identdata::PeptideHypothesis::spectrumIdentificationItemPtr, and testObject().

711 {
713 
714  a.peptideEvidencePtr.reset(new PeptideEvidence("pe1"));
715  a.spectrumIdentificationItemPtr.push_back(SpectrumIdentificationItemPtr(new SpectrumIdentificationItem("sii1")));
716 
717  testObject(a);
718  return a;
719 }
void testProteinDetectionHypothesis ( )
void testProteinAmbiguityGroup ( )

Definition at line 736 of file IOTest.cpp.

References pwiz::identdata::IdentifiableParamContainer::id, MS_Mascot_score, pwiz::identdata::ProteinAmbiguityGroup::proteinDetectionHypothesis, pwiz::data::ParamContainer::set(), and testObject().

737 {
739 
740  a.id = "id";
741  ProteinDetectionHypothesisPtr b(new ProteinDetectionHypothesis());
742  b->dbSequencePtr = DBSequencePtr(new DBSequence("dbs_ref"));
743  a.proteinDetectionHypothesis.push_back(b);
744  a.set(MS_Mascot_score, "164.4");
745 
746  testObject(a);
747 }
void testSpectrumIdentificationList ( )

Definition at line 750 of file IOTest.cpp.

References pwiz::identdata::SpectrumIdentificationList::fragmentationTable, pwiz::identdata::Identifiable::id, MS_Mascot_score, pwiz::identdata::SpectrumIdentificationList::numSequencesSearched, pwiz::identdata::SpectrumIdentificationList::spectrumIdentificationResult, and testObject().

751 {
753 
754  a.id = "id";
755  a.numSequencesSearched = 1;
756 
757  MeasurePtr b(new Measure());
758  b->set(MS_Mascot_score, "164.4");
759  a.fragmentationTable.push_back(b);
760 
761  SpectrumIdentificationResultPtr c(new SpectrumIdentificationResult());
762  c->id = "sid";
763  c->spectrumID = "sID";
764  a.spectrumIdentificationResult.push_back(c);
765 
766  testObject(a);
767 }
void testProteinDetectionList ( )

Definition at line 770 of file IOTest.cpp.

References pwiz::identdata::IdentifiableParamContainer::id, MS_Mascot_score, pwiz::identdata::ProteinDetectionList::proteinAmbiguityGroup, pwiz::data::ParamContainer::set(), and testObject().

771 {
773 
774  a.id = "id";
775  ProteinAmbiguityGroupPtr b(new ProteinAmbiguityGroup());
776  a.proteinAmbiguityGroup.push_back(b);
777 
778  a.set(MS_Mascot_score, "164.4");
779 
780  testObject(a);
781 }
void testAnalysisData ( )

Definition at line 784 of file IOTest.cpp.

References MS_Mascot_score, pwiz::identdata::AnalysisData::proteinDetectionListPtr, pwiz::identdata::AnalysisData::spectrumIdentificationList, and testObject().

785 {
786  AnalysisData a;
787 
788  SpectrumIdentificationListPtr b(new SpectrumIdentificationList());
789  b->id = "id";
790  b->numSequencesSearched = 5;
791  a.spectrumIdentificationList.push_back(b);
792 
793  a.proteinDetectionListPtr = ProteinDetectionListPtr(new ProteinDetectionList("id2"));
794  a.proteinDetectionListPtr->set(MS_Mascot_score, "164.4");
795 
796  testObject(a);
797 }
void testDataCollection ( )

Definition at line 800 of file IOTest.cpp.

References pwiz::identdata::DataCollection::analysisData, pwiz::identdata::DataCollection::inputs, pwiz::identdata::Inputs::sourceFile, pwiz::identdata::AnalysisData::spectrumIdentificationList, and testObject().

801 {
802  DataCollection a;
803 
804  SourceFilePtr b(new SourceFile());
805  a.inputs.sourceFile.push_back(b);
806 
807  SpectrumIdentificationListPtr c(new SpectrumIdentificationList());
808  c->id = "SIL_1";
809  c->numSequencesSearched = 5;
811 
812  testObject(a);
813 }
void testIdentData ( )

Definition at line 816 of file IOTest.cpp.

References pwiz::identdata::IdentData::analysisCollection, pwiz::identdata::DataCollection::analysisData, pwiz::identdata::IdentData::dataCollection, pwiz::identdata::SequenceCollection::dbSequences, diff(), IgnoreAnalysisData, IgnoreSequenceCollection, pwiz::identdata::examples::initializeTiny(), os_, pwiz::identdata::SequenceCollection::peptideEvidence, pwiz::identdata::SequenceCollection::peptides, pwiz::identdata::AnalysisCollection::proteinDetection, pwiz::identdata::AnalysisData::proteinDetectionListPtr, pwiz::identdata::IO::read(), pwiz::identdata::IdentData::sequenceCollection, pwiz::identdata::AnalysisCollection::spectrumIdentification, pwiz::identdata::AnalysisData::spectrumIdentificationList, testObject(), unit_assert, and pwiz::identdata::IO::write().

817 {
818  IdentData a;
819 
821 
822  testObject(a);
823 
824  // test ignoring sequence collection and analysis data
825  {
826  // write 'a' out to a stream
827 
828  ostringstream oss;
829  XMLWriter writer(oss);
830  IO::write(writer, a);
831  if (os_) *os_ << oss.str() << endl;
832 
833  // read 'b' in from stream
834 
835  IdentData b;
836  istringstream iss(oss.str());
838 
839  // clear the original SequenceCollection
841  a.sequenceCollection.peptides.clear();
843 
844  // clear the original analysis data
845  BOOST_FOREACH(SpectrumIdentificationPtr& si, a.analysisCollection.spectrumIdentification)
846  si->spectrumIdentificationListPtr.reset();
847  a.analysisCollection.proteinDetection = b.analysisCollection.proteinDetection = ProteinDetection();
848  a.dataCollection.analysisData.spectrumIdentificationList.clear();
849  a.dataCollection.analysisData.proteinDetectionListPtr.reset();
850 
851  // compare 'a' and 'b'
852 
853  Diff<IdentData, DiffConfig> diff(a,b);
854  if (diff && os_) *os_ << "diff:\n" << diff << endl;
855  unit_assert(!diff);
856  }
857 }
void test ( )

Definition at line 860 of file IOTest.cpp.

References testAmbiguousResidue(), testAnalysisCollection(), testAnalysisData(), testAnalysisProtocolCollection(), testAnalysisSoftware(), testBibliographicReference(), testContactRole(), testCV(), testDataCollection(), testDBSequence(), testEnzyme(), testEnzymes(), testFilter(), testFragmentArray(), testIdentData(), testIdentifiable(), testIdentifiableParamContainer(), testInputs(), testIonType(), testMassTable(), testMeasure(), testModification(), testOrganization(), testPeptide(), testPeptideEvidence(), testPerson(), testProteinAmbiguityGroup(), testProteinDetection(), testProteinDetectionHypothesis(), testProteinDetectionList(), testProteinDetectionProtocol(), testProvider(), testResidue(), testSample(), testSearchDatabase(), testSearchModification(), testSequenceCollection(), testSourceFile(), testSpectraData(), testSpectrumIdentification(), testSpectrumIdentificationItem(), testSpectrumIdentificationList(), testSpectrumIdentificationProtocol(), testSpectrumIdentificationResult(), and testSubstitutionModification().

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

Definition at line 910 of file IOTest.cpp.

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

911 {
912  TEST_PROLOG_EX(argc, argv, "_IdentData")
913 
914  try
915  {
916  if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
917  test();
918  if (os_) *os_ << "ok\n";
919  }
920  catch (exception& e)
921  {
922  TEST_FAILED(e.what())
923  }
924  catch (...)
925  {
926  TEST_FAILED("Caught unknown exception.")
927  }
928 
930 }

Variable Documentation

ostream* os_ = 0

Definition at line 38 of file IOTest.cpp.