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

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

#include <OpenMS/FORMAT/FeatureXMLFile.h>

Inheritance diagram for FeatureXMLFile:
XMLHandler XMLFile ProgressLogger

Public Member Functions

void load (const String &filename, FeatureMap<> &feature_map)
 loads the file with name filename into map and calls updateRanges(). More...
 
Size loadSize (const String &filename)
 
void store (const String &filename, const FeatureMap<> &feature_map)
 stores the map feature_map in file with name filename. More...
 
FeatureFileOptionsgetOptions ()
 Mutable access to the options for loading/storing. More...
 
const FeatureFileOptionsgetOptions () const
 Non-mutable access to the options for loading/storing. More...
 
void setOptions (const FeatureFileOptions &)
 setter for options for loading/storing More...
 
Constructors and Destructor
 FeatureXMLFile ()
 Default constructor. More...
 
 ~FeatureXMLFile ()
 Destructor. 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=std::cerr)
 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...
 
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

void resetMembers_ ()
 
virtual void endElement (const XMLCh *const , const XMLCh *const , const XMLCh *const qname)
 Parsing method for closing tags. More...
 
virtual void startElement (const XMLCh *const , const XMLCh *const , const XMLCh *const qname, const xercesc::Attributes &attributes)
 Parsing method for opening tags. More...
 
virtual void characters (const XMLCh *const chars, const XMLSize_t length)
 Parsing method for character data. More...
 
void writeFeature_ (const String &filename, std::ostream &os, const Feature &feat, const String &identifier_prefix, UInt64 identifier, UInt indentation_level)
 Writes a feature to a stream. More...
 
void writePeptideIdentification_ (const String &filename, std::ostream &os, const PeptideIdentification &id, const String &tag_name, UInt indentation_level)
 Writes a peptide identification to a stream (for assigned/unassigned peptide identifications) More...
 
void updateCurrentFeature_ (bool create)
 update the pointer to the current feature More...
 
- Protected Member Functions inherited from XMLHandler
bool equal_ (const XMLCh *a, const XMLCh *b)
 Returns if two xerces strings are equal. More...
 
void writeUserParam_ (const String &tag_name, std::ostream &os, const MetaInfoInterface &meta, UInt indent) const
 Writes the content of MetaInfoInterface to the file. More...
 
Int asInt_ (const String &in)
 Conversion of a String to an integer value. More...
 
Int asInt_ (const XMLCh *in)
 Conversion of a Xerces string to an integer value. More...
 
UInt asUInt_ (const String &in)
 Conversion of a String to an unsigned integer value. More...
 
double asDouble_ (const String &in)
 Conversion of a String to a double value. More...
 
float asFloat_ (const String &in)
 Conversion of a String to a float value. More...
 
bool asBool_ (const String &in)
 Conversion of a string to a boolean value. More...
 
DateTime asDateTime_ (String date_string)
 Conversion of a xs:datetime string to a DataTime value. More...
 
char * attributeAsString_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to a String. More...
 
Int attributeAsInt_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to a Int. More...
 
DoubleReal attributeAsDouble_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to a DoubleReal. More...
 
DoubleList attributeAsDoubleList_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to a DoubleList. More...
 
IntList attributeAsIntList_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to an IntList. More...
 
StringList attributeAsStringList_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to an StringList. More...
 
bool optionalAttributeAsString_ (String &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the String value if the attribute is present. More...
 
bool optionalAttributeAsInt_ (Int &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the Int value if the attribute is present. More...
 
bool optionalAttributeAsUInt_ (UInt &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the UInt value if the attribute is present. More...
 
bool optionalAttributeAsDouble_ (DoubleReal &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the DoubleReal value if the attribute is present. More...
 
bool optionalAttributeAsDoubleList_ (DoubleList &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the DoubleList value if the attribute is present. More...
 
bool optionalAttributeAsStringList_ (StringList &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the StringList value if the attribute is present. More...
 
bool optionalAttributeAsIntList_ (IntList &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the IntList value if the attribute is present. More...
 
char * attributeAsString_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a String. More...
 
Int attributeAsInt_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a Int. More...
 
DoubleReal attributeAsDouble_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a DoubleReal. More...
 
DoubleList attributeAsDoubleList_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a DoubleList. More...
 
IntList attributeAsIntList_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a IntList. More...
 
StringList attributeAsStringList_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a StringList. More...
 
bool optionalAttributeAsString_ (String &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the String value if the attribute is present. More...
 
bool optionalAttributeAsInt_ (Int &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the Int value if the attribute is present. More...
 
bool optionalAttributeAsUInt_ (UInt &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the UInt value if the attribute is present. More...
 
bool optionalAttributeAsDouble_ (DoubleReal &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the DoubleReal value if the attribute is present. More...
 
bool optionalAttributeAsDoubleList_ (DoubleList &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the DoubleList value if the attribute is present. More...
 
bool optionalAttributeAsIntList_ (IntList &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the IntList value if the attribute is present. More...
 
bool optionalAttributeAsStringList_ (StringList &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the StringList value if the attribute is present. More...
 
SignedSize cvStringToEnum_ (const Size section, const String &term, const char *message, const SignedSize result_on_error=0)
 
 XMLHandler (const String &filename, const String &version)
 Default constructor. More...
 
virtual ~XMLHandler ()
 Destructor. More...
 
void reset ()
 Release internal memory used for parsing (call. More...
 
void fatalError (ActionMode mode, const String &msg, UInt line=0, UInt column=0) const
 Fatal error handler. Throws a ParseError exception. More...
 
void error (ActionMode mode, const String &msg, UInt line=0, UInt column=0) const
 Error handler for recoverable errors. More...
 
void warning (ActionMode mode, const String &msg, UInt line=0, UInt column=0) const
 Warning handler. More...
 
virtual void writeTo (std::ostream &)
 Writes the contents to a stream. More...
 
String errorString ()
 Returns the last error description. More...
 
void fatalError (const xercesc::SAXParseException &exception)
 
void error (const xercesc::SAXParseException &exception)
 
void warning (const xercesc::SAXParseException &exception)
 
- 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)
 
 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=std::cerr)
 Checks if a file validates against the XML schema. More...
 
const StringgetVersion () const
 return the version of the schema More...
 
- Protected Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor. More...
 
 ~ProgressLogger ()
 Destructor. 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 Attributes

Int disable_parsing_
 
Featurecurrent_feature_
 points to the last open <feature> tag (possibly a subordinate feature) More...
 
FeatureMap< Feature > * map_
 Feature map pointer for reading. More...
 
FeatureFileOptions options_
 Options that can be set. More...
 
bool size_only_
 only parse until "count" tag is reached (used in loadSize()) More...
 
Size expected_size_
 holds the putative size given in count More...
 
UInt dim_
 current dimension of the feature position, quality, or convex hull point More...
 
bool in_description_
 for downward compatibility, all tags in the old description must be ignored More...
 
Int subordinate_feature_level_
 level in Feature stack during parsing More...
 
MetaInfoInterfacelast_meta_
 Pointer to last read object as a MetaInfoInterface, or null. More...
 
ProteinIdentification prot_id_
 Temporary protein ProteinIdentification. More...
 
PeptideIdentification pep_id_
 Temporary peptide ProteinIdentification. More...
 
ProteinHit prot_hit_
 Temporary protein hit. More...
 
PeptideHit pep_hit_
 Temporary peptide hit. More...
 
Map< String, Stringproteinid_to_accession_
 Map from protein id to accession. More...
 
Map< String, Sizeaccession_to_id_
 Map from search identifier concatenated with protein accession to id. More...
 
Map< String, Stringidentifier_id_
 Map from identification run identifier to file xs:id (for linking peptide identifications to the corresponding run) More...
 
Map< String, Stringid_identifier_
 Map from file xs:id to identification run identifier (for linking peptide identifications to the corresponding run) More...
 
ProteinIdentification::SearchParameters search_param_
 Temporary search parameters file. More...
 
temporary data structures to hold parsed data
ModelDescription< 2 > model_desc_
 
Param param_
 
ConvexHull2D::PointArrayType current_chull_
 
DPosition< 2 > hull_position_
 
- Protected Attributes inherited from XMLHandler
String error_message_
 Error message of the last error. More...
 
String file_
 File name. More...
 
String version_
 Schema version. More...
 
StringManager sm_
 Helper class for string conversion. More...
 
std::vector< Stringopen_tags_
 Stack of open XML tags. More...
 
std::vector< std::vector
< String > > 
cv_terms_
 Array of CV term lists (one sublist denotes one term and it's children) 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 dependend or specified in the XML). Disabled if empty. Used as a workaround for XTandem output xml. More...
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
SignedSize begin_
 
SignedSize end_
 
SignedSize value_
 
QProgressDialog * dlg_
 
StopWatch stop_watch_
 
time_t last_invoke_
 

Additional Inherited Members

- Public Types inherited from ProgressLogger
enum  LogType { CMD, GUI, NONE }
 Possible log types. More...
 
- Protected Types inherited from XMLHandler
enum  ActionMode { LOAD, STORE }
 Action to set the current mode (for error messages) More...
 
- Protected Types inherited from ProgressLogger
enum  LogType { CMD, GUI, NONE }
 Possible log types. More...
 
- 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 http://open-ms.sourceforge.net/schemas/.

Todo:
Take care that unique ids are assigned properly by TOPP tools before calling FeatureXMLFile::store(). There will be a message on LOG_INFO but we will make no attempt to fix the problem in this class. (all developers)
Note
This format will eventually be replaced by the HUPO-PSI AnalysisXML (mzIdentML and mzQuantML) formats!

Constructor & Destructor Documentation

Default constructor.

Destructor.

Member Function Documentation

virtual void characters ( const XMLCh *const  chars,
const XMLSize_t  length 
)
protectedvirtual

Parsing method for character data.

Reimplemented from XMLHandler.

virtual void endElement ( const XMLCh *  uri,
const XMLCh *  localname,
const XMLCh *const  qname 
)
protectedvirtual

Parsing method for closing tags.

Reimplemented from XMLHandler.

FeatureFileOptions& getOptions ( )

Mutable access to the options for loading/storing.

const FeatureFileOptions& getOptions ( ) const

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

void load ( const 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

Referenced by TOPPViewBase::addDataFile(), and FileHandler::loadFeatures().

Size loadSize ( const String filename)
void resetMembers_ ( )
protected
void setOptions ( const FeatureFileOptions )

setter for options for loading/storing

virtual void startElement ( const XMLCh *  uri,
const XMLCh *  localname,
const XMLCh *const  qname,
const xercesc::Attributes &  attrs 
)
protectedvirtual

Parsing method for opening tags.

Reimplemented from XMLHandler.

void store ( const 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

Referenced by FeatureFinderAlgorithmPicked< PeakType, FeatureType >::run(), TOPPViewBase::runTOPPTool_(), and SILACAnalyzer::writeFeatures().

void updateCurrentFeature_ ( bool  create)
protected

update the pointer to the current feature

Parameters
createIf true, a new (empty) Feature is added at the appropriate subordinate_feature_level_
void writeFeature_ ( const String filename,
std::ostream &  os,
const Feature feat,
const String identifier_prefix,
UInt64  identifier,
UInt  indentation_level 
)
protected

Writes a feature to a stream.

void writePeptideIdentification_ ( const String filename,
std::ostream &  os,
const PeptideIdentification id,
const String tag_name,
UInt  indentation_level 
)
protected

Writes a peptide identification to a stream (for assigned/unassigned peptide identifications)

Member Data Documentation

Map<String, Size> accession_to_id_
protected

Map from search identifier concatenated with protein accession to id.

ConvexHull2D::PointArrayType current_chull_
protected
Feature* current_feature_
protected

points to the last open <feature> tag (possibly a subordinate feature)

UInt dim_
protected

current dimension of the feature position, quality, or convex hull point

Int disable_parsing_
protected

allows for early return in parsing functions when certain sections should be ignored <=0 - parsing ON >0 - this number of tags have been entered that forbid parsing and need to be exited before parsing continues

Size expected_size_
protected

holds the putative size given in count

DPosition<2> hull_position_
protected
Map<String, String> id_identifier_
protected

Map from file xs:id to identification run identifier (for linking peptide identifications to the corresponding run)

Map<String, String> identifier_id_
protected

Map from identification run identifier to file xs:id (for linking peptide identifications to the corresponding run)

bool in_description_
protected

for downward compatibility, all tags in the old description must be ignored

MetaInfoInterface* last_meta_
protected

Pointer to last read object as a MetaInfoInterface, or null.

FeatureMap<Feature>* map_
protected

Feature map pointer for reading.

ModelDescription<2> model_desc_
protected
FeatureFileOptions options_
protected

Options that can be set.

Param param_
protected
PeptideHit pep_hit_
protected

Temporary peptide hit.

PeptideIdentification pep_id_
protected

Temporary peptide ProteinIdentification.

ProteinHit prot_hit_
protected

Temporary protein hit.

ProteinIdentification prot_id_
protected

Temporary protein ProteinIdentification.

Map<String, String> proteinid_to_accession_
protected

Map from protein id to accession.

ProteinIdentification::SearchParameters search_param_
protected

Temporary search parameters file.

bool size_only_
protected

only parse until "count" tag is reached (used in loadSize())

Int subordinate_feature_level_
protected

level in Feature stack during parsing


OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:30 using doxygen 1.8.5