Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
File and DB access

All classes for file and database IO can be found in the FORMAT folder.

File adapter classes

The interface of most file adapter classes is very similar. They implement a load and a store method, that take a file name and the appropriate data structure.

The following example (Tutorial_FileIO.C) demonstrates the use of MzMLFile and MzXMLFile to convert one format into another using MSExperiment to hold the temporary data:

int main(int argc, const char** argv)
{
if (argc < 2) return 1;
// the path to the data should be given on the command line
String tutorial_data_path(argv[1]);
MzXMLFile mzxml;
MzMLFile mzml;
// temporary data storage
MSExperiment<Peak1D> map;
// convert MzXML to MzML
mzxml.load(tutorial_data_path + "/data/Tutorial_FileIO.mzXML", map);
mzml.store("Tutorial_FileIO.mzML", map);
return 0;
} //end of main

FileHandler
In order to make the handling of different file types easier, the class FileHandler can be used. It loads a file into the appropriate data structure independently of the file type. The file type is determined from the file extension or the file contents:
MSExperiment<> in;
FileHandler handler();
handler.loadExperiment("input.mzML",in);

DB access

For database access, the class DBAdapter is used. As its interface is very similar to the interface of the file adapters, no example is shown here.

PeakFileOptions

In order to have more control over loading data from files or databases, most adapters can be configured using PeakFileOptions. The following options are available:


OpenMS / TOPP release 1.11.1 Documentation generated on Sun Sep 7 2014 06:42:38 using doxygen 1.8.8