OpenMS
MzMLSpectrumDecoder.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Hannes Roest $
6 // $Authors: Hannes Roest $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 #include <OpenMS/config.h>
12 #include <OpenMS/CONCEPT/Types.h>
15 #include <OpenMS/FORMAT/Base64.h>
18 
19 #include <string>
20 #include <xercesc/dom/DOMNode.hpp>
21 
25 
26 namespace OpenMS
27 {
28 
39  class OPENMS_DLLAPI MzMLSpectrumDecoder
40  {
41  protected:
42 
44 
46 
53  OpenMS::Interfaces::SpectrumPtr decodeBinaryDataSpectrum_(std::vector<BinaryData> & data) const;
54 
55  void decodeBinaryDataMSSpectrum_(std::vector<BinaryData>& data, OpenMS::MSSpectrum& s) const;
56 
57  void decodeBinaryDataMSChrom_(std::vector<BinaryData>& data, OpenMS::MSChromatogram& c) const;
58 
65  OpenMS::Interfaces::ChromatogramPtr decodeBinaryDataChrom_(std::vector<BinaryData> & data) const;
66 
77  void handleBinaryDataArray_(xercesc::DOMNode * indexListNode, std::vector<BinaryData>& data);
78 
94  std::string domParseString_(const std::string& in, std::vector<BinaryData>& data);
95 
96  public:
97 
98  explicit MzMLSpectrumDecoder(bool skip_xml_checks = false) :
99  skip_xml_checks_(skip_xml_checks)
100  {}
101 
115  void domParseSpectrum(const std::string& in, OpenMS::Interfaces::SpectrumPtr & sptr);
116 
130  void domParseSpectrum(const std::string& in, MSSpectrum& s);
131 
145  void domParseChromatogram(const std::string& in, MSChromatogram& c);
146 
160  void domParseChromatogram(const std::string& in, OpenMS::Interfaces::ChromatogramPtr & cptr);
161 
163  void setSkipXMLChecks(bool only);
164  };
165 }
166 
167 
The representation of a chromatogram.
Definition: MSChromatogram.h:31
The representation of a 1D spectrum.
Definition: MSSpectrum.h:44
A class to decode input strings that contain an mzML chromatogram or spectrum tag.
Definition: MzMLSpectrumDecoder.h:40
OpenMS::Interfaces::ChromatogramPtr decodeBinaryDataChrom_(std::vector< BinaryData > &data) const
decode binary data
void domParseChromatogram(const std::string &in, MSChromatogram &c)
Extract data from a string which contains a full mzML chromatogram.
MzMLSpectrumDecoder(bool skip_xml_checks=false)
Definition: MzMLSpectrumDecoder.h:98
std::string domParseString_(const std::string &in, std::vector< BinaryData > &data)
Extract data from a string containing multiple <binaryDataArray> tags.
Internal::MzMLHandlerHelper::BinaryData BinaryData
Definition: MzMLSpectrumDecoder.h:45
void domParseSpectrum(const std::string &in, OpenMS::Interfaces::SpectrumPtr &sptr)
Extract data from a string which contains a full mzML spectrum.
OpenMS::Interfaces::SpectrumPtr decodeBinaryDataSpectrum_(std::vector< BinaryData > &data) const
decode binary data
void decodeBinaryDataMSChrom_(std::vector< BinaryData > &data, OpenMS::MSChromatogram &c) const
void handleBinaryDataArray_(xercesc::DOMNode *indexListNode, std::vector< BinaryData > &data)
Convert a single DOMNode of type binaryDataArray to BinaryData object.
void setSkipXMLChecks(bool only)
Whether to skip some XML checks (e.g. removing whitespace inside base64 arrays) and be fast instead.
void decodeBinaryDataMSSpectrum_(std::vector< BinaryData > &data, OpenMS::MSSpectrum &s) const
void domParseSpectrum(const std::string &in, MSSpectrum &s)
Extract data from a string which contains a full mzML spectrum.
bool skip_xml_checks_
Whether to skip some XML checks (e.g. removing whitespace inside base64 arrays) and be fast instead.
Definition: MzMLSpectrumDecoder.h:43
void domParseChromatogram(const std::string &in, OpenMS::Interfaces::ChromatogramPtr &cptr)
Extract data from a string which contains a full mzML chromatogram.
const double c
Definition: Constants.h:188
boost::shared_ptr< Chromatogram > ChromatogramPtr
Definition: openms/include/OpenMS/INTERFACES/DataStructures.h:130
boost::shared_ptr< Spectrum > SpectrumPtr
Definition: openms/include/OpenMS/INTERFACES/DataStructures.h:210
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Representation for binary data in mzML.
Definition: MzMLHandlerHelper.h:44