OpenMS
Loading...
Searching...
No Matches
FeatureXMLFile Class Reference

This class provides Input/Output functionality for feature maps. More...

#include <OpenMS/FORMAT/FeatureXMLFile.h>

Inheritance diagram for FeatureXMLFile:
[legend]
Collaboration diagram for FeatureXMLFile:
[legend]

Constructors and Destructor

FeatureFileOptions options_
 Options that can be set.
 
 FeatureXMLFile ()
 Default constructor.
 
 ~FeatureXMLFile () override
 Destructor.
 
void load (const std::string &filename, FeatureMap &feature_map)
 loads the file with name filename into map and calls updateRanges().
 
Size loadSize (const std::string &filename)
 
void store (const std::string &filename, const FeatureMap &feature_map)
 stores the map feature_map in file with name filename.
 
FeatureFileOptionsgetOptions ()
 Mutable access to the options for loading/storing.
 
const FeatureFileOptionsgetOptions () const
 Non-mutable access to the options for loading/storing.
 
void setOptions (const FeatureFileOptions &)
 setter for options for loading/storing
 

Additional Inherited Members

- Public Types inherited from ProgressLogger
enum  LogType { CMD , GUI , NONE }
 Possible log types. More...
 
- Public Member Functions inherited from XMLFile
 XMLFile ()
 Construct an XMLFile without schema info; schema_location_ remains unset, so isValid cannot be used until derived-class logic initializes schema_location_ before calling isValid.
 
 XMLFile (const std::string &schema_location, const std::string &version)
 Construct with a schema location for later isValid calls.
 
virtual ~XMLFile ()
 Virtual destructor — defaulted; allows safe deletion through a base-class pointer.
 
bool isValid (const std::string &filename, std::ostream &os)
 Check if filename validates against the bound XML schema.
 
const std::string & getVersion () const
 Return the schema version string passed to the parameterised constructor; empty for default-constructed instances.
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor.
 
virtual ~ProgressLogger ()
 Destructor.
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor.
 
ProgressLoggeroperator= (const ProgressLogger &other)
 Assignment Operator.
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE!
 
LogType getLogType () const
 Returns the type of progress log being used.
 
void setLogger (ProgressLoggerImpl *logger)
 Sets the logger to be used for progress logging.
 
void startProgress (SignedSize begin, SignedSize end, const std::string &label) const
 Initializes the progress display.
 
void setProgress (SignedSize value) const
 Sets the current progress.
 
void endProgress (UInt64 bytes_processed=0) const
 
void nextProgress () const
 increment progress by 1 (according to range begin-end)
 
- Protected Member Functions inherited from XMLFile
void parse_ (const std::string &filename, XMLHandler *handler)
 Parse the XML file at filename through handler.
 
void parseBuffer_ (const std::string &buffer, XMLHandler *handler)
 Parse an in-memory XML buffer through handler.
 
void save_ (const std::string &filename, XMLHandler *handler) const
 Stores the contents of the XML handler given by handler in the file given by filename.
 
void enforceEncoding_ (const std::string &encoding)
 Set or clear the XML-encoding override applied to subsequent parse_ / parseBuffer_ calls.
 
- Protected Attributes inherited from XMLFile
std::string schema_location_
 Path of the XML schema for validation; empty when the default constructor was used (isValid then throws NotImplemented).
 
std::string schema_version_
 Schema version string returned by getVersion.
 
std::string enforced_encoding_
 Optional XML encoding override applied to the InputSource in parse_ and parseBuffer_; empty disables the override. Used as a workaround for XTandem output XML which carries an encoding the parser otherwise stumbles on.
 
- 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

This class provides Input/Output functionality for feature maps.

A documented schema for this format can be found at https://github.com/OpenMS/OpenMS/tree/develop/share/OpenMS/SCHEMAS

Todo:
Take care that unique ids are assigned properly by TOPP tools before calling FeatureXMLFile::store(). There will be a message on OPENMS_LOG_INFO but we will make no attempt to fix the problem in this class. (all developers)

Constructor & Destructor Documentation

◆ FeatureXMLFile()

Default constructor.

◆ ~FeatureXMLFile()

~FeatureXMLFile ( )
override

Destructor.

Member Function Documentation

◆ getOptions() [1/2]

FeatureFileOptions & getOptions ( )

Mutable access to the options for loading/storing.

◆ getOptions() [2/2]

const FeatureFileOptions & getOptions ( ) const

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

◆ load()

void load ( const std::string &  filename,
FeatureMap feature_map 
)

loads the file with name filename into map and calls updateRanges().

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

◆ loadSize()

Size loadSize ( const std::string &  filename)

◆ setOptions()

void setOptions ( const FeatureFileOptions )

setter for options for loading/storing

◆ store()

void store ( const std::string &  filename,
const FeatureMap feature_map 
)

stores the map feature_map in file with name filename.

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

Member Data Documentation

◆ options_

FeatureFileOptions options_
protected

Options that can be set.