55 virtual std::string
identify(
const std::string& filename,
const std::string& head)
const 57 bool result = (filename ==
"1");
58 if (
os_) *
os_ <<
"Reader1::identify(): " << boolalpha << result << endl;
59 return std::string (result?filename:std::string(
""));
62 virtual void read(
const std::string& filename,
63 const std::string& head,
68 if (
os_) *
os_ <<
"Reader1::read()\n";
69 readerConfig.
done =
true;
72 virtual void read(
const std::string& filename,
73 const std::string& head,
74 std::vector<MSDataPtr>& results,
78 read(filename, head, *results.back(), 0, config);
81 virtual const char *
getType()
const {
return "Reader1";}
98 virtual std::string
identify(
const std::string& filename,
const std::string& head)
const 100 bool result = (filename ==
"2");
101 if (
os_) *
os_ <<
"Reader2::identify(): " << boolalpha << result << endl;
102 return std::string (result?filename:std::string(
""));
105 virtual void read(
const std::string& filename,
106 const std::string& head,
111 if (
os_) *
os_ <<
"Reader2::read()\n";
112 readerConfig.
done =
true;
115 virtual void read(
const std::string& filename,
116 const std::string& head,
117 std::vector<MSDataPtr>& results,
121 read(filename, head, *results.back(), 0, config);
124 const char *
getType()
const {
return "Reader2";}
130 if (
os_) *
os_ <<
"testGet()\n";
140 if (
os_) *
os_ <<
"reader1 config: " << reader1->readerConfig.name << endl;
141 unit_assert(reader1->readerConfig.name ==
"default");
142 reader1->readerConfig.name =
"raw";
143 if (
os_) *
os_ <<
"reader1 config: " << reader1->readerConfig.name << endl;
165 if (
os_) *
os_ <<
"testAccept()\n";
171 if (
os_) *
os_ <<
"accept 1:\n";
173 if (
os_) *
os_ <<
"accept 2:\n";
175 if (
os_) *
os_ <<
"accept 3:\n";
184 if (
os_) *
os_ <<
"testRead()\n";
197 if (readers.
accept(
"1",
"head"))
198 readers.
read(
"1",
"head", msd);
203 if (readers.
accept(
"2",
"head"))
204 readers.
read(
"2",
"head", msd);
216 {ofstream fs(
"testSpectraDataFile.mzedML"); fs <<
"<?xml?><mzML>";}
218 bfs::remove(
"testSpectraDataFile.mzedML");
220 {ofstream fs(
"testSpectraDataFile.mzedXML"); fs <<
"<?xml?><mzXML>";}
222 bfs::remove(
"testSpectraDataFile.mzedXML");
229 config.
format = MSDataFile::Format_MZ5;
235 bfs::remove(
"testSpectraDataFile.Mz5");
237 {ofstream fs(
"testSpectraDataFile.mGF"); fs <<
"MGF";}
239 bfs::remove(
"testSpectraDataFile.mGF");
241 {ofstream fs(
"testSpectraDataFile.Ms2"); fs <<
"MS2";}
243 bfs::remove(
"testSpectraDataFile.Ms2");
245 {ofstream fs(
"testSpectraDataFile.wiFF"); fs <<
"WIFF";}
247 bfs::remove(
"testSpectraDataFile.wiFF");
249 {ofstream fs(
"_FUNC42.DAT"); fs <<
"Life, the Universe, and Everything";}
251 bfs::remove(
"_FUNC42.DAT");
264 int main(
int argc,
char* argv[])
270 if (argc==2 && !strcmp(argv[1],
"-v"))
os_ = &cout;
virtual void read(const std::string &filename, const std::string &head, MSData &result, int runIndex=0, const Config &config=Config()) const
ReaderConfig readerConfig
virtual void read(const std::string &filename, MSData &result, int runIndex=0, const Config &config=Config()) const
delegates to first child that identifies
MS_MS2_format
MS2 format: MS2 file format for MS2 spectral data.
MS_mzML_format
mzML format: Proteomics Standards Inititative mzML file format.
MS_Mascot_MGF_format
Mascot MGF format: Mascot MGF file format.
virtual std::string identify(const std::string &filename, const std::string &head) const
return file type iff Reader recognizes the file, else empty;
virtual std::string identify(const std::string &filename, const std::string &head) const
return file type iff Reader recognizes the file, else empty;
virtual const char * getType() const
fill in a vector of MSData.Id values; provides support for multi-run input files
virtual void read(const std::string &filename, const std::string &head, std::vector< MSDataPtr > &results, const Config &config=Config()) const
Reader container (composite pattern).
configuration for write()
boost::shared_ptr< Reader > ReaderPtr
default ReaderList, extended to include vendor readers
MS_Waters_raw_format
Waters raw format: Waters data file format found in a Waters RAW directory, generated from an MS acqu...
#define unit_assert_operator_equal(expected, actual)
virtual void read(const std::string &filename, const std::string &head, MSData &result, int runIndex=0, const Config &config=Config()) const
PWIZ_API_DECL void write(minimxml::XMLWriter &writer, const CV &cv)
PWIZ_API_DECL CVID identifyFileFormat(const ReaderPtr &reader, const std::string &filepath)
tries to identify a filepath using the provided Reader or ReaderList; returns the CVID file format of...
interface for file readers
boost::shared_ptr< MSData > MSDataPtr
int main(int argc, char *argv[])
MS_ISB_mzXML_format
ISB mzXML format: Institute of Systems Biology mzXML file format.
virtual void read(const std::string &filename, const std::string &head, std::vector< MSDataPtr > &results, const Config &config=Config()) const
bool accept(const std::string &filename, const std::string &head) const
return true iff Reader recognizes the file as one it should handle
#define TEST_PROLOG_EX(argc, argv, suffix)
PWIZ_API_DECL void read(std::istream &is, CV &cv)
PWIZ_API_DECL void initializeTiny(IdentData &mzid)
ReaderConfig readerConfig
MS_mz5_format
mz5 format: mz5 file format, modelled after mzML.
boost::shared_ptr< Reader > ReaderPtr
void testIdentifyFileFormat()
MS_ABI_WIFF_format
ABI WIFF format: Applied Biosystems WIFF file format.
reader_type * get()
returns pointer to Reader of the specified type
This is the root element of ProteoWizard; it represents the mzML element, defined as: intended to cap...
const char * getType() const
fill in a vector of MSData.Id values; provides support for multi-run input files