Go to the documentation of this file.
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);
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--; )
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++)
133 msds.push_back(msd1);
149 msd1.
write(filename2, writeConfig);
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));
174 msd1.
write(oss, writeConfig);
175 string ossStr = oss.str();
176 ofstream ofs(filename3.c_str());
177 ofs.write(ossStr.c_str(), ossStr.length());
191 msd1.
write(filename4, writeConfig);
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";
390 boost::filesystem::remove(filename);
395 int main(
int argc,
char* argv[])
401 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;
The XMLWriter class provides simple, tag-level XML syntax writing.
virtual void setDataProcessingPtr(DataProcessingPtr dp)
set DataProcessing
void validateWriteRead(const MSDataFile::WriteConfig &writeConfig, const DiffConfig diffConfig)
std::vector< SoftwarePtr > softwarePtrs
list and descriptions of software used to acquire and/or process the data in this mzML file.
BinaryDataEncoder::Config binaryDataEncoderConfig
void hackInMemoryMSData(MSData &msd)
virtual SpectrumPtr spectrum(size_t index, bool getBinaryData=false) const =0
retrieve a spectrum by index
common functionality for base ChromatogramList implementations
int main(int argc, char *argv[])
void validateMmgfMzxmlRoundTrip()
interface for file readers
std::vector< SourceFilePtr > sourceFilePtrs
list and descriptions of the source files this mzML document was generated or derived from.
Run run
a run in mzML should correspond to a single, consecutive and coherent set of scans on an instrument.
virtual void setDataProcessingPtr(DataProcessingPtr dp)
set DataProcessing
virtual void read(const std::string &filename, const std::string &head, std::vector< MSDataPtr > &results, const Config &config=Config()) const
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
Calculate diffs of objects in a ProteoWizard data model hierarchy.
FileDescription fileDescription
information pertaining to the entire mzML file (i.e. not specific to any part of the data set) is sto...
boost::shared_ptr< MSData > MSDataPtr
bool ignoreMetadata
ignore all file level metadata, and most scan level metadata, i.e.
void diff(const string &filename1, const string &filename2)
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
boost::shared_ptr< Spectrum > SpectrumPtr
Simple writeable in-memory implementation of SpectrumList.
SpectrumListPtr spectrumListPtr
all mass spectra and the acquisitions underlying them are described and attached here....
#define TEST_PROLOG(argc, argv)
boost::shared_ptr< DataProcessing > DataProcessingPtr
MSData object plus file I/O.
virtual void read(const std::string &filename, const std::string &head, MSData &result, int runIndex=0, const Config &config=Config()) const
const char * getType() const
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
configuration struct for diffing MSData types
common functionality for base SpectrumList implementations
Interface for accessing spectra, which may be stored in memory or backed by a data file (RAW,...
PWIZ_API_DECL void read(std::istream &is, CV &cv)
virtual std::string identify(const std::string &filename, const std::string &head) const
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...
ChromatogramListPtr chromatogramListPtr
all chromatograms for this run.
MS_SHA_1
SHA-1: SHA-1 (Secure Hash Algorithm-1) is a cryptographic hash function designed by the National Secu...
configuration for write()
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;.