Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
MzMLFile Class Reference

File adapter for MzML files. More...

#include <OpenMS/FORMAT/MzMLFile.h>

Inheritance diagram for MzMLFile:
XMLFile ProgressLogger

Public Member Functions

 MzMLFile ()
 Default constructor. More...
 
 ~MzMLFile ()
 Destructor. More...
 
PeakFileOptionsgetOptions ()
 Mutable access to the options for loading/storing. More...
 
const PeakFileOptionsgetOptions () const
 Non-mutable access to the options for loading/storing. More...
 
void setOptions (const PeakFileOptions &)
 set options for loading/storing More...
 
template<typename MapType >
void load (const String &filename, MapType &map)
 Loads a map from a MzML file. Spectra and chromatograms are sorted by default (this can be disabled using PeakFileOptions). More...
 
void loadSize (const String &filename, Size &scount, Size &ccount)
 Only count he number of spectra and chromatograms from a file. More...
 
template<typename MapType >
void store (const String &filename, const MapType &map) const
 Stores a map in a MzML file. More...
 
template<typename MapType >
void transform (const String &filename_in, Interfaces::IMSDataConsumer< MapType > *consumer, bool skip_full_count=false, bool skip_first_pass=false)
 Transforms a map while loading using the supplied MSDataConsumer. More...
 
template<typename MapType >
void transform (const String &filename_in, Interfaces::IMSDataConsumer< MapType > *consumer, MapType &map, bool skip_full_count=false, bool skip_first_pass=false)
 Transforms a map while loading using the supplied MSDataConsumer. More...
 
bool isValid (const String &filename, std::ostream &os=std::cerr)
 Checks if a file validates against the XML schema. More...
 
bool isSemanticallyValid (const String &filename, StringList &errors, StringList &warnings)
 Checks if a file is valid with respect to the mapping file and the controlled vocabulary. More...
 
- Public Member Functions inherited from XMLFile
 XMLFile ()
 Default constructor. More...
 
 XMLFile (const String &schema_location, const String &version)
 Constructor that sets the schema location. More...
 
virtual ~XMLFile ()
 Destructor. More...
 
bool isValid (const String &filename, std::ostream &os)
 Checks if a file validates against the XML schema. More...
 
const StringgetVersion () const
 return the version of the schema More...
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor. More...
 
 ~ProgressLogger ()
 Destructor. More...
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor. More...
 
ProgressLoggeroperator= (const ProgressLogger &other)
 Assignment Operator. More...
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE! More...
 
LogType getLogType () const
 Returns the type of progress log being used. More...
 
void startProgress (SignedSize begin, SignedSize end, const String &label) const
 Initializes the progress display. More...
 
void setProgress (SignedSize value) const
 Sets the current progress. More...
 
void endProgress () const
 Ends the progress display. More...
 

Protected Member Functions

template<typename MapType >
void transformFirstPass_ (const String &filename_in, Interfaces::IMSDataConsumer< MapType > *consumer, bool skip_full_count)
 Perform first pass through the file and retrieve the meta-data to initialize the consumer. More...
 
void safeParse_ (const String &filename, Internal::XMLHandler *handler)
 Safe parse that catches exceptions and handles them accordingly. More...
 
- Protected Member Functions inherited from XMLFile
void parse_ (const String &filename, XMLHandler *handler)
 Parses the XML file given by filename using the handler given by handler. More...
 
void save_ (const String &filename, XMLHandler *handler) const
 Stores the contents of the XML handler given by handler in the file given by filename. More...
 
void enforceEncoding_ (const String &encoding)
 

Private Attributes

PeakFileOptions options_
 Options for loading / storing. More...
 
String indexed_schema_location_
 Location of indexed mzML schema. More...
 

Additional Inherited Members

- Public Types inherited from ProgressLogger
enum  LogType { CMD, GUI, NONE }
 Possible log types. More...
 
- Static Protected Member Functions inherited from ProgressLogger
static String logTypeToFactoryName_ (LogType type)
 Return the name of the factory product used for this log type. More...
 
- Protected Attributes inherited from XMLFile
String schema_location_
 XML schema file location. More...
 
String schema_version_
 Version string. More...
 
String enforced_encoding_
 Encoding string that replaces the encoding (system dependent or specified in the XML). Disabled if empty. Used as a workaround for XTandem output xml. More...
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

File adapter for MzML files.

This implementation does currently not support the whole functionality of MzML.

Constructor & Destructor Documentation

MzMLFile ( )

Default constructor.

~MzMLFile ( )

Destructor.

Member Function Documentation

PeakFileOptions& getOptions ( )
const PeakFileOptions& getOptions ( ) const

Non-mutable access to the options for loading/storing.

bool isSemanticallyValid ( const String filename,
StringList errors,
StringList warnings 
)

Checks if a file is valid with respect to the mapping file and the controlled vocabulary.

Parameters
filenameFile name of the file to be checked.
errorsErrors during the validation are returned in this output parameter.
warningsWarnings during the validation are returned in this output parameter.
Exceptions
Exception::FileNotFoundis thrown if the file could not be opened
bool isValid ( const String filename,
std::ostream &  os = std::cerr 
)

Checks if a file validates against the XML schema.

Exceptions
Exception::FileNotFoundis thrown if the file cannot be found.
void load ( const String filename,
MapType map 
)
inline

Loads a map from a MzML file. Spectra and chromatograms are sorted by default (this can be disabled using PeakFileOptions).

map has to be a MSExperiment or have the same interface.

Exceptions
Exception::FileNotFoundis thrown if the file could not be opened
Exception::ParseErroris thrown if an error occurs during parsing

References MSExperiment< PeakT, ChromatogramPeakT >::reset(), DocumentIdentifier::setLoadedFilePath(), DocumentIdentifier::setLoadedFileType(), and MzMLHandler< MapType >::setOptions().

Referenced by SwathFile::doCacheFile_(), CachedSwathFileConsumer::ensureMapsAreFilled_(), FileHandler::loadExperiment(), SwathFile::loadSplit(), TOPPRNPxl::main_(), SimpleSearchEngine::main_(), TOPPMetaProSIP::main_(), and SwathFile::populateMetaData_().

void loadSize ( const String filename,
Size scount,
Size ccount 
)

Only count he number of spectra and chromatograms from a file.

void safeParse_ ( const String filename,
Internal::XMLHandler handler 
)
protected

Safe parse that catches exceptions and handles them accordingly.

void setOptions ( const PeakFileOptions )

set options for loading/storing

Referenced by IndexedMzMLFileLoader::store().

void store ( const String filename,
const MapType map 
) const
inline

Stores a map in a MzML file.

map has to be a MSExperiment or have the same interface.

Exceptions
Exception::UnableToCreateFileis thrown if the file could not be created

References MzMLHandler< MapType >::setOptions().

Referenced by TOPPRNPxl::main_(), OpenSwathWorkflow::performRTNormalization(), TOPPViewBase::runTOPPTool_(), IndexedMzMLFileLoader::store(), and FileHandler::storeExperiment().

void transform ( const String filename_in,
Interfaces::IMSDataConsumer< MapType > *  consumer,
bool  skip_full_count = false,
bool  skip_first_pass = false 
)
inline

Transforms a map while loading using the supplied MSDataConsumer.

The result will not be stored directly but is available through the events triggered by the parser and caught by the provided IMSDataConsumer object.

This function should be used if processing and storage of the result can be performed directly in the provided IMSDataConsumer object.

Note
Transformation can be speed up by setting skip_full_count which does not require a full first pass through the file to compute the correct number of spectra and chromatograms in the input file.
Parameters
filename_inFilename of input mzML file to transform
consumerConsumer class to operate on the input filename (implementing a transformation)
skip_full_countWhether to skip computing the correct number of spectra and chromatograms in the input file

References MzMLHandler< MapType >::setMSDataConsumer(), and MzMLHandler< MapType >::setOptions().

Referenced by SwathFile::doCacheFile_(), and SwathFile::loadMzML().

void transform ( const String filename_in,
Interfaces::IMSDataConsumer< MapType > *  consumer,
MapType map,
bool  skip_full_count = false,
bool  skip_first_pass = false 
)
inline

Transforms a map while loading using the supplied MSDataConsumer.

The result will be stored in the provided map.

This function should be used if a specific pre-processing should be applied to the data before storing them in a map (e.g. if data-reduction should be applied to the data before loading all data into memory).

Parameters
filename_inFilename of input mzML file to transform
consumerConsumer class to operate on the input filename (implementing a transformation)
mapMap to store the resulting spectra and chromatograms
skip_full_countWhether to skip computing the correct number of spectra and chromatograms in the input file

References PeakFileOptions::setAlwaysAppendData(), MzMLHandler< MapType >::setMSDataConsumer(), and MzMLHandler< MapType >::setOptions().

void transformFirstPass_ ( const String filename_in,
Interfaces::IMSDataConsumer< MapType > *  consumer,
bool  skip_full_count 
)
inlineprotected

Member Data Documentation

String indexed_schema_location_
private

Location of indexed mzML schema.

PeakFileOptions options_
private

Options for loading / storing.


OpenMS / TOPP release 2.0.0 Documentation generated on Tue Aug 25 2015 05:54:04 using doxygen 1.8.9.1