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> 55 if (!sfs.empty()) sfs.erase(sfs.end()-1);
57 if (!sws.empty()) sws.erase(sws.end()-1);
71 ofstream ofs(filename1.c_str());
72 string mgf =
"CHARGE=2+ and 3+\nBEGIN IONS\nPEPMASS=952.924194 145032.0000\nCHARGE=2+\nRTINSECONDS=301.48\n271.0874 2\n298.1747 4\nEND IONS\nBEGIN IONS\nPEPMASS=503.800000 67522.2000\nCHARGE=2+\nRTINSECONDS=302.51\n147.1840 3\n154.3668 3\n162.2118 2\n162.9007 1\n167.3297 1\n175.2387 2\n184.9460 3\nEND IONS\n";
73 ofs.write(mgf.c_str(), mgf.length());
77 for (
int loop = 3; loop--; )
96 boost::filesystem::remove(filename1);
97 boost::filesystem::remove(filename2);
104 if (
os_) *
os_ <<
"validateWriteRead()\n " << writeConfig << endl;
109 string filename4 =
filenameBase_ +
".\xE4\xB8\x80\xE4\xB8\xAA\xE8\xAF\x95.4";
129 std::vector< boost::shared_ptr< MSDataFile > > msds;
130 for (
int i=0;i<100;i++)
132 boost::shared_ptr<MSDataFile> msd1(
new MSDataFile(filename1));
133 msds.push_back(msd1);
145 if (diff &&
os_) *
os_ << diff << endl;
149 msd1.
write(filename2, writeConfig);
157 if (diff &&
os_) *
os_ << diff << endl;
161 bio::filtering_istream tinyGZ(bio::gzip_compressor() | bio::file_descriptor_source(filename1));
162 bio::copy(tinyGZ, bio::file_descriptor_sink(filename1+
".gz", ios::out|ios::binary));
169 if (diff &&
os_) *
os_ << diff << endl;
174 msd1.
write(oss, writeConfig);
175 string ossStr = oss.str();
176 ofstream ofs(filename3.c_str());
177 ofs.write(ossStr.c_str(), ossStr.length());
186 if (diff &&
os_) *
os_ << diff << endl;
191 msd1.
write(filename4, writeConfig);
199 if (diff &&
os_) *
os_ << diff << endl;
217 boost::filesystem::remove(filename1);
218 boost::filesystem::remove(filename2);
219 boost::filesystem::remove(filename1 +
".gz");
220 boost::filesystem::remove(filename3);
221 boost::filesystem::remove(filename4);
282 'F',
'\0',
'i',
'\0',
'n',
'\0',
'n',
'\0',
283 'i',
'\0',
'g',
'\0',
'a',
'\0',
'n',
'\0'};
292 virtual std::string
identify(
const std::string& filename,
const std::string& head)
const 294 if (filename.size()<=4 || filename.substr(filename.size()-4)!=
".RAW")
295 return std::string(
"");
299 return std::string(
"");
305 virtual void read(
const std::string& filename,
const std::string& head,
MSData& result,
int runIndex = 0,
306 const Config& config = Config())
const 311 virtual void read(
const std::string& filename,
312 const std::string& head,
313 std::vector<MSDataPtr>& results,
314 const Config& config = Config())
const 317 read(filename, head, *results.back(), 0, config);
320 const char *
getType()
const {
return "testReader";}
330 ofstream os(filename.c_str());
342 boost::filesystem::remove(filename);
350 if (
os_) *
os_ <<
"testSHA1()\n";
365 *
os_ <<
"no SHA-1:\n";
379 *
os_ <<
"with SHA-1:\n";
381 IO::write(writer, *msd_sha1.fileDescription.sourceFilePtrs.back());
384 unit_assert(!msd_sha1.fileDescription.sourceFilePtrs.empty());
390 boost::filesystem::remove(filename);
395 int main(
int argc,
char* argv[])
401 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;
common functionality for base SpectrumList implementations
common functionality for base ChromatogramList implementations
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.
virtual std::string identify(const std::string &filename, const std::string &head) const
bool ignoreMetadata
ignore all file level metadata, and most scan level metadata, i.e.
boost::shared_ptr< Spectrum > SpectrumPtr
virtual void setDataProcessingPtr(DataProcessingPtr dp)
set DataProcessing
Calculate diffs of objects in a ProteoWizard data model hierarchy.
boost::shared_ptr< DataProcessing > DataProcessingPtr
virtual SpectrumPtr spectrum(size_t index, bool getBinaryData=false) const =0
retrieve a spectrum by index
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...
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW...
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...
PWIZ_API_DECL int testReader(const pwiz::msdata::Reader &reader, const std::vector< std::string > &args, bool testAcceptOnly, bool requireUnicodeSupport, const TestPathPredicate &isPathTestable)
A common test harness for vendor readers;.
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)
const char * getType() const
interface for file 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
void validateMmgfMzxmlRoundTrip()
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 void read(const std::string &filename, const std::string &head, std::vector< MSDataPtr > &results, const Config &config=Config()) const
#define TEST_PROLOG(argc, argv)
virtual void read(const std::string &filename, const std::string &head, MSData &result, int runIndex=0, 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.