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;
105 if (
os_) *
os_ <<
"validateWriteRead()\n " << writeConfig << endl;
118 shared_ptr<Reader> reader;
136 pd1.
write(filename2, writeConfig);
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));
160 bfs::remove(filename2);
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;