OpenMS  2.8.0
Classes | List of all members
MzMLHandler Class Reference

Handler for mzML file format. More...

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

Inheritance diagram for MzMLHandler:
[legend]
Collaboration diagram for MzMLHandler:
[legend]

Classes

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

Public Member Functions

Constructors and destructor
 MzMLHandler (MapType &exp, const String &filename, const String &version, const ProgressLogger &logger)
 Constructor for a read-only handler. More...
 
 MzMLHandler (const MapType &exp, const String &filename, const String &version, const ProgressLogger &logger)
 Constructor for a write-only handler. More...
 
 ~MzMLHandler () override
 Destructor. More...
 
XML Handling and data parsing

void endElement (const XMLCh *const, const XMLCh *const, const XMLCh *const qname) override
 Docu in base class XMLHandler::endElement. More...
 
void startElement (const XMLCh *const, const XMLCh *const, const XMLCh *const qname, const xercesc::Attributes &attributes) override
 Docu in base class XMLHandler::startElelement. More...
 
void characters (const XMLCh *const chars, const XMLSize_t length) override
 Docu in base class XMLHandler::characters. More...
 
void writeTo (std::ostream &os) override
 Docu in base class XMLHandler::writeTo. More...
 
PeakFileOptions setters/getters

The PeakFileOptions object determine the reading and writing of the MzML file. In read-mode the lazy-loading options determine whether meta-data only or the full raw data is read into memory and how this data should be handled. The MS-level, m/z, RT and Intensity range options determine which part of the MzML file is read into memory.

void setOptions (const PeakFileOptions &opt)
 Set the peak file options. More...
 
PeakFileOptionsgetOptions ()
 Get the peak file options. More...
 
void getCounts (Size &spectra_counts, Size &chromatogram_counts)
 Get the spectra and chromatogram counts of a file. More...
 
- Public Member Functions inherited from XMLHandler
 XMLHandler (const String &filename, const String &version)
 Default constructor. More...
 
 ~XMLHandler () override
 Destructor. More...
 
void reset ()
 Release internal memory used for parsing (call. More...
 
void fatalError (const xercesc::SAXParseException &exception) override
 
void error (const xercesc::SAXParseException &exception) override
 
void warning (const xercesc::SAXParseException &exception) override
 
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...
 
void characters (const XMLCh *const chars, const XMLSize_t length) override
 Parsing method for character data. More...
 
void startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const xercesc::Attributes &attrs) override
 Parsing method for opening tags. More...
 
void endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname) override
 Parsing method for closing tags. More...
 
String errorString ()
 Returns the last error description. More...
 
void checkUniqueIdentifiers_ (const std::vector< ProteinIdentification > &prot_ids) const
 

Protected Member Functions

Helper functions for storing data in memory

void populateSpectraWithData_ ()
 Populate all spectra on the stack with data from input. More...
 
void populateChromatogramsWithData_ ()
 Populate all chromatograms on the stack with data from input. More...
 
void addSpectrumMetaData_ (const std::vector< MzMLHandlerHelper::BinaryData > &input_data, const Size n, SpectrumType &spectrum) const
 Add extra data arrays to a spectrum. More...
 
void populateSpectraWithData_ (std::vector< MzMLHandlerHelper::BinaryData > &input_data, Size &length, const PeakFileOptions &peak_file_options, SpectrumType &spectrum)
 Fill a single spectrum with data from input. More...
 
void populateChromatogramsWithData_ (std::vector< MzMLHandlerHelper::BinaryData > &input_data, Size &length, const PeakFileOptions &peak_file_options, ChromatogramType &chromatogram)
 Fill a single chromatogram with data from input. More...
 
void fillChromatogramData_ ()
 Fills the current chromatogram with data points and meta data. More...
 
void handleCVParam_ (const String &parent_parent_tag, const String &parent_tag, const String &accession, const String &name, const String &value, const String &unit_accession="")
 Handles CV terms. More...
 
void handleUserParam_ (const String &parent_parent_tag, const String &parent_tag, const String &name, const String &type, const String &value, const String &unit_accession="")
 Handles user terms. More...
 
- Protected Member Functions inherited from XMLHandler
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) const
 Conversion of a String to an integer value. More...
 
Int asInt_ (const XMLCh *in) const
 Conversion of a Xerces string to an integer value. More...
 
UInt asUInt_ (const String &in) const
 Conversion of a String to an unsigned integer value. More...
 
double asDouble_ (const String &in) const
 Conversion of a String to a double value. More...
 
float asFloat_ (const String &in) const
 Conversion of a String to a float value. More...
 
bool asBool_ (const String &in) const
 Conversion of a string to a boolean value. More...
 
DateTime asDateTime_ (String date_string) const
 Conversion of a xs:datetime string to a DateTime value. More...
 
bool equal_ (const XMLCh *a, const XMLCh *b) const
 Returns if two Xerces strings are equal. More...
 
SignedSize cvStringToEnum_ (const Size section, const String &term, const char *message, const SignedSize result_on_error=0)
 
String 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...
 
String 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...
 

Protected Attributes

temporary data structures to hold parsed data
SpectrumType spec_
 The current spectrum. More...
 
ChromatogramType chromatogram_
 The current chromatogram. More...
 
std::vector< BinaryDatabin_data_
 The spectrum data (or chromatogram data) More...
 
Size default_array_length_
 The default number of peaks in the current spectrum. More...
 
bool in_spectrum_list_ { false }
 Flag that indicates that we're inside a spectrum (in contrast to a chromatogram) More...
 
bool skip_spectrum_ { false }
 Flag that indicates whether this spectrum should be skipped (e.g. due to options) More...
 
bool skip_chromatogram_ { false }
 Flag that indicates whether this chromatogram should be skipped (e.g. due to options) More...
 
bool rt_set_ { false }
 Remember whether the RT of the spectrum was set or not. More...
 
String current_id_
 Id of the current list. Used for referencing param group, source file, sample, software, ... More...
 
Map< String, std::vector< SemanticValidator::CVTerm > > ref_param_
 The referencing param groups: id => array (accession, value) More...
 
Map< String, SourceFilesource_files_
 The source files: id => SourceFile. More...
 
Map< String, Samplesamples_
 The sample list: id => Sample. More...
 
Map< String, Softwaresoftware_
 The software list: id => Software. More...
 
Map< String, Instrumentinstruments_
 The data processing list: id => Instrument. More...
 
Map< std::pair< String, String >, bool > cached_terms_
 CV terms-path-combinations that have been checked in validateCV_() More...
 
Map< String, std::vector< DataProcessingPtr > > processing_
 The data processing list: id => Instrument. More...
 
String default_processing_
 id of the default data processing (used when no processing is defined) More...
 
UInt selected_ion_count_ { 0 }
 Count of selected ions. More...
 
std::vector< SpectrumDataspectrum_data_
 Vector of spectrum data stored for later parallel processing. More...
 
std::vector< ChromatogramDatachromatogram_data_
 Vector of chromatogram data stored for later parallel processing. More...
 
temporary data structures to hold written data

These data structures are used to store binary offsets required by the indexedMzML format, specifically the start of each <spectrum> and <chromatogram> tag is stored and will then be stored at the end of the file.

std::vector< std::pair< std::string, Int64 > > spectra_offsets_
 Stores binary offsets for each <spectrum> tag. More...
 
std::vector< std::pair< std::string, Int64 > > chromatograms_offsets_
 Stores binary offsets for each <chromatogram> tag. More...
 
const ProgressLoggerlogger_
 Progress logger. More...
 
Interfaces::IMSDataConsumerconsumer_ { nullptr }
 Consumer class to work on spectra. More...
 
temporary data structures for counting spectra and chromatograms
UInt scan_count_ { 0 }
 number of scans which pass the options-filter More...
 
UInt chromatogram_count_ { 0 }
 number of chromatograms which pass the options-filter More...
 
Int scan_count_total_ { -1 }
 total number of scans in mzML file (according to 'count' attribute) More...
 
Int chrom_count_total_ { -1 }
 total number of chromatograms in mzML file (according to 'count' attribute) More...
 
const ControlledVocabularycv_
 Controlled vocabulary (psi-ms from OpenMS/share/OpenMS/CV/psi-ms.obo) More...
 
CVMappings mapping_
 
- 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...
 
LOADDETAIL load_detail_
 parse only until total number of scans and chroms have been determined from attributes More...
 
std::vector< std::vector< String > > cv_terms_
 Array of CV term lists (one sublist denotes one term and it's children) More...
 

IMSDataConsumer setter

The IMSDataConsumer object allows the user to specify a callback object which can consume spectra and chromatograms on the fly. The consumer does not have to wait until data is read fully into memory, but will start receiving data as soon as it is available (read from disk).

typedef MapType::PeakType PeakType
 Peak type. More...
 
typedef MapType::ChromatogramPeakType ChromatogramPeakType
 Chromatogram peak type. More...
 
typedef MSSpectrum SpectrumType
 Spectrum type. More...
 
typedef MSChromatogram ChromatogramType
 Spectrum type. More...
 
typedef MzMLHandlerHelper::BinaryData BinaryData
 
void setMSDataConsumer (Interfaces::IMSDataConsumer *consumer)
 Set the IMSDataConsumer consumer which will consume the read data. More...
 
LOADDETAIL getLoadDetail () const override
 handler which support partial loading, implement this method More...
 
void setLoadDetail (const LOADDETAIL d) override
 handler which support partial loading, implement this method More...
 
 MzMLHandler (const String &filename, const String &version, const ProgressLogger &logger)
 delegated constructor for the two public versions More...
 

Helper functions for writing data

MapTypeexp_ { nullptr }
 map pointer for reading More...
 
const MapTypecexp_ { nullptr }
 map pointer for writing More...
 
PeakFileOptions options_
 Options that can be set for loading/storing. More...
 
void writeHeader_ (std::ostream &os, const MapType &exp, std::vector< std::vector< ConstDataProcessingPtr > > &dps, const Internal::MzMLValidator &validator)
 Write out XML header including (everything up to spectrumList / chromatogramList. More...
 
void writeSpectrum_ (std::ostream &os, const SpectrumType &spec, Size spec_idx, const Internal::MzMLValidator &validator, bool renew_native_ids, std::vector< std::vector< ConstDataProcessingPtr > > &dps)
 Write out a single spectrum. More...
 
void writeChromatogram_ (std::ostream &os, const ChromatogramType &chromatogram, Size chrom_idx, const Internal::MzMLValidator &validator)
 Write out a single chromatogram. More...
 
template<typename ContainerT >
void writeContainerData_ (std::ostream &os, const PeakFileOptions &pf_options_, const ContainerT &container, String array_type)
 
template<typename DataType >
void writeBinaryDataArray_ (std::ostream &os, const PeakFileOptions &options, std::vector< DataType > &data, bool is32bit, String array_type)
 Write a single <binaryDataArray> element to the output. More...
 
void writeBinaryFloatDataArray_ (std::ostream &os, const PeakFileOptions &options, const OpenMS::DataArrays::FloatDataArray &array, const Size spec_chrom_idx, const Size array_idx, bool is_spectrum, const Internal::MzMLValidator &validator)
 Write a single <binaryDataArray> element for a float data array to the output. More...
 
void writeUserParam_ (std::ostream &os, const MetaInfoInterface &meta, UInt indent, const String &path, const Internal::MzMLValidator &validator, const std::set< String > &exclude={}) const
 Writes user terms. More...
 
void writeSoftware_ (std::ostream &os, const String &id, const Software &software, const Internal::MzMLValidator &validator)
 Helper method that writes a software. More...
 
void writeSourceFile_ (std::ostream &os, const String &id, const SourceFile &software, const Internal::MzMLValidator &validator)
 Helper method that writes a source file. More...
 
void writeDataProcessing_ (std::ostream &os, const String &id, const std::vector< ConstDataProcessingPtr > &dps, const Internal::MzMLValidator &validator)
 Helper method that writes a data processing list. More...
 
void writePrecursor_ (std::ostream &os, const Precursor &precursor, const Internal::MzMLValidator &validator)
 Helper method that write precursor information from spectra and chromatograms. More...
 
void writeProduct_ (std::ostream &os, const Product &product, const Internal::MzMLValidator &validator)
 Helper method that write precursor information from spectra and chromatograms. More...
 
String writeCV_ (const ControlledVocabulary::CVTerm &c, const DataValue &metaValue) const
 Helper method to write an CV based on a meta value. More...
 
bool validateCV_ (const ControlledVocabulary::CVTerm &c, const String &path, const Internal::MzMLValidator &validator) const
 Helper method to validate if the given CV is allowed in the current location (path) More...
 
ControlledVocabulary::CVTerm getChildWithName_ (const String &parent_accession, const String &name) const
 Helper method to look up a child CV term of parent_accession with the name name. If no such term is found, an empty term is returned. More...
 

Additional Inherited Members

- Public Types inherited from XMLHandler
enum  ActionMode { LOAD , STORE }
 Action to set the current mode (for error messages) More...
 
enum  LOADDETAIL { LD_ALLDATA , LD_RAWCOUNTS , LD_COUNTS_WITHOPTIONS }
 
- 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

Handler for mzML file format.

This class handles parsing and writing of the mzML file format. It supports reading data directly into memory or parsing on-the-fly using a consumer (see Setting a consumer). In read-mode, this class will parse an MzML XML file and append the input spectra to the provided MSExperiment object or to the provided Interfaces::IMSDataConsumer (needs to be provided separately through setMSDataConsumer()).

Functions constituting the XML reading/writing interface can be found under XML Handling functions, helper functions specifically used for writing out to XML are organized under Writing functions and helper functions used for reading in XML from disk are organized under Readingfunctions".

See the MzMLHandlerHelper for additional helper functions that are independent of state.

Note
Do not use this class directly. It is only needed in MzMLFile.
Only upon destruction of this class it can be guaranteed that all data has been appended to the appropriate consumer of the data. Do not try to access the data before that.
Todo:
replace hardcoded cv stuff with more flexible handling via obo r/w.

Class Documentation

◆ OpenMS::Internal::MzMLHandler::ChromatogramData

struct OpenMS::Internal::MzMLHandler::ChromatogramData

Data necessary to generate a single chromatogram.

Small struct holds all data necessary to populate a chromatogram at a later timepoint (since reading of the base64 data and generation of chromatogram can be done at distinct timepoints).

Collaboration diagram for MzMLHandler::ChromatogramData:
[legend]
Class Members
ChromatogramType chromatogram
vector< BinaryData > data
Size default_array_length

◆ OpenMS::Internal::MzMLHandler::SpectrumData

struct OpenMS::Internal::MzMLHandler::SpectrumData

Data necessary to generate a single spectrum.

Small struct holds all data necessary to populate a spectrum at a later timepoint (since reading of the base64 data and generation of spectra can be done at distinct timepoints).

Collaboration diagram for MzMLHandler::SpectrumData:
[legend]
Class Members
vector< BinaryData > data
Size default_array_length
SpectrumType spectrum

Member Typedef Documentation

◆ BinaryData

◆ ChromatogramPeakType

Chromatogram peak type.

◆ ChromatogramType

typedef MSChromatogram ChromatogramType
protected

Spectrum type.

◆ PeakType

typedef MapType::PeakType PeakType
protected

Peak type.

◆ SpectrumType

typedef MSSpectrum SpectrumType
protected

Spectrum type.

Constructor & Destructor Documentation

◆ MzMLHandler() [1/3]

MzMLHandler ( MapType exp,
const String filename,
const String version,
const ProgressLogger logger 
)

Constructor for a read-only handler.

◆ MzMLHandler() [2/3]

MzMLHandler ( const MapType exp,
const String filename,
const String version,
const ProgressLogger logger 
)

Constructor for a write-only handler.

◆ ~MzMLHandler()

~MzMLHandler ( )
override

Destructor.

◆ MzMLHandler() [3/3]

MzMLHandler ( const String filename,
const String version,
const ProgressLogger logger 
)
protected

delegated constructor for the two public versions

Member Function Documentation

◆ addSpectrumMetaData_()

void addSpectrumMetaData_ ( const std::vector< MzMLHandlerHelper::BinaryData > &  input_data,
const Size  n,
SpectrumType spectrum 
) const
protected

Add extra data arrays to a spectrum.

Add the float, integer and string data arrays to a spectrum.

◆ characters()

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

Docu in base class XMLHandler::characters.

◆ endElement()

void endElement ( const XMLCh * const  ,
const XMLCh * const  ,
const XMLCh *const  qname 
)
override

Docu in base class XMLHandler::endElement.

◆ fillChromatogramData_()

void fillChromatogramData_ ( )
protected

Fills the current chromatogram with data points and meta data.

◆ getChildWithName_()

ControlledVocabulary::CVTerm getChildWithName_ ( const String parent_accession,
const String name 
) const
protected

Helper method to look up a child CV term of parent_accession with the name name. If no such term is found, an empty term is returned.

◆ getCounts()

void getCounts ( Size spectra_counts,
Size chromatogram_counts 
)

Get the spectra and chromatogram counts of a file.

◆ getLoadDetail()

LOADDETAIL getLoadDetail ( ) const
overridevirtual

handler which support partial loading, implement this method

Reimplemented from XMLHandler.

◆ getOptions()

PeakFileOptions& getOptions ( )

◆ handleCVParam_()

void handleCVParam_ ( const String parent_parent_tag,
const String parent_tag,
const String accession,
const String name,
const String value,
const String unit_accession = "" 
)
protected

Handles CV terms.

◆ handleUserParam_()

void handleUserParam_ ( const String parent_parent_tag,
const String parent_tag,
const String name,
const String type,
const String value,
const String unit_accession = "" 
)
protected

Handles user terms.

◆ populateChromatogramsWithData_() [1/2]

void populateChromatogramsWithData_ ( )
protected

Populate all chromatograms on the stack with data from input.

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

◆ populateChromatogramsWithData_() [2/2]

void populateChromatogramsWithData_ ( std::vector< MzMLHandlerHelper::BinaryData > &  input_data,
Size length,
const PeakFileOptions peak_file_options,
ChromatogramType chromatogram 
)
protected

Fill a single chromatogram with data from input.

Note
Do not modify any internal state variables of the class since this function will be executed in parallel.
Parameters
input_dataThe input data with which to fill the spectra
lengthThe input data length (number of data points)
peak_file_optionsWill be used if only part of the data should be copied (RT, mz or intensity range)
chromatogramThe output chromatogram

◆ populateSpectraWithData_() [1/2]

void populateSpectraWithData_ ( )
protected

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.

◆ populateSpectraWithData_() [2/2]

void populateSpectraWithData_ ( std::vector< MzMLHandlerHelper::BinaryData > &  input_data,
Size length,
const PeakFileOptions peak_file_options,
SpectrumType spectrum 
)
protected

Fill a single spectrum with data from input.

Note
Do not modify any internal state variables of the class since this function will be executed in parallel.
This function takes about 50 % of total load time with a single thread and parallelizes linearly up to at least 10 threads.
Parameters
input_dataThe input data with which to fill the spectra
lengthThe input data length (number of data points)
peak_file_optionsWill be used if only part of the data should be copied (RT, mz or intensity range)
spectrumThe output spectrum

◆ setLoadDetail()

void setLoadDetail ( const LOADDETAIL  d)
overridevirtual

handler which support partial loading, implement this method

Reimplemented from XMLHandler.

◆ setMSDataConsumer()

void setMSDataConsumer ( Interfaces::IMSDataConsumer consumer)

Set the IMSDataConsumer consumer which will consume the read data.

◆ setOptions()

void setOptions ( const PeakFileOptions opt)

Set the peak file options.

◆ startElement()

void startElement ( const XMLCh * const  ,
const XMLCh * const  ,
const XMLCh *const  qname,
const xercesc::Attributes &  attributes 
)
override

Docu in base class XMLHandler::startElelement.

◆ validateCV_()

bool validateCV_ ( const ControlledVocabulary::CVTerm c,
const String path,
const Internal::MzMLValidator validator 
) const
protected

Helper method to validate if the given CV is allowed in the current location (path)

◆ writeBinaryDataArray_()

void writeBinaryDataArray_ ( std::ostream &  os,
const PeakFileOptions options,
std::vector< DataType > &  data,
bool  is32bit,
String  array_type 
)
protected

Write a single <binaryDataArray> element to the output.

Parameters
osThe stream into which to write
optionsThe PeakFileOptions which determines the compression type to use
dataThe data to write (32bit float or 64 bit double)
is32bitWhether data is 32bit
array_typeWhich type of data array is written (mz, time, intensity or float_data)
Note
The data argument may be modified by the function (see Base64 for reasons why)

◆ writeBinaryFloatDataArray_()

void writeBinaryFloatDataArray_ ( std::ostream &  os,
const PeakFileOptions options,
const OpenMS::DataArrays::FloatDataArray array,
const Size  spec_chrom_idx,
const Size  array_idx,
bool  is_spectrum,
const Internal::MzMLValidator validator 
)
protected

Write a single <binaryDataArray> element for a float data array to the output.

This is only for non-standard data arrays which are treated slightly differently by the standard.

Parameters
osThe stream into which to write
optionsThe PeakFileOptions which determines the compression type to use
arrayThe data to write
spec_chrom_idxThe index of the current spectrum or chromatogram
array_idxThe index of the current float data array
is_spectrumWhether data is associated with a spectrum (if false, a chromatogram is assumed)
validatorValidator object

◆ writeChromatogram_()

void writeChromatogram_ ( std::ostream &  os,
const ChromatogramType chromatogram,
Size  chrom_idx,
const Internal::MzMLValidator validator 
)
protected

Write out a single chromatogram.

◆ writeContainerData_()

void writeContainerData_ ( std::ostream &  os,
const PeakFileOptions pf_options_,
const ContainerT &  container,
String  array_type 
)
protected

◆ writeCV_()

String writeCV_ ( const ControlledVocabulary::CVTerm c,
const DataValue metaValue 
) const
protected

Helper method to write an CV based on a meta value.

◆ writeDataProcessing_()

void writeDataProcessing_ ( std::ostream &  os,
const String id,
const std::vector< ConstDataProcessingPtr > &  dps,
const Internal::MzMLValidator validator 
)
protected

Helper method that writes a data processing list.

◆ writeHeader_()

void writeHeader_ ( std::ostream &  os,
const MapType exp,
std::vector< std::vector< ConstDataProcessingPtr > > &  dps,
const Internal::MzMLValidator validator 
)
protected

Write out XML header including (everything up to spectrumList / chromatogramList.

◆ writePrecursor_()

void writePrecursor_ ( std::ostream &  os,
const Precursor precursor,
const Internal::MzMLValidator validator 
)
protected

Helper method that write precursor information from spectra and chromatograms.

◆ writeProduct_()

void writeProduct_ ( std::ostream &  os,
const Product product,
const Internal::MzMLValidator validator 
)
protected

Helper method that write precursor information from spectra and chromatograms.

◆ writeSoftware_()

void writeSoftware_ ( std::ostream &  os,
const String id,
const Software software,
const Internal::MzMLValidator validator 
)
protected

Helper method that writes a software.

◆ writeSourceFile_()

void writeSourceFile_ ( std::ostream &  os,
const String id,
const SourceFile software,
const Internal::MzMLValidator validator 
)
protected

Helper method that writes a source file.

◆ writeSpectrum_()

void writeSpectrum_ ( std::ostream &  os,
const SpectrumType spec,
Size  spec_idx,
const Internal::MzMLValidator validator,
bool  renew_native_ids,
std::vector< std::vector< ConstDataProcessingPtr > > &  dps 
)
protected

Write out a single spectrum.

◆ writeTo()

void writeTo ( std::ostream &  os)
overridevirtual

Docu in base class XMLHandler::writeTo.

Reimplemented from XMLHandler.

◆ writeUserParam_()

void writeUserParam_ ( std::ostream &  os,
const MetaInfoInterface meta,
UInt  indent,
const String path,
const Internal::MzMLValidator validator,
const std::set< String > &  exclude = {} 
) const
protected

Writes user terms.

Member Data Documentation

◆ bin_data_

std::vector<BinaryData> bin_data_
protected

The spectrum data (or chromatogram data)

◆ cached_terms_

Map<std::pair<String, String>, bool> cached_terms_
mutableprotected

CV terms-path-combinations that have been checked in validateCV_()

◆ cexp_

const MapType* cexp_ { nullptr }
protected

map pointer for writing

◆ chrom_count_total_

Int chrom_count_total_ { -1 }
protected

total number of chromatograms in mzML file (according to 'count' attribute)

◆ chromatogram_

ChromatogramType chromatogram_
protected

The current chromatogram.

◆ chromatogram_count_

UInt chromatogram_count_ { 0 }
protected

number of chromatograms which pass the options-filter

◆ chromatogram_data_

std::vector<ChromatogramData> chromatogram_data_
protected

Vector of chromatogram data stored for later parallel processing.

◆ chromatograms_offsets_

std::vector<std::pair<std::string, Int64> > chromatograms_offsets_
protected

Stores binary offsets for each <chromatogram> tag.

◆ consumer_

Interfaces::IMSDataConsumer* consumer_ { nullptr }
protected

Consumer class to work on spectra.

◆ current_id_

String current_id_
protected

Id of the current list. Used for referencing param group, source file, sample, software, ...

◆ cv_

const ControlledVocabulary& cv_
protected

Controlled vocabulary (psi-ms from OpenMS/share/OpenMS/CV/psi-ms.obo)

◆ default_array_length_

Size default_array_length_
protected

The default number of peaks in the current spectrum.

◆ default_processing_

String default_processing_
protected

id of the default data processing (used when no processing is defined)

◆ exp_

MapType* exp_ { nullptr }
protected

map pointer for reading

◆ in_spectrum_list_

bool in_spectrum_list_ { false }
protected

Flag that indicates that we're inside a spectrum (in contrast to a chromatogram)

◆ instruments_

Map<String, Instrument> instruments_
protected

The data processing list: id => Instrument.

◆ logger_

const ProgressLogger& logger_
protected

Progress logger.

◆ mapping_

CVMappings mapping_
protected

◆ options_

PeakFileOptions options_
protected

Options that can be set for loading/storing.

◆ processing_

Map<String, std::vector< DataProcessingPtr > > processing_
protected

The data processing list: id => Instrument.

◆ ref_param_

Map<String, std::vector<SemanticValidator::CVTerm> > ref_param_
protected

The referencing param groups: id => array (accession, value)

◆ rt_set_

bool rt_set_ { false }
protected

Remember whether the RT of the spectrum was set or not.

◆ samples_

Map<String, Sample> samples_
protected

The sample list: id => Sample.

◆ scan_count_

UInt scan_count_ { 0 }
protected

number of scans which pass the options-filter

◆ scan_count_total_

Int scan_count_total_ { -1 }
protected

total number of scans in mzML file (according to 'count' attribute)

◆ selected_ion_count_

UInt selected_ion_count_ { 0 }
protected

Count of selected ions.

◆ skip_chromatogram_

bool skip_chromatogram_ { false }
protected

Flag that indicates whether this chromatogram should be skipped (e.g. due to options)

◆ skip_spectrum_

bool skip_spectrum_ { false }
protected

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

◆ software_

Map<String, Software> software_
protected

The software list: id => Software.

◆ source_files_

Map<String, SourceFile> source_files_
protected

The source files: id => SourceFile.

◆ spec_

SpectrumType spec_
protected

The current spectrum.

◆ spectra_offsets_

std::vector<std::pair<std::string, Int64> > spectra_offsets_
protected

Stores binary offsets for each <spectrum> tag.

◆ spectrum_data_

std::vector<SpectrumData> spectrum_data_
protected

Vector of spectrum data stored for later parallel processing.