Facilitates file handling by file type recognition. More...
#include <OpenMS/FORMAT/FileHandler.h>
Public Member Functions | |
| PeakFileOptions & | getOptions () |
| Mutable access to the options for loading/storing. | |
| const PeakFileOptions & | getOptions () const |
| Non-mutable access to the options for loading/storing. | |
| template<class PeakType > | |
| bool | loadExperiment (const String &filename, MSExperiment< PeakType > &exp, FileTypes::Type force_type=FileTypes::UNKNOWN, ProgressLogger::LogType log=ProgressLogger::NONE) |
| Loads a file into an MSExperiment. | |
| template<class PeakType > | |
| void | storeExperiment (const String &filename, const MSExperiment< PeakType > &exp, ProgressLogger::LogType log=ProgressLogger::NONE) |
| Stores an MSExperiment to a file. | |
| template<class FeatureType > | |
| bool | loadFeatures (const String &filename, FeatureMap< FeatureType > &map, FileTypes::Type force_type=FileTypes::UNKNOWN) |
| Loads a file into a FeatureMap. | |
Static Public Member Functions | |
| static FileTypes::Type | getType (const String &filename) |
| Tries to determine the file type (by name or content). | |
| static FileTypes::Type | getTypeByFileName (const String &filename) |
| Determines the file type from a file name. | |
| static FileTypes::Type | getTypeByContent (const String &filename) |
| Determines the file type of a file by parsing the first few lines. | |
| static bool | isSupported (FileTypes::Type type) |
| Returns if the file type is supported in this build of the library. | |
Private Attributes | |
| PeakFileOptions | options_ |
Facilitates file handling by file type recognition.
This class provides file type recognition from the file name and from the file content.
It also offer a common interface to load MSExperiment data and allows querying for supported file types.
| PeakFileOptions& getOptions | ( | ) |
Mutable access to the options for loading/storing.
Referenced by TOPPViewBase::metadataFileDialog().
| const PeakFileOptions& getOptions | ( | ) | const |
Non-mutable access to the options for loading/storing.
| static FileTypes::Type getType | ( | const String & | filename | ) | [static] |
Tries to determine the file type (by name or content).
First the type is determined from the file name. If this fails, the type is determined from the file content.
| Exception::FileNotFound | is thrown if the file is not present |
Referenced by TOPPViewBase::addDataFile(), and IDEvaluationBase::loadCurve().
| static FileTypes::Type getTypeByContent | ( | const String & | filename | ) | [static] |
Determines the file type of a file by parsing the first few lines.
| Exception::FileNotFound | is thrown if the file is not present |
Referenced by InspectOutfile::getExperiment().
| static FileTypes::Type getTypeByFileName | ( | const String & | filename | ) | [static] |
Determines the file type from a file name.
| static bool isSupported | ( | FileTypes::Type | type | ) | [static] |
Returns if the file type is supported in this build of the library.
| bool loadExperiment | ( | const String & | filename, | |
| MSExperiment< PeakType > & | exp, | |||
| FileTypes::Type | force_type = FileTypes::UNKNOWN, |
|||
| ProgressLogger::LogType | log = ProgressLogger::NONE | |||
| ) | [inline] |
Loads a file into an MSExperiment.
| filename | The file name of the file to load. | |
| exp | The experiment to load the data into. | |
| force_type | Forces to load the file with that file type. If no type is forced, it is determined from the extention ( or from the content if that fails). | |
| log | Progress logging mode |
| Exception::FileNotFound | is thrown if the file could not be opened | |
| Exception::ParseError | is thrown if an error occurs during parsing |
References FileTypes::DTA, FileTypes::DTA2D, MzMLFile::getOptions(), MzDataFile::getOptions(), MzXMLFile::getOptions(), DTA2DFile::getOptions(), MS2File::load(), MascotGenericFile::load(), MzMLFile::load(), MzDataFile::load(), MzXMLFile::load(), DTA2DFile::load(), FileTypes::MGF, FileTypes::MS2, FileTypes::MZDATA, FileTypes::MZML, FileTypes::MZXML, MSExperiment< PeakT, ChromatogramPeakT >::reset(), ProgressLogger::setLogType(), FileTypes::UNKNOWN, and FileTypes::XMASS.
Referenced by TOPPViewBase::addDataFile(), InspectOutfile::getExperiment(), and TOPPViewBase::metadataFileDialog().
| bool loadFeatures | ( | const String & | filename, | |
| FeatureMap< FeatureType > & | map, | |||
| FileTypes::Type | force_type = FileTypes::UNKNOWN | |||
| ) | [inline] |
Loads a file into a FeatureMap.
| filename | the file name of the file to load. | |
| map | The FeatureMap to load the data into. | |
| force_type | Forces to load the file with that file type. If no type is forced, it is determined from the extention ( or from the content if that fails). |
| Exception::FileNotFound | is thrown if the file could not be opened | |
| Exception::ParseError | is thrown if an error occurs during parsing |
References FileTypes::FEATUREXML, FileTypes::KROENIK, FileTypes::PEPLIST, FileTypes::TSV, and FileTypes::UNKNOWN.
| void storeExperiment | ( | const String & | filename, | |
| const MSExperiment< PeakType > & | exp, | |||
| ProgressLogger::LogType | log = ProgressLogger::NONE | |||
| ) | [inline] |
Stores an MSExperiment to a file.
The file type to store the data in is determined by the file name. Supported formats for storing are mzML, mzXML, mzData and DTA2D. If the file format cannot be determined from the file name, the mzML format is used.
| filename | The name of the file to store the data in. | |
| exp | The experiment to store. | |
| log | Progress logging mode |
| Exception::UnableToCreateFile | is thrown if the file could not be written |
References FileTypes::DTA2D, MSExperiment< PeakT, ChromatogramPeakT >::getChromatograms(), MzMLFile::getOptions(), MzDataFile::getOptions(), MzXMLFile::getOptions(), DTA2DFile::getOptions(), FileTypes::MZDATA, FileTypes::MZXML, ProgressLogger::setLogType(), MzMLFile::store(), MzDataFile::store(), MzXMLFile::store(), and DTA2DFile::store().
PeakFileOptions options_ [private] |
| OpenMS / TOPP release 1.10.0 | Documentation generated on Thu Mar 7 2013 09:42:53 using doxygen 1.7.1 |