OpenMS
MSDataWritingConsumer Class Referenceabstract

Consumer class that writes MS data to disk using the mzML format. More...

#include <OpenMS/FORMAT/DATAACCESS/MSDataWritingConsumer.h>

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

Public Types

typedef PeakMap MapType
 
typedef MapType::SpectrumType SpectrumType
 
typedef MapType::ChromatogramType ChromatogramType
 
- 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 }
 
- Public Types inherited from IMSDataConsumer
typedef MSSpectrum SpectrumType
 
typedef MSChromatogram ChromatogramType
 

Public Member Functions

 MSDataWritingConsumer (const String &filename)
 Constructor. More...
 
 ~MSDataWritingConsumer () override
 Destructor. More...
 
IMSDataConsumer interface
void setExperimentalSettings (const ExperimentalSettings &exp) override
 Set experimental settings for the whole file. More...
 
void setExpectedSize (Size expectedSpectra, Size expectedChromatograms) override
 Set expected size of spectra and chromatograms to be written. More...
 
void consumeSpectrum (SpectrumType &s) override
 Consume a spectrum. More...
 
void consumeChromatogram (ChromatogramType &c) override
 Consume a chromatogram. More...
 
virtual void addDataProcessing (DataProcessing d)
 Optionally add a data processing method to each chromatogram and spectrum. More...
 
virtual Size getNrSpectraWritten ()
 Return the number of spectra written. More...
 
virtual Size getNrChromatogramsWritten ()
 Return the number of chromatograms written. More...
 
- Public Member Functions inherited from MzMLHandler
 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...
 
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...
 
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...
 
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...
 
- 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...
 
DataValue cvParamToValue (const ControlledVocabulary &cv, const String &parent_tag, const String &accession, const String &name, const String &value, const String &unit_accession) const
 Convert the value of a <cvParam value=.> (as commonly found in PSI schemata) to the DataValue with the correct type (e.g. int) according to the type stored in the CV (usually PSI-MS CV), as well as set its unit. More...
 
DataValue cvParamToValue (const ControlledVocabulary &cv, const CVTerm &raw_term) const
 Convert the value of a <cvParam value=.> (as commonly found in PSI schemata) to the DataValue with the correct type (e.g. int) according to the type stored in the CV (usually PSI-MS CV), as well as set its unit. More...
 
void checkUniqueIdentifiers_ (const std::vector< ProteinIdentification > &prot_ids) const
 
- Public Member Functions inherited from IMSDataConsumer
virtual ~IMSDataConsumer ()
 

Data Processing using the template method pattern

std::ofstream ofs_
 File stream (to write mzML) More...
 
bool started_writing_
 Stores whether we have already started writing any data. More...
 
bool writing_spectra_
 Stores whether we are currently writing spectra. More...
 
bool writing_chromatograms_
 Stores whether we are currently writing chromatograms. More...
 
Size spectra_written_
 Number of spectra written. More...
 
Size chromatograms_written_
 Number of chromatograms written. More...
 
Size spectra_expected_
 Number of spectra expected. More...
 
Size chromatograms_expected_
 Number of chromatograms expected. More...
 
bool add_dataprocessing_
 Whether to add dataprocessing term to the data before writing. More...
 
Internal::MzMLValidatorvalidator_
 Validator that knows about CV terms. More...
 
ExperimentalSettings settings_
 Experimental settings to use for the whole file. More...
 
std::vector< std::vector< ConstDataProcessingPtr > > dps_
 Vector of data processing objects -> will be filled by writeHeader_. More...
 
DataProcessingPtr additional_dataprocessing_
 The dataprocessing to be added to each spectrum/chromatogram. More...
 
virtual void processSpectrum_ (SpectrumType &s)=0
 Process a spectrum before storing to disk. More...
 
virtual void processChromatogram_ (ChromatogramType &c)=0
 Process a chromatogram before storing to disk. More...
 
virtual void doCleanup_ ()
 Cleanup function called by the destructor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from XMLHandler
static String writeXMLEscape (const String &to_escape)
 Escapes a string and returns the escaped string. More...
 
static DataValue fromXSDString (const String &type, const String &value)
 Convert an XSD type (e.g. 'xsd:double') to a DataValue. More...
 
- Protected Types inherited from MzMLHandler
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
 
- Protected Member Functions inherited from MzMLHandler
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...
 
 MzMLHandler (const String &filename, const String &version, const ProgressLogger &logger)
 delegated constructor for the two public versions 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, const 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...
 
- 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 inherited from MzMLHandler
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...
 
std::map< String, std::vector< SemanticValidator::CVTerm > > ref_param_
 The referencing param groups: id => array (accession, value) More...
 
std::map< String, SourceFilesource_files_
 The source files: id => SourceFile. More...
 
std::map< String, Samplesamples_
 The sample list: id => Sample. More...
 
std::map< String, Softwaresoftware_
 The software list: id => Software. More...
 
std::map< String, Instrumentinstruments_
 The data processing list: id => Instrument. More...
 
std::map< std::pair< String, String >, bool > cached_terms_
 CV terms-path-combinations that have been checked in validateCV_() More...
 
std::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...
 
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...
 
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_
 
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...
 
- Protected Attributes inherited from XMLHandler
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...
 

Detailed Description

Consumer class that writes MS data to disk using the mzML format.

The MSDataWritingConsumer is able to write spectra and chromatograms to disk on the fly (as soon as they are consumed). This class is abstract and allows the derived class to define how spectra and chromatograms are processed before being written to disk.

If you are looking for class that simply takes spectra and chromatograms and writes them to disk, please use the PlainMSDataWritingConsumer.

Example usage:

MSDataWritingConsumer * consumer = new MSDataWritingConsumer(outfile); // some implementation
consumer->setExpectedSize(specsize, chromsize);
consumer->setExperimentalSettings(exp_settings);
consumer->addDataProcessing(dp); // optional, will be added to all spectra and chromatograms
[...]
// multiple times ...
consumer->consumeSpectrum(spec);
consumer->consumeChromatogram(chrom);
[...]
delete consumer;
MSDataWritingConsumer(const String &filename)
Constructor.
Note
The first usage of consumeChromatogram or consumeSpectrum will start writing of the mzML header to disk (and the first element).
Currently it is not possible to add spectra after having already added chromatograms since this could lead to a situation with multiple spectrumList tags appear in an mzML file.
The expected size will not be enforced but it will lead to an inconsistent mzML if the count attribute of spectrumList or chromatogramList is incorrect.

Member Typedef Documentation

◆ ChromatogramType

◆ MapType

typedef PeakMap MapType

◆ SpectrumType

Constructor & Destructor Documentation

◆ MSDataWritingConsumer()

MSDataWritingConsumer ( const String filename)
explicit

Constructor.

Parameters
filenameFilename for the output mzML

◆ ~MSDataWritingConsumer()

~MSDataWritingConsumer ( )
override

Destructor.

Member Function Documentation

◆ addDataProcessing()

virtual void addDataProcessing ( DataProcessing  d)
virtual

Optionally add a data processing method to each chromatogram and spectrum.

The provided DataProcessing object will be added to each chromatogram and spectrum written to to the mzML file.

Parameters
dThe DataProcessing object to be added

Referenced by TOPPOpenSwathBase::prepareChromOutput().

◆ consumeChromatogram()

void consumeChromatogram ( ChromatogramType c)
overridevirtual

Consume a chromatogram.

The chromatogram will be processed using the processChromatogram_ method of the current implementation and then written to the mzML file.

Parameters
cThe chromatogram to be written to mzML

Implements IMSDataConsumer.

Reimplemented in NoopMSDataWritingConsumer.

◆ consumeSpectrum()

void consumeSpectrum ( SpectrumType s)
overridevirtual

Consume a spectrum.

The spectrum will be processed using the processSpectrum_ method of the current implementation and then written to the mzML file.

Parameters
sThe spectrum to be written to mzML

Implements IMSDataConsumer.

Reimplemented in NoopMSDataWritingConsumer.

◆ doCleanup_()

virtual void doCleanup_ ( )
privatevirtual

Cleanup function called by the destructor.

Will write the last tags to the file and close the file stream.

Reimplemented in NoopMSDataWritingConsumer.

◆ getNrChromatogramsWritten()

virtual Size getNrChromatogramsWritten ( )
virtual

Return the number of chromatograms written.

◆ getNrSpectraWritten()

virtual Size getNrSpectraWritten ( )
virtual

Return the number of spectra written.

◆ processChromatogram_()

virtual void processChromatogram_ ( ChromatogramType c)
privatepure virtual

Process a chromatogram before storing to disk.

Redefine this function to determine chromatogram processing before writing to disk.

Implemented in NoopMSDataWritingConsumer, and PlainMSDataWritingConsumer.

◆ processSpectrum_()

virtual void processSpectrum_ ( SpectrumType s)
privatepure virtual

Process a spectrum before storing to disk.

Redefine this function to determine spectra processing before writing to disk.

Implemented in NoopMSDataWritingConsumer, and PlainMSDataWritingConsumer.

◆ setExpectedSize()

void setExpectedSize ( Size  expectedSpectra,
Size  expectedChromatograms 
)
overridevirtual

Set expected size of spectra and chromatograms to be written.

These numbers will be written in the spectrumList and chromatogramList tag in the mzML file. Therefore, these will contain wrong numbers if the expected size is not set correctly.

Parameters
expectedSpectraNumber of spectra expected
expectedChromatogramsNumber of chromatograms expected

Implements IMSDataConsumer.

Referenced by MzMLSwathFileConsumer::addNewSwathMap_(), and TOPPOpenSwathBase::prepareChromOutput().

◆ setExperimentalSettings()

void setExperimentalSettings ( const ExperimentalSettings exp)
overridevirtual

Set experimental settings for the whole file.

Parameters
expExperimental settings to be used for this file (from this and the first spectrum/chromatogram, the class will deduce most of the header of the mzML file)

Implements IMSDataConsumer.

Reimplemented in NoopMSDataWritingConsumer.

Referenced by TOPPOpenSwathBase::prepareChromOutput().

Member Data Documentation

◆ add_dataprocessing_

bool add_dataprocessing_
protected

Whether to add dataprocessing term to the data before writing.

◆ additional_dataprocessing_

DataProcessingPtr additional_dataprocessing_
protected

The dataprocessing to be added to each spectrum/chromatogram.

◆ chromatograms_expected_

Size chromatograms_expected_
protected

Number of chromatograms expected.

◆ chromatograms_written_

Size chromatograms_written_
protected

Number of chromatograms written.

◆ dps_

std::vector<std::vector< ConstDataProcessingPtr > > dps_
protected

Vector of data processing objects -> will be filled by writeHeader_.

◆ ofs_

std::ofstream ofs_
protected

File stream (to write mzML)

◆ settings_

ExperimentalSettings settings_
protected

Experimental settings to use for the whole file.

◆ spectra_expected_

Size spectra_expected_
protected

Number of spectra expected.

◆ spectra_written_

Size spectra_written_
protected

Number of spectra written.

◆ started_writing_

bool started_writing_
protected

Stores whether we have already started writing any data.

◆ validator_

Internal::MzMLValidator* validator_
protected

Validator that knows about CV terms.

◆ writing_chromatograms_

bool writing_chromatograms_
protected

Stores whether we are currently writing chromatograms.

◆ writing_spectra_

bool writing_spectra_
protected

Stores whether we are currently writing spectra.