33 #include <boost/iostreams/filtering_stream.hpp>
34 #include <boost/iostreams/filter/gzip.hpp>
35 #include <boost/iostreams/device/file_descriptor.hpp>
36 #include <boost/iostreams/copy.hpp>
39 using namespace pwiz::util;
41 using namespace pwiz::data;
42 using namespace pwiz::msdata;
55 if (!sfs.empty()) sfs.erase(sfs.end()-1);
57 if (!sws.empty()) sws.erase(sws.end()-1);
70 if (
os_) *
os_ <<
"validateWriteRead()\n " << writeConfig << endl;
93 std::vector< boost::shared_ptr< MSDataFile > > msds;
94 for (
int i=0;i<100;i++)
96 boost::shared_ptr<MSDataFile> msd1(
new MSDataFile(filename1));
109 if (diff &&
os_) *
os_ << diff << endl;
113 msd1.
write(filename2, writeConfig);
121 if (diff &&
os_) *
os_ << diff << endl;
125 bio::filtering_istream tinyGZ(bio::gzip_compressor() | bio::file_descriptor_source(filename1));
126 bio::copy(tinyGZ, bio::file_descriptor_sink(filename1+
".gz", ios::out|ios::binary));
133 if (diff &&
os_) *
os_ << diff << endl;
138 msd1.
write(oss, writeConfig);
139 string ossStr = oss.str();
140 ofstream ofs(filename3.c_str());
141 ofs.write(ossStr.c_str(), ossStr.length());
150 if (diff &&
os_) *
os_ << diff << endl;
155 boost::filesystem::remove(filename1);
156 boost::filesystem::remove(filename2);
157 boost::filesystem::remove(filename1 +
".gz");
158 boost::filesystem::remove(filename3);
216 'F',
'\0',
'i',
'\0',
'n',
'\0',
'n',
'\0',
217 'i',
'\0',
'g',
'\0',
'a',
'\0',
'n',
'\0'};
226 virtual std::string
identify(
const std::string& filename,
const std::string& head)
const
228 if (filename.size()<=4 || filename.substr(filename.size()-4)!=
".RAW")
229 return std::string(
"");
233 return std::string(
"");
239 virtual void read(
const std::string& filename,
const std::string& head,
MSData& result,
int runIndex = 0,
240 const Config& config = Config())
const
245 virtual void read(
const std::string& filename,
246 const std::string& head,
247 std::vector<MSDataPtr>& results,
248 const Config& config = Config())
const
251 read(filename, head, *results.back(), 0, config);
254 const char *
getType()
const {
return "testReader";}
264 ofstream os(filename.c_str());
276 boost::filesystem::remove(filename);
284 if (
os_) *
os_ <<
"testSHA1()\n";
299 *
os_ <<
"no SHA-1:\n";
313 *
os_ <<
"with SHA-1:\n";
315 IO::write(writer, *msd_sha1.fileDescription.sourceFilePtrs.back());
318 unit_assert(!msd_sha1.fileDescription.sourceFilePtrs.empty());
324 boost::filesystem::remove(filename);
329 int main(
int argc,
char* argv[])
335 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;
common functionality for base SpectrumList implementations
common functionality for base ChromatogramList implementations
PWIZ_API_DECL const CV & cv(const std::string &prefix)
returns a CV object for the specified namespace (prefix); currently supported namespaces are: MS UO ...
The XMLWriter class provides simple, tag-level XML syntax writing.
std::vector< SourceFilePtr > sourceFilePtrs
list and descriptions of the source files this mzML document was generated or derived from...
virtual void setDataProcessingPtr(DataProcessingPtr dp)
set DataProcessing
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
bool ignoreMetadata
ignore all file level metadata, and most scan level metadata, i.e.
virtual void setDataProcessingPtr(DataProcessingPtr dp)
set DataProcessing
Calculate diffs of objects in a ProteoWizard data model hierarchy.
boost::shared_ptr< DataProcessing > DataProcessingPtr
configuration for write()
FileDescription fileDescription
information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
void diff(const string &filename1, const string &filename2)
MS_SHA_1
SHA-1: SHA-1 (Secure Hash Algorithm-1) is a cryptographic hash function designed by the National Secu...
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument...
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
virtual void read(const std::string &filename, const std::string &head, MSData &result, int runIndex=0, const Config &config=Config()) const
interface for file readers
PWIZ_API_DECL int testReader(const pwiz::msdata::Reader &reader, const std::vector< std::string > &args, bool testAcceptOnly, const TestPathPredicate &isPathTestable)
A common test harness for vendor readers;.
boost::shared_ptr< MSData > MSDataPtr
int main(int argc, char *argv[])
void hackInMemoryMSData(MSData &msd)
MSData object plus file I/O.
configuration struct for diffing MSData types
const char * getType() const
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here. Subsidiary data arrays are also both described and attached here.
PWIZ_API_DECL void read(std::istream &is, CV &cv)
void validateWriteRead(const MSDataFile::WriteConfig &writeConfig, const DiffConfig diffConfig)
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
std::vector< SoftwarePtr > softwarePtrs
list and descriptions of software used to acquire and/or process the data in this mzML file...
BinaryDataEncoder::Config binaryDataEncoderConfig
static void write(const MSData &msd, const std::string &filename, const WriteConfig &config=WriteConfig(), const pwiz::util::IterationListenerRegistry *iterationListenerRegistry=0)
static write function for any MSData object; iterationListenerRegistry may be used for progress updat...
virtual std::string identify(const std::string &filename, const std::string &head) const
#define TEST_PROLOG(argc, argv)
virtual void read(const std::string &filename, const std::string &head, std::vector< MSDataPtr > &results, const Config &config=Config()) const
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
Simple writeable in-memory implementation of SpectrumList.