OpenMS
MzMLHandlerHelper Class Reference

Helper for mzML file format. More...

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

Classes

struct  BinaryData
 Representation for binary data in mzML. More...
 

Static Public Member Functions

static String getCompressionTerm_ (const PeakFileOptions &opt, MSNumpressCoder::NumpressConfig np_compression, const String &indent="", bool use_numpress=false)
 Returns the appropriate compression term given the PeakFileOptions and the NumpressConfig. More...
 
static void writeFooter_ (std::ostream &os, const PeakFileOptions &options, const std::vector< std::pair< std::string, Int64 > > &spectra_offsets, const std::vector< std::pair< std::string, Int64 > > &chromatograms_offsets)
 Write the indexed mzML footer the appropriate compression term given the PeakFileOptions and the NumpressConfig. More...
 
static void decodeBase64Arrays (std::vector< BinaryData > &data_, const bool skipXMLCheck=false)
 Decode Base64 arrays and write into data_ array. More...
 
static void computeDataProperties_ (const std::vector< BinaryData > &data_, bool &precision_64, SignedSize &index, const String &index_name)
 Identify a data array from a list. More...
 
static bool handleBinaryDataArrayCVParam (std::vector< BinaryData > &data_, const String &accession, const String &value, const String &name, const String &unit_accession)
 Handle a given CV parameter found in a binaryDataArray tag. More...
 

Static Private Member Functions

static void warning (int mode, const String &msg, UInt line=0, UInt column=0)
 Also display some warning message when appropriate (see XMLHandler) More...
 

Detailed Description

Helper for mzML file format.

This class provides common structures and re-useable helper functions for parsing the mzML format. These are mainly used by MzMLHandler and MzMLSpectrumDecoder.

Member Function Documentation

◆ computeDataProperties_()

static void computeDataProperties_ ( const std::vector< BinaryData > &  data_,
bool &  precision_64,
SignedSize index,
const String index_name 
)
static

Identify a data array from a list.

Given a specific array name, find it in the provided list and return its index and precision.

Parameters
data_The list of data arrays
precision_64Whether the identified array has 64 bit precision
indexThe index of the identified array
index_nameThe name of the array to be identified

◆ decodeBase64Arrays()

static void decodeBase64Arrays ( std::vector< BinaryData > &  data_,
const bool  skipXMLCheck = false 
)
static

Decode Base64 arrays and write into data_ array.

Parameters
data_The input and output
skipXMLCheckwhether to skip cleaning the Base64 arrays and remove whitespaces

◆ getCompressionTerm_()

static String getCompressionTerm_ ( const PeakFileOptions opt,
MSNumpressCoder::NumpressConfig  np_compression,
const String indent = "",
bool  use_numpress = false 
)
static

Returns the appropriate compression term given the PeakFileOptions and the NumpressConfig.

◆ handleBinaryDataArrayCVParam()

static bool handleBinaryDataArrayCVParam ( std::vector< BinaryData > &  data_,
const String accession,
const String value,
const String name,
const String unit_accession 
)
static

Handle a given CV parameter found in a binaryDataArray tag.

Given a CV parameter, properly set the members of the last entry of data_, this will properly handle all terms describing precision, compression, name of the data and units.

Parameters
data_The list of data arrays, whose last entry will be changed
accessionThe CV accession
valueThe CV value
nameThe CV name
unit_accessionThe CV unit accession (if a unit tag is present)

◆ warning()

static void warning ( int  mode,
const String msg,
UInt  line = 0,
UInt  column = 0 
)
staticprivate

Also display some warning message when appropriate (see XMLHandler)

◆ writeFooter_()

static void writeFooter_ ( std::ostream &  os,
const PeakFileOptions options,
const std::vector< std::pair< std::string, Int64 > > &  spectra_offsets,
const std::vector< std::pair< std::string, Int64 > > &  chromatograms_offsets 
)
static

Write the indexed mzML footer the appropriate compression term given the PeakFileOptions and the NumpressConfig.

Parameters
osThe output stream
optionsThe PeakFileOptions used for writing
spectra_offsetsBinary offsets of <spectrum> tags
chromatograms_offsetsBinary offsets of <chromatogram> tags