Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions

MzDataHandler< MapType > Class Template Reference

XML handler for MzDataFile. More...

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

Inheritance diagram for MzDataHandler< MapType >:
XMLHandler DefaultHandler

List of all members.

Public Member Functions

virtual void endElement (const XMLCh *const , const XMLCh *const , const XMLCh *const qname)
 Parsing method for closing tags.
virtual void startElement (const XMLCh *const , const XMLCh *const , const XMLCh *const qname, const xercesc::Attributes &attributes)
 Parsing method for opening tags.
virtual void characters (const XMLCh *const chars, const XMLSize_t length)
 Parsing method for character data.
void writeTo (std::ostream &os)
 Writes the contents to a stream.
void setOptions (const PeakFileOptions &options)
 Sets the options.
Constructors and destructor

 MzDataHandler (MapType &exp, const String &filename, const String &version, ProgressLogger &logger)
 Constructor for a write-only handler.
 MzDataHandler (const MapType &exp, const String &filename, const String &version, const ProgressLogger &logger)
 Constructor for a read-only handler.
virtual ~MzDataHandler ()
 Destructor.

Protected Types

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

Protected Member Functions

void fillData_ ()
 fills the current spectrum with peaks and meta data
void writeBinary_ (std::ostream &os, Size size, const String &tag, const String &name="", SignedSize id=-1)
 write binary data to stream (first one)
cvParam and userParam handling methods (for mzData and featureXML)

void writeCVS_ (std::ostream &os, DoubleReal value, const String &acc, const String &name, UInt indent=4) const
 write cvParam containing strings to stream
void writeCVS_ (std::ostream &os, const String &value, const String &acc, const String &name, UInt indent=4) const
 write cvParam containing strings to stream
void writeCVS_ (std::ostream &os, UInt value, UInt map, const String &acc, const String &name, UInt indent=4)
 write cvParam element to stream
void writeUserParam_ (std::ostream &os, const MetaInfoInterface &meta, UInt indent=4)
 Writing the MetaInfo as UserParam to the file.
void cvParam_ (const String &name, const String &value)
 read attributes of MzData's cvParamType

Protected Attributes

MapType * exp_
 map pointer for reading
const MapType * cexp_
 map pointer for writing
PeakFileOptions options_
 Options that can be set for loading/storing.
Base64 decoder_
 Decoder/Encoder for Base64-data in MzData.
bool skip_spectrum_
 Flag that indicates whether this spectrum should be skipped (due to options).
const ProgressLoggerlogger_
 Progress logger.
DataProcessing data_processing_
temporary datastructures to hold parsed data

UInt peak_count_
 The number of peaks in the current spectrum.
SpectrumType spec_
 The current spectrum.
std::vector< std::pair< String,
MetaInfoDescription > > 
meta_id_descs_
 An array of pairs MetaInfodescriptions and their ids.
std::vector< Stringdata_to_decode_
 encoded data which is read and has to be decoded
std::vector< Realdata_to_encode_
 floating point numbers which have to be encoded and written
std::vector< std::vector< Real > > decoded_list_
std::vector< std::vector
< DoubleReal > > 
decoded_double_list_
std::vector< Stringprecisions_
std::vector< Stringendians_

Private Member Functions

void init_ ()

Detailed Description

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

XML handler for MzDataFile.

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

Improvement:
Add implementation and tests of 'supDataArray' to store IntegerDataArray and StringDataArray of MSSpectrum (Hiwi)

Member Typedef Documentation

typedef MapType::PeakType PeakType [protected]

Peak type.

typedef MSSpectrum<PeakType> SpectrumType [protected]

Spectrum type.


Constructor & Destructor Documentation

MzDataHandler ( MapType &  exp,
const String filename,
const String version,
ProgressLogger logger 
) [inline]

Constructor for a write-only handler.

References MzDataHandler< MapType >::init_().

MzDataHandler ( const MapType &  exp,
const String filename,
const String version,
const ProgressLogger logger 
) [inline]

Constructor for a read-only handler.

References MzDataHandler< MapType >::init_().

virtual ~MzDataHandler (  )  [inline, virtual]

Destructor.


Member Function Documentation

void init_ (  )  [inline, private]
void setOptions ( const PeakFileOptions options  )  [inline]

Sets the options.

References MzDataHandler< MapType >::options_.

Referenced by MzDataFile::load(), and MzDataFile::store().

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

Parsing method for opening tags.

Reimplemented from XMLHandler.

References XMLHandler::asDateTime_(), XMLHandler::attributeAsInt_(), XMLHandler::attributeAsString_(), ScanWindow::begin, PeakFileOptions::containsMSLevel(), StringManager::convert(), MzDataHandler< MapType >::cvParam_(), MzDataHandler< MapType >::data_processing_, MzDataHandler< MapType >::data_to_decode_, ScanWindow::end, MzDataHandler< MapType >::endians_, MzDataHandler< MapType >::exp_, SpectrumSettings::getAcquisitionInfo(), SpectrumSettings::getDataProcessing(), MSSpectrum< PeakT >::getFloatDataArrays(), SpectrumSettings::getInstrumentSettings(), PeakFileOptions::getMetadataOnly(), MSSpectrum< PeakT >::getMSLevel(), SpectrumSettings::getPrecursors(), InstrumentSettings::getScanWindows(), PeakFileOptions::hasMSLevels(), XMLHandler::LOAD, MzDataHandler< MapType >::logger_, MzDataHandler< MapType >::meta_id_descs_, XMLHandler::open_tags_, XMLHandler::optionalAttributeAsDouble_(), XMLHandler::optionalAttributeAsString_(), MzDataHandler< MapType >::options_, MzDataHandler< MapType >::peak_count_, SpectrumSettings::PEAKS, MzDataHandler< MapType >::precisions_, SpectrumSettings::RAWDATA, DataProcessing::setCompletionTime(), MetaInfoInterface::setMetaValue(), AcquisitionInfo::setMethodOfCombination(), MSSpectrum< PeakT >::setMSLevel(), SpectrumSettings::setNativeID(), SpectrumSettings::setType(), MzDataHandler< MapType >::skip_spectrum_, XMLHandler::sm_, MzDataHandler< MapType >::spec_, ProgressLogger::startProgress(), SpectrumSettings::UNKNOWN, and XMLHandler::warning().

void writeBinary_ ( std::ostream &  os,
Size  size,
const String tag,
const String name = "",
SignedSize  id = -1 
) [inline, protected]

write binary data to stream (first one)

The name and id are only used if the tag is supDataArrayBinary or supDataArray.

References Base64::BYTEORDER_LITTLEENDIAN, MzDataHandler< MapType >::data_to_encode_, MzDataHandler< MapType >::decoder_, and Base64::encode().

Referenced by MzDataHandler< MapType >::writeTo().

void writeCVS_ ( std::ostream &  os,
DoubleReal  value,
const String acc,
const String name,
UInt  indent = 4 
) const [inline, protected]

write cvParam containing strings to stream

value string value acc accession number defined by ontology name term defined by ontology indent number of tabs used in front of tag

Example: <cvParam cvLabel="psi" accession="PSI:@p acc" name="@p name" value="@p value"/>

Referenced by MzDataHandler< MapType >::writeCVS_(), and MzDataHandler< MapType >::writeTo().

void writeCVS_ ( std::ostream &  os,
const String value,
const String acc,
const String name,
UInt  indent = 4 
) const [inline, protected]

write cvParam containing strings to stream

value string value acc accession number defined by ontology name term defined by ontology indent number of tabs used in front of tag

Example: <cvParam cvLabel="psi" accession="PSI:@p acc" name="@p name" value="@p value"/>

void writeCVS_ ( std::ostream &  os,
UInt  value,
UInt  map,
const String acc,
const String name,
UInt  indent = 4 
) [inline, protected]

write cvParam element to stream

os Output stream value enumeration value map index if the terms in cv_terms_ acc accession number defined by ontology name term defined by ontology indent number of tabs used in front of tag

Example: <cvParam cvLabel="psi" accession="PSI:@p acc" name="@p name" value=""/>

References XMLHandler::cv_terms_, XMLHandler::STORE, XMLHandler::warning(), and MzDataHandler< MapType >::writeCVS_().

void writeTo ( std::ostream &  os  )  [virtual]

Writes the contents to a stream.

Reimplemented from XMLHandler.

References InstrumentSettings::ABSORBTION, MzDataHandler< MapType >::cexp_, DataProcessing::CHARGE_DECONVOLUTION, InstrumentSettings::CNG, InstrumentSettings::CNL, InstrumentSettings::CRM, MzDataHandler< MapType >::data_to_encode_, DataProcessing::DEISOTOPING, InstrumentSettings::EMC, ProgressLogger::endProgress(), XMLHandler::error(), DateTime::get(), MassAnalyzer::getAccuracy(), SpectrumSettings::getAcquisitionInfo(), Precursor::getActivationEnergy(), Precursor::getActivationMethods(), Precursor::getCharge(), DataProcessing::getCompletionTime(), Sample::getConcentration(), Instrument::getCustomizations(), MassAnalyzer::getFinalMSExponent(), MSSpectrum< PeakT >::getFloatDataArrays(), Acquisition::getIdentifier(), SpectrumSettings::getInstrumentSettings(), Peak1D::getIntensity(), Instrument::getIonDetectors(), Instrument::getIonSources(), MassAnalyzer::getIsolationWidth(), MassAnalyzer::getMagneticFieldStrength(), Sample::getMass(), Instrument::getMassAnalyzers(), AcquisitionInfo::getMethodOfCombination(), Instrument::getModel(), MSSpectrum< PeakT >::getMSLevel(), Peak1D::getMZ(), Software::getName(), Instrument::getName(), Sample::getName(), SpectrumSettings::getNativeID(), Sample::getNumber(), InstrumentSettings::getPolarity(), SpectrumSettings::getPrecursors(), DataProcessing::getProcessingActions(), MassAnalyzer::getReflectronState(), MassAnalyzer::getResolution(), MassAnalyzer::getResolutionMethod(), MassAnalyzer::getResolutionType(), MSSpectrum< PeakT >::getRT(), MassAnalyzer::getScanDirection(), MassAnalyzer::getScanLaw(), InstrumentSettings::getScanMode(), MassAnalyzer::getScanRate(), MassAnalyzer::getScanTime(), InstrumentSettings::getScanWindows(), DataProcessing::getSoftware(), Sample::getState(), MassAnalyzer::getTOFTotalPathLength(), SpectrumSettings::getType(), MassAnalyzer::getType(), Instrument::getVendor(), Software::getVersion(), Sample::getVolume(), PeakFileOptions::getWriteSupplementalData(), InstrumentSettings::getZoomScan(), Map< Key, T >::has(), String::hasPrefix(), MetaInfoInterface::isMetaEmpty(), XMLHandler::LOAD, MzDataHandler< MapType >::logger_, InstrumentSettings::MASSSPECTRUM, InstrumentSettings::MS1SPECTRUM, InstrumentSettings::MSNSPECTRUM, InstrumentSettings::NamesOfScanMode, MzDataHandler< MapType >::options_, DataProcessing::PEAK_PICKING, InstrumentSettings::PRECURSOR, ProgressLogger::setProgress(), InstrumentSettings::SIM, InstrumentSettings::SRM, ProgressLogger::startProgress(), XMLHandler::STORE, String::substr(), InstrumentSettings::TDF, String::toInt(), InstrumentSettings::UNKNOWN, XMLHandler::warning(), MzDataHandler< MapType >::writeBinary_(), MzDataHandler< MapType >::writeCVS_(), and MzDataHandler< MapType >::writeUserParam_().

void writeUserParam_ ( std::ostream &  os,
const MetaInfoInterface meta,
UInt  indent = 4 
) [inline, protected]

Writing the MetaInfo as UserParam to the file.

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

Referenced by MzDataHandler< MapType >::writeTo().


Member Data Documentation

const MapType* cexp_ [protected]

map pointer for writing

Referenced by MzDataHandler< MapType >::writeTo().

std::vector<Real> data_to_encode_ [protected]

floating point numbers which have to be encoded and written

Referenced by MzDataHandler< MapType >::writeBinary_(), and MzDataHandler< MapType >::writeTo().

std::vector<std::vector<Real> > decoded_list_ [protected]
Base64 decoder_ [protected]

Decoder/Encoder for Base64-data in MzData.

Referenced by MzDataHandler< MapType >::fillData_(), and MzDataHandler< MapType >::writeBinary_().

std::vector<std::pair<String, MetaInfoDescription> > meta_id_descs_ [protected]

An array of pairs MetaInfodescriptions and their ids.

Referenced by MzDataHandler< MapType >::endElement(), and MzDataHandler< MapType >::startElement().

UInt peak_count_ [protected]

The number of peaks in the current spectrum.

Referenced by MzDataHandler< MapType >::fillData_(), and MzDataHandler< MapType >::startElement().

bool skip_spectrum_ [protected]

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

Referenced by MzDataHandler< MapType >::characters(), MzDataHandler< MapType >::cvParam_(), MzDataHandler< MapType >::endElement(), and MzDataHandler< MapType >::startElement().


OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:43:00 using doxygen 1.7.1