XML handler for MzDataFile. More...
#include <OpenMS/FORMAT/HANDLERS/MzDataHandler.h>
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< PeakType > | SpectrumType |
| 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 ProgressLogger & | logger_ |
| 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< String > | data_to_decode_ |
| encoded data which is read and has to be decoded | |
| std::vector< Real > | data_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< String > | precisions_ |
| std::vector< String > | endians_ |
Private Member Functions | |
| void | init_ () |
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.
typedef MapType::PeakType PeakType [protected] |
Peak type.
typedef MSSpectrum<PeakType> SpectrumType [protected] |
Spectrum type.
| 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.
| void characters | ( | const XMLCh *const | chars, | |
| const XMLSize_t | length | |||
| ) | [virtual] |
Parsing method for character data.
Reimplemented from XMLHandler.
References StringManager::convert(), MzDataHandler< MapType >::data_processing_, MzDataHandler< MapType >::data_to_decode_, MzDataHandler< MapType >::exp_, MSSpectrum< PeakT >::getFloatDataArrays(), DataProcessing::getSoftware(), XMLHandler::LOAD, XMLHandler::open_tags_, SpectrumSettings::setComment(), MetaInfoInterface::setMetaValue(), Software::setName(), Software::setVersion(), MzDataHandler< MapType >::skip_spectrum_, XMLHandler::sm_, MzDataHandler< MapType >::spec_, String::trim(), and XMLHandler::warning().
read attributes of MzData's cvParamType
Example: <cvParam cvLabel="psi" accession="PSI:1000001" name="@p name" value="@p value"/> name and sometimes value are defined in the MzData ontology.
References XMLHandler::asDouble_(), XMLHandler::asInt_(), DataProcessing::CHARGE_DECONVOLUTION, InstrumentSettings::CNG, InstrumentSettings::CNL, InstrumentSettings::CRM, XMLHandler::cvStringToEnum_(), MzDataHandler< MapType >::data_processing_, DataProcessing::DEISOTOPING, DRange< D >::encloses(), XMLHandler::error(), MzDataHandler< MapType >::exp_, SpectrumSettings::getInstrumentSettings(), MSSpectrum< PeakT >::getMSLevel(), SpectrumSettings::getPrecursors(), DataProcessing::getProcessingActions(), MSSpectrum< PeakT >::getRT(), PeakFileOptions::getRTRange(), PeakFileOptions::hasRTRange(), XMLHandler::LOAD, InstrumentSettings::MASSSPECTRUM, InstrumentSettings::MSNSPECTRUM, IonSource::NEGATIVE, XMLHandler::open_tags_, MzDataHandler< MapType >::options_, DataProcessing::PEAK_PICKING, IonSource::POSITIVE, InstrumentSettings::PRECURSOR, MSSpectrum< PeakT >::setMSLevel(), InstrumentSettings::setPolarity(), MSSpectrum< PeakT >::setRT(), InstrumentSettings::setScanMode(), InstrumentSettings::setZoomScan(), InstrumentSettings::SIM, MzDataHandler< MapType >::skip_spectrum_, MzDataHandler< MapType >::spec_, InstrumentSettings::SRM, and XMLHandler::warning().
Referenced by MzDataHandler< MapType >::startElement().
| void endElement | ( | const XMLCh * | uri, | |
| const XMLCh * | localname, | |||
| const XMLCh *const | qname | |||
| ) | [virtual] |
Parsing method for closing tags.
Reimplemented from XMLHandler.
References StringManager::clear(), MzDataHandler< MapType >::data_to_decode_, MzDataHandler< MapType >::decoded_double_list_, MzDataHandler< MapType >::decoded_list_, MzDataHandler< MapType >::endians_, ProgressLogger::endProgress(), XMLHandler::equal_(), MzDataHandler< MapType >::exp_, MzDataHandler< MapType >::fillData_(), MzDataHandler< MapType >::logger_, MzDataHandler< MapType >::meta_id_descs_, XMLHandler::open_tags_, MzDataHandler< MapType >::precisions_, ProgressLogger::setProgress(), MzDataHandler< MapType >::skip_spectrum_, XMLHandler::sm_, and MzDataHandler< MapType >::spec_.
| void fillData_ | ( | ) | [protected] |
fills the current spectrum with peaks and meta data
References Base64::BYTEORDER_BIGENDIAN, Base64::BYTEORDER_LITTLEENDIAN, MzDataHandler< MapType >::data_to_decode_, Base64::decode(), MzDataHandler< MapType >::decoded_double_list_, MzDataHandler< MapType >::decoded_list_, MzDataHandler< MapType >::decoder_, DRange< D >::encloses(), MzDataHandler< MapType >::endians_, MSSpectrum< PeakT >::getFloatDataArrays(), PeakFileOptions::getIntensityRange(), PeakFileOptions::getMZRange(), PeakFileOptions::hasIntensityRange(), PeakFileOptions::hasMZRange(), MzDataHandler< MapType >::options_, MzDataHandler< MapType >::peak_count_, MzDataHandler< MapType >::precisions_, and MzDataHandler< MapType >::spec_.
Referenced by MzDataHandler< MapType >::endElement().
| void init_ | ( | ) | [inline, private] |
References XMLHandler::cv_terms_.
Referenced by MzDataHandler< MapType >::MzDataHandler().
| 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().
const MapType* cexp_ [protected] |
map pointer for writing
Referenced by MzDataHandler< MapType >::writeTo().
DataProcessing data_processing_ [protected] |
std::vector<String> data_to_decode_ [protected] |
encoded data which is read and has to be decoded
Referenced by MzDataHandler< MapType >::characters(), MzDataHandler< MapType >::endElement(), MzDataHandler< MapType >::fillData_(), and MzDataHandler< MapType >::startElement().
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<DoubleReal> > decoded_double_list_ [protected] |
Referenced by MzDataHandler< MapType >::endElement(), and MzDataHandler< MapType >::fillData_().
std::vector<std::vector<Real> > decoded_list_ [protected] |
Referenced by MzDataHandler< MapType >::endElement(), and MzDataHandler< MapType >::fillData_().
Decoder/Encoder for Base64-data in MzData.
Referenced by MzDataHandler< MapType >::fillData_(), and MzDataHandler< MapType >::writeBinary_().
MapType* exp_ [protected] |
map pointer for reading
Referenced by MzDataHandler< MapType >::characters(), MzDataHandler< MapType >::cvParam_(), MzDataHandler< MapType >::endElement(), and MzDataHandler< MapType >::startElement().
const ProgressLogger& logger_ [protected] |
Progress logger.
Referenced by MzDataHandler< MapType >::endElement(), MzDataHandler< MapType >::startElement(), and MzDataHandler< MapType >::writeTo().
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().
PeakFileOptions options_ [protected] |
Options that can be set for loading/storing.
Referenced by MzDataHandler< MapType >::cvParam_(), MzDataHandler< MapType >::fillData_(), MzDataHandler< MapType >::setOptions(), MzDataHandler< MapType >::startElement(), and MzDataHandler< MapType >::writeTo().
UInt peak_count_ [protected] |
The number of peaks in the current spectrum.
Referenced by MzDataHandler< MapType >::fillData_(), and MzDataHandler< MapType >::startElement().
std::vector<String> precisions_ [protected] |
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().
SpectrumType spec_ [protected] |
The current spectrum.
Referenced by MzDataHandler< MapType >::characters(), MzDataHandler< MapType >::cvParam_(), MzDataHandler< MapType >::endElement(), MzDataHandler< MapType >::fillData_(), 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 |