31 #include <boost/iostreams/filtering_stream.hpp> 32 #include <boost/iostreams/filter/gzip.hpp> 33 #include <boost/iostreams/device/file_descriptor.hpp> 34 #include <boost/iostreams/copy.hpp> 40 using boost::shared_ptr;
52 if (
os_) *
os_ <<
"validateReadIndexed()\n" << endl;
78 if (diff &&
os_) *
os_ << diff << endl;
86 if (diff &&
os_) *
os_ << diff << endl;
105 if (
os_) *
os_ <<
"validateWriteRead()\n " << writeConfig << endl;
118 shared_ptr<Reader> reader;
132 if (diff &&
os_) *
os_ << diff << endl;
136 pd1.
write(filename2, writeConfig);
143 if (diff &&
os_) *
os_ << diff << endl;
147 bio::filtering_istream tinyGZ(bio::gzip_compressor() | bio::file_descriptor_source(filename1));
148 bio::copy(tinyGZ, bio::file_descriptor_sink(filename1+
".gz", ios::out|ios::binary));
154 if (diff &&
os_) *
os_ << diff << endl;
159 bfs::remove(filename1);
160 bfs::remove(filename2);
161 bfs::remove(filename1 +
".gz");
163 bool index1Exists = bfs::exists(filename1 +
".index");
164 bool index2Exists = bfs::exists(filename2 +
".index");
165 bool index3Exists = bfs::exists(filename1 +
".gz.index");
167 bool indexShouldExist = writeConfig.
indexed;
172 if (index1Exists) bfs::remove(filename1 +
".index");
173 if (index2Exists) bfs::remove(filename2 +
".index");
174 if (index3Exists) bfs::remove(filename1 +
".gz.index");
200 virtual std::string
identify(
const std::string& uri, shared_ptr<istream> uriStreamPtr)
const 204 if (!bal::iends_with(uri,
".fasta"))
208 getline(*uriStreamPtr, buf);
215 virtual void read(
const std::string& uri,
216 shared_ptr<istream> uriStreamPtr,
222 const char *
getType()
const {
return "testReader";}
232 ofstream os(filename.c_str());
233 os <<
">Id Description\nSEQUENCE\n";
244 boost::filesystem::remove(filename);
250 int main(
int argc,
char* argv[])
256 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;
FASTA -> ProteomeData stream serialization.
configuration struct for diffs
Calculate diffs of objects in a ProteoWizard data model hierarchy.
void validateWriteRead(const ProteomeDataFile::WriteConfig &writeConfig, const DiffConfig diffConfig)
void validateReadIndexed(const ProteomeDataFile::WriteConfig &writeConfig, const DiffConfig diffConfig)
void diff(const string &filename1, const string &filename2)
virtual std::string identify(const std::string &uri, shared_ptr< istream > uriStreamPtr) const
int main(int argc, char *argv[])
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
static void write(const ProteomeData &pd, const std::string &uri, const WriteConfig &config=WriteConfig(), const pwiz::util::IterationListenerRegistry *iterationListenerRegistry=0)
static write function for any ProteomeData object; iterationListenerRegistry may be used for progress...
const char * getType() const
PWIZ_API_DECL int testReader(const pwiz::msdata::Reader &reader, const std::vector< std::string > &args, bool testAcceptOnly, bool requireUnicodeSupport, const TestPathPredicate &isPathTestable, const ReaderTestConfig &config=ReaderTestConfig())
A common test harness for vendor readers;.
ProteomeData object plus file I/O.
configuration for write()
interface for file readers
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
Reader_FASTA configuration.
#define TEST_PROLOG(argc, argv)
bool indexed
read with a side-by-side index
virtual void read(const std::string &uri, shared_ptr< istream > uriStreamPtr, ProteomeData &pd) const