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