OpenMS  2.8.0
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
MzMLSpectrumDecoder Class Reference

A class to decode input strings that contain an mzML chromatogram or spectrum tag. More...

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

Collaboration diagram for MzMLSpectrumDecoder:
[legend]

Public Member Functions

 MzMLSpectrumDecoder (bool skip_xml_checks=false)
 
void domParseSpectrum (const std::string &in, OpenMS::Interfaces::SpectrumPtr &sptr)
 Extract data from a string which contains a full mzML spectrum. More...
 
void domParseSpectrum (const std::string &in, MSSpectrum &s)
 Extract data from a string which contains a full mzML spectrum. More...
 
void domParseChromatogram (const std::string &in, MSChromatogram &c)
 Extract data from a string which contains a full mzML chromatogram. More...
 
void domParseChromatogram (const std::string &in, OpenMS::Interfaces::ChromatogramPtr &cptr)
 Extract data from a string which contains a full mzML chromatogram. More...
 
void setSkipXMLChecks (bool only)
 Whether to skip some XML checks (e.g. removing whitespace inside base64 arrays) and be fast instead. More...
 

Protected Types

typedef Internal::MzMLHandlerHelper::BinaryData BinaryData
 

Protected Member Functions

OpenMS::Interfaces::SpectrumPtr decodeBinaryDataSpectrum_ (std::vector< BinaryData > &data) const
 decode binary data More...
 
void decodeBinaryDataMSSpectrum_ (std::vector< BinaryData > &data, OpenMS::MSSpectrum &s) const
 
void decodeBinaryDataMSChrom_ (std::vector< BinaryData > &data, OpenMS::MSChromatogram &c) const
 
OpenMS::Interfaces::ChromatogramPtr decodeBinaryDataChrom_ (std::vector< BinaryData > &data) const
 decode binary data More...
 
void handleBinaryDataArray_ (xercesc::DOMNode *indexListNode, std::vector< BinaryData > &data)
 Convert a single DOMNode of type binaryDataArray to BinaryData object. More...
 
std::string domParseString_ (const std::string &in, std::vector< BinaryData > &data)
 Extract data from a string containing multiple <binaryDataArray> tags. More...
 

Protected Attributes

bool skip_xml_checks_
 Whether to skip some XML checks (e.g. removing whitespace inside base64 arrays) and be fast instead. More...
 

Detailed Description

A class to decode input strings that contain an mzML chromatogram or spectrum tag.

It uses xercesc to parse a string containing either a exactly one mzML spectrum or chromatogram (from <chromatogram> to </chromatogram> or <spectrum> to </spectrum> tag). It returns the data contained in the binaryDataArray for Intensity / mass-to-charge or Intensity / time.

Member Typedef Documentation

◆ BinaryData

Constructor & Destructor Documentation

◆ MzMLSpectrumDecoder()

MzMLSpectrumDecoder ( bool  skip_xml_checks = false)
inlineexplicit

Member Function Documentation

◆ decodeBinaryDataChrom_()

OpenMS::Interfaces::ChromatogramPtr decodeBinaryDataChrom_ ( std::vector< BinaryData > &  data) const
protected

decode binary data

Todo:
Duplicated code from MzMLHandler, need to clean up see MzMLHandler::fillData_()

◆ decodeBinaryDataMSChrom_()

void decodeBinaryDataMSChrom_ ( std::vector< BinaryData > &  data,
OpenMS::MSChromatogram c 
) const
protected

◆ decodeBinaryDataMSSpectrum_()

void decodeBinaryDataMSSpectrum_ ( std::vector< BinaryData > &  data,
OpenMS::MSSpectrum s 
) const
protected

◆ decodeBinaryDataSpectrum_()

OpenMS::Interfaces::SpectrumPtr decodeBinaryDataSpectrum_ ( std::vector< BinaryData > &  data) const
protected

decode binary data

Todo:
Duplicated code from MzMLHandler, need to clean up see MzMLHandler::fillData_()

◆ domParseChromatogram() [1/2]

void domParseChromatogram ( const std::string &  in,
MSChromatogram c 
)

Extract data from a string which contains a full mzML chromatogram.

Extracts data from the input string which is expected to contain exactly one <chromatogram> tag (from <chromatogram> to </chromatogram>). This function will extract the contained binaryDataArray and provide the result as Chromatogram.

Parameters
inInput string containing the raw XML
cResulting chromatogram
Precondition
in must have <chromatogram> as root element.

◆ domParseChromatogram() [2/2]

void domParseChromatogram ( const std::string &  in,
OpenMS::Interfaces::ChromatogramPtr cptr 
)

Extract data from a string which contains a full mzML chromatogram.

Extracts data from the input string which is expected to contain exactly one <chromatogram> tag (from <chromatogram> to </chromatogram>). This function will extract the contained binaryDataArray and provide the result as Chromatogram.

Parameters
inInput string containing the raw XML
cptrResulting chromatogram
Precondition
in must have <chromatogram> as root element.

◆ domParseSpectrum() [1/2]

void domParseSpectrum ( const std::string &  in,
MSSpectrum s 
)

Extract data from a string which contains a full mzML spectrum.

Extracts data from the input string which is expected to contain exactly one <spectrum> tag (from <spectrum> to </spectrum>). This function will extract the contained binaryDataArray and provide the result as Spectrum.

Parameters
inInput string containing the raw XML
sResulting spectrum
Precondition
in must have <spectrum> as root element.

◆ domParseSpectrum() [2/2]

void domParseSpectrum ( const std::string &  in,
OpenMS::Interfaces::SpectrumPtr sptr 
)

Extract data from a string which contains a full mzML spectrum.

Extracts data from the input string which is expected to contain exactly one <spectrum> tag (from <spectrum> to </spectrum>). This function will extract the contained binaryDataArray and provide the result as Spectrum.

Parameters
inInput string containing the raw XML
sptrResulting spectrum
Precondition
in must have <spectrum> as root element.

◆ domParseString_()

std::string domParseString_ ( const std::string &  in,
std::vector< BinaryData > &  data 
)
protected

Extract data from a string containing multiple <binaryDataArray> tags.

This may be a string from <spectrum> to </spectrum> or <chromatogram> to </chromatogram> tag which contains one or more <binaryDataArray>. These XML tags need to conform to the mzML standard. The function will return a vector with all binary data found in the string in the binaryDataArray tags.

Parameters
inInput string containing the raw XML
dataBinary data extracted from the string
Precondition
in must have <spectrum> or <chromatogram> as root element.

◆ handleBinaryDataArray_()

void handleBinaryDataArray_ ( xercesc::DOMNode *  indexListNode,
std::vector< BinaryData > &  data 
)
protected

Convert a single DOMNode of type binaryDataArray to BinaryData object.

This function will extract the data from a xerces DOMNode which points to a binaryDataArray tag and store the result as a BinaryData object. The result will be appended to the data vector.

Parameters
inDOMNode of type binaryDataArray
dataBinary data extracted from the string

◆ setSkipXMLChecks()

void setSkipXMLChecks ( bool  only)

Whether to skip some XML checks (e.g. removing whitespace inside base64 arrays) and be fast instead.

Member Data Documentation

◆ skip_xml_checks_

bool skip_xml_checks_
protected

Whether to skip some XML checks (e.g. removing whitespace inside base64 arrays) and be fast instead.