ProteoWizard
Functions | Variables
Serializer_protXML_Test.cpp File Reference
#include "pwiz/utility/misc/Std.hpp"
#include "pwiz/data/identdata/DefaultReaderList.hpp"
#include "pwiz/data/identdata/IdentDataFile.hpp"
#include "pwiz/utility/misc/unit.hpp"
#include "Serializer_protXML.hpp"
#include "Diff.hpp"
#include "References.hpp"
#include "examples.hpp"
#include "pwiz/utility/misc/Filesystem.hpp"
#include "pwiz/data/proteome/Digestion.hpp"
#include "TextWriter.hpp"
#include "boost/range/adaptor/transformed.hpp"
#include "boost/range/algorithm/max_element.hpp"
#include "boost/range/algorithm/min_element.hpp"
#include <cstring>

Go to the source code of this file.

Functions

void testSerialize (const string &example_data_dir)
 
int main (int argc, char **argv)
 

Variables

ostream * os_ = 0
 

Function Documentation

◆ testSerialize()

void testSerialize ( const string &  example_data_dir)

Definition at line 50 of file Serializer_protXML_Test.cpp.

51{
52 DefaultReaderList readers;
53 Reader::Config readerConfig;
54 DiffConfig diffconfig;
55 diffconfig.ignoreVersions = true;
56
57 {
58 // verify that loading protXML with reachable pepXML source files gives more
59 // (well, different) data than pepXML alone
60 IdentData mzid0,mzid1;
61 readers.read(example_data_dir+"/example.pep.xml", mzid0, readerConfig);
62 readers.read(example_data_dir+"/example.prot.xml", mzid1, readerConfig);
63 Diff<IdentData, DiffConfig> diff0(diffconfig);
64 diff0(mzid0, mzid1);
65 unit_assert(diff0);
66 }
67
68 {
69 // verify that adding protxml to pepXML is equivalent to loading protXML with reachable
70 // pepXML source files
71 IdentData mzid0,mzid1;
72 readers.read(example_data_dir+"/example.pep.xml", mzid0, readerConfig);
73 readers.read(example_data_dir+"/example.prot.xml", mzid0, readerConfig);
74 readers.read(example_data_dir+"/example.prot.xml", mzid1, readerConfig);
75 Diff<IdentData, DiffConfig> diff1(diffconfig);
76 diff1(mzid0, mzid1);
77 if (os_ && diff1) *os_ << diff1 << endl;
78 unit_assert(!diff1);
79 }
80
81 {
82 // verify that loading protXML is the same as loading a known-good mzIdentML file
83 IdentData mzid0,mzid1;
84 readers.read(example_data_dir+"/example.prot.xml", mzid0, readerConfig);
85 readers.read(example_data_dir+"/example.prot.mzid", mzid1, readerConfig);
86 Diff<IdentData, DiffConfig> diff2(diffconfig);
87 diff2(mzid0, mzid1);
88 if (os_ && diff2) *os_ << diff2 << endl;
89 else if (diff2) cout << diff2 << endl;
90 unit_assert(!diff2);
91 }
92}
ostream * os_
virtual void read(const std::string &filename, IdentData &result, const Config &config=Config()) const
delegates to first child that identifies
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Definition diff_std.hpp:143
Implementation of the MzIdentMLType from the mzIdentML schema.
HACK: provide an option to read only file-level metadata; once we have an enumerable ResultList imple...
Definition Reader.hpp:47
#define unit_assert(x)
Definition unit.hpp:85

References pwiz::data::BaseDiffConfig::ignoreVersions, os_, pwiz::identdata::ReaderList::read(), and unit_assert.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 95 of file Serializer_protXML_Test.cpp.

96{
97 TEST_PROLOG(argc, argv)
98
99 try
100 {
101 if (argc>1 && !strcmp(argv[1],"-v")) os_ = &cout;
102
103 std::string srcparent(__FILE__);
104 size_t pos = srcparent.find((bfs::path("pwiz") / "data").string());
105 srcparent.resize(pos);
106 string example_data_dir = srcparent + "example_data";
107 testSerialize(example_data_dir);
108 }
109 catch (exception& e)
110 {
111 TEST_FAILED(e.what())
112 }
113 catch (...)
114 {
115 TEST_FAILED("Caught unknown exception.")
116 }
117
119}
void testSerialize()
#define TEST_EPILOG
Definition unit.hpp:183
#define TEST_FAILED(x)
Definition unit.hpp:177
#define TEST_PROLOG(argc, argv)
Definition unit.hpp:175

References os_, TEST_EPILOG, TEST_FAILED, TEST_PROLOG, and testSerialize().

Variable Documentation

◆ os_

ostream* os_ = 0

Definition at line 48 of file Serializer_protXML_Test.cpp.

Referenced by main(), and testSerialize().