Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Attributes | List of all members
MzXMLHandler< MapType > Class Template Reference

XML handlers for MzXMLFile. More...

#include <OpenMS/FORMAT/HANDLERS/MzXMLHandler.h>

Inheritance diagram for MzXMLHandler< MapType >:
XMLHandler

Classes

struct  SpectrumData
 Data necessary to generate a single spectrum. More...
 

Public Member Functions

virtual void endElement (const XMLCh *const uri, const XMLCh *const local_name, const XMLCh *const qname)
 Parsing method for closing tags. More...
 
virtual void startElement (const XMLCh *const uri, const XMLCh *const local_name, 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 writeTo (std::ostream &os)
 Write the contents to a stream. More...
 
void setOptions (const PeakFileOptions &options)
 Sets the options. More...
 
UInt getScanCount ()
 Gets the scan count. More...
 
void setMSDataConsumer (Interfaces::IMSDataConsumer< MapType > *consumer)
 Set the IMSDataConsumer consumer which will consume the read data. More...
 
Constructors and destructor
 MzXMLHandler (MapType &exp, const String &filename, const String &version, ProgressLogger &logger)
 Constructor for a read-only handler. More...
 
 MzXMLHandler (const MapType &exp, const String &filename, const String &version, const ProgressLogger &logger)
 Constructor for a write-only handler. More...
 
virtual ~MzXMLHandler ()
 Destructor. More...
 
- Public Member Functions inherited from XMLHandler
 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...
 
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 Types

typedef MapType::PeakType PeakType
 Peak type. More...
 
typedef MSSpectrum< PeakTypeSpectrumType
 Spectrum type. More...
 

Protected Member Functions

void writeUserParam_ (std::ostream &os, const MetaInfoInterface &meta, int indent=4, String tag="nameValue")
 write metaInfo to xml (usually in nameValue-tag) More...
 
void doPopulateSpectraWithData_ (SpectrumData &spectrum_data)
 Fill a single spectrum with data from input. More...
 
void populateSpectraWithData_ ()
 Populate all spectra on the stack with data from input. More...
 
- Protected Member Functions inherited from XMLHandler
bool equal_ (const XMLCh *a, const XMLCh *b) const
 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...
 
double attributeAsDouble_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to a double. 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_ (double &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the double 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...
 
double attributeAsDouble_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a double. 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_ (double &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the double 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)
 

Protected Attributes

MapTypeexp_
 map pointer for reading More...
 
const MapTypecexp_
 map pointer for writing More...
 
PeakFileOptions options_
 Options for loading and storing. More...
 
bool skip_spectrum_
 Flag that indicates whether this spectrum should be skipped (due to options) More...
 
UInt spec_write_counter_
 spectrum counter (spectra without peaks are not written) More...
 
Interfaces::IMSDataConsumer< MapType > * consumer_
 Consumer class to work on spectra. More...
 
UInt scan_count_
 Consumer class to work on spectra. More...
 
const ProgressLoggerlogger_
 Progress logging class. More...
 
std::vector< DataProcessingdata_processing_
 data processing auxiliary variable More...
 
temporary data structures to hold parsed data
Base64 decoder_
 
Int nesting_level_
 
std::vector< SpectrumDataspectrum_data_
 Vector of spectrum data stored for later parallel processing. More...
 
- 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...
 

Private Member Functions

void init_ ()
 initialize members (call from C'tor) More...
 
 MzXMLHandler ()
 Not implemented. More...
 
void initStaticMembers_ ()
 

Static Private Attributes

static const XMLCh * s_value_ = 0
 
static const XMLCh * s_count_ = 0
 
static const XMLCh * s_type_ = 0
 
static const XMLCh * s_name_ = 0
 
static const XMLCh * s_version_ = 0
 
static const XMLCh * s_filename_ = 0
 
static const XMLCh * s_filetype_ = 0
 
static const XMLCh * s_filesha1_ = 0
 
static const XMLCh * s_completiontime_ = 0
 
static const XMLCh * s_precision_ = 0
 
static const XMLCh * s_byteorder_ = 0
 
static const XMLCh * s_pairorder_ = 0
 
static const XMLCh * s_compressionType_ = 0
 
static const XMLCh * s_precursorintensity_ = 0
 
static const XMLCh * s_precursorcharge_ = 0
 
static const XMLCh * s_windowwideness_ = 0
 
static const XMLCh * s_mslevel_ = 0
 
static const XMLCh * s_peakscount_ = 0
 
static const XMLCh * s_polarity_ = 0
 
static const XMLCh * s_scantype_ = 0
 
static const XMLCh * s_filterline_ = 0
 
static const XMLCh * s_retentiontime_ = 0
 
static const XMLCh * s_startmz_ = 0
 
static const XMLCh * s_endmz_ = 0
 
static const XMLCh * s_first_ = 0
 
static const XMLCh * s_last_ = 0
 
static const XMLCh * s_phone_ = 0
 
static const XMLCh * s_email_ = 0
 
static const XMLCh * s_uri_ = 0
 
static const XMLCh * s_num_ = 0
 
static const XMLCh * s_intensitycutoff_ = 0
 
static const XMLCh * s_centroided_ = 0
 
static const XMLCh * s_deisotoped_ = 0
 
static const XMLCh * s_chargedeconvoluted_ = 0
 

Additional Inherited Members

- Public Types inherited from XMLHandler
enum  ActionMode { LOAD, STORE }
 Action to set the current mode (for error messages) More...
 
- Static Public Member Functions inherited from XMLHandler
static String writeXMLEscape (const String &to_escape)
 Escapes a string and returns the escaped string. More...
 

Detailed Description

template<typename MapType>
class OpenMS::Internal::MzXMLHandler< MapType >

XML handlers for MzXMLFile.

MapType has to be a MSExperiment or have the same interface. Do not use this class. It is only needed in MzXMLFile.

Member Typedef Documentation

typedef MapType::PeakType PeakType
protected

Peak type.

typedef MSSpectrum<PeakType> SpectrumType
protected

Spectrum type.

Constructor & Destructor Documentation

MzXMLHandler ( MapType exp,
const String filename,
const String version,
ProgressLogger logger 
)
inline

Constructor for a read-only handler.

MzXMLHandler ( const MapType exp,
const String filename,
const String version,
const ProgressLogger logger 
)
inline

Constructor for a write-only handler.

References MzXMLHandler< MapType >::init_().

virtual ~MzXMLHandler ( )
inlinevirtual

Destructor.

MzXMLHandler ( )
private

Not implemented.

Member Function Documentation

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

Parsing method for character data.

Reimplemented from XMLHandler.

void doPopulateSpectraWithData_ ( SpectrumData spectrum_data)
inlineprotected
void endElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname 
)
virtual

Parsing method for closing tags.

Reimplemented from XMLHandler.

References OPENMS_PRECONDITION.

UInt getScanCount ( )
inline

Gets the scan count.

References MzXMLHandler< MapType >::scan_count_.

Referenced by MzXMLFile::transformFirstPass_().

void init_ ( )
inlineprivate
void initStaticMembers_ ( )
inlineprivate
void populateSpectraWithData_ ( )
inlineprotected

Populate all spectra on the stack with data from input.

Will populate all spectra on the current work stack with data (using multiple threads if available) and append them to the result.

References IMSDataConsumer< MapType >::consumeSpectrum(), MzXMLHandler< MapType >::doPopulateSpectraWithData_(), XMLHandler::file_, PeakFileOptions::getAlwaysAppendData(), PeakFileOptions::getFillData(), and PeakFileOptions::getSortSpectraByMZ().

void setMSDataConsumer ( Interfaces::IMSDataConsumer< MapType > *  consumer)
inline

Set the IMSDataConsumer consumer which will consume the read data.

References MzXMLHandler< MapType >::consumer_.

Referenced by MzXMLFile::transform().

void setOptions ( const PeakFileOptions options)
inline
void startElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname,
const xercesc::Attributes &  attrs 
)
virtual
void writeTo ( std::ostream &  os)
virtual

Write the contents to a stream.

Reimplemented from XMLHandler.

References Base64::BYTEORDER_BIGENDIAN, DataProcessing::CHARGE_DECONVOLUTION, InstrumentSettings::CRM, DataProcessing::DEISOTOPING, DateTime::get(), Precursor::getCharge(), SourceFile::getChecksum(), SourceFile::getChecksumType(), SpectrumSettings::getComment(), DataProcessing::getCompletionTime(), ContactPerson::getEmail(), SourceFile::getFileType(), ContactPerson::getFirstName(), SpectrumSettings::getInstrumentSettings(), Peak1D::getIntensity(), Instrument::getIonDetectors(), Instrument::getIonSources(), Precursor::getIsolationWindowLowerOffset(), Precursor::getIsolationWindowUpperOffset(), ContactPerson::getLastName(), Instrument::getMassAnalyzers(), MetaInfoInterface::getMetaValue(), Instrument::getModel(), MSSpectrum< PeakT >::getMSLevel(), Peak1D::getMZ(), Software::getName(), SourceFile::getNameOfFile(), SpectrumSettings::getNativeID(), InstrumentSettings::getPolarity(), SpectrumSettings::getPrecursors(), DataProcessing::getProcessingActions(), MSSpectrum< PeakT >::getRT(), InstrumentSettings::getScanMode(), InstrumentSettings::getScanWindows(), DataProcessing::getSoftware(), Instrument::getSoftware(), ContactPerson::getURL(), Instrument::getVendor(), Software::getVersion(), InstrumentSettings::getZoomScan(), String::hasPrefix(), String::hasSubstring(), InstrumentSettings::MASSSPECTRUM, MetaInfoInterface::metaValueExists(), InstrumentSettings::MS1SPECTRUM, InstrumentSettings::MSNSPECTRUM, InstrumentSettings::NamesOfScanMode, IonSource::NEGATIVE, DataProcessing::PEAK_PICKING, IonSource::POSITIVE, SourceFile::SHA1, InstrumentSettings::SIM, InstrumentSettings::SRM, String::substr(), String::toInt(), String::toLower(), DataValue::toString(), and InstrumentSettings::UNKNOWN.

void writeUserParam_ ( std::ostream &  os,
const MetaInfoInterface meta,
int  indent = 4,
String  tag = "nameValue" 
)
inlineprotected

write metaInfo to xml (usually in nameValue-tag)

References MetaInfoInterface::getKeys(), MetaInfoInterface::getMetaValue(), and XMLHandler::writeXMLEscape().

Member Data Documentation

const MapType* cexp_
protected

map pointer for writing

Interfaces::IMSDataConsumer<MapType>* consumer_
protected

Consumer class to work on spectra.

Referenced by MzXMLHandler< MapType >::setMSDataConsumer().

std::vector<DataProcessing> data_processing_
protected

data processing auxiliary variable

Base64 decoder_
protected
MapType* exp_
protected

map pointer for reading

const ProgressLogger& logger_
protected

Progress logging class.

Int nesting_level_
protected
PeakFileOptions options_
protected

Options for loading and storing.

Referenced by MzXMLHandler< MapType >::setOptions().

const XMLCh * s_byteorder_ = 0
staticprivate
const XMLCh * s_centroided_ = 0
staticprivate
const XMLCh * s_chargedeconvoluted_ = 0
staticprivate
const XMLCh * s_completiontime_ = 0
staticprivate
const XMLCh * s_compressionType_ = 0
staticprivate
const XMLCh * s_count_ = 0
staticprivate
const XMLCh * s_deisotoped_ = 0
staticprivate
const XMLCh * s_email_ = 0
staticprivate
const XMLCh * s_endmz_ = 0
staticprivate
const XMLCh * s_filename_ = 0
staticprivate
const XMLCh * s_filesha1_ = 0
staticprivate
const XMLCh * s_filetype_ = 0
staticprivate
const XMLCh * s_filterline_ = 0
staticprivate
const XMLCh * s_first_ = 0
staticprivate
const XMLCh * s_intensitycutoff_ = 0
staticprivate
const XMLCh * s_last_ = 0
staticprivate
const XMLCh * s_mslevel_ = 0
staticprivate
const XMLCh * s_name_ = 0
staticprivate
const XMLCh * s_num_ = 0
staticprivate
const XMLCh * s_pairorder_ = 0
staticprivate
const XMLCh * s_peakscount_ = 0
staticprivate
const XMLCh * s_phone_ = 0
staticprivate
const XMLCh * s_polarity_ = 0
staticprivate
const XMLCh * s_precision_ = 0
staticprivate
const XMLCh * s_precursorcharge_ = 0
staticprivate
const XMLCh * s_precursorintensity_ = 0
staticprivate
const XMLCh * s_retentiontime_ = 0
staticprivate
const XMLCh * s_scantype_ = 0
staticprivate
const XMLCh * s_startmz_ = 0
staticprivate
const XMLCh * s_type_ = 0
staticprivate
const XMLCh * s_uri_ = 0
staticprivate
const XMLCh * s_value_ = 0
staticprivate
const XMLCh * s_version_ = 0
staticprivate
const XMLCh * s_windowwideness_ = 0
staticprivate
UInt scan_count_
protected

Consumer class to work on spectra.

Referenced by MzXMLHandler< MapType >::getScanCount().

bool skip_spectrum_
protected

Flag that indicates whether this spectrum should be skipped (due to options)

UInt spec_write_counter_
protected

spectrum counter (spectra without peaks are not written)

std::vector< SpectrumData > spectrum_data_
protected

Vector of spectrum data stored for later parallel processing.


OpenMS / TOPP release 2.0.0 Documentation generated on Fri May 29 2015 17:20:47 using doxygen 1.8.9.1