Loading...
Searching...
No Matches
mzmlconvert.h
Go to the documentation of this file.
/**
* \file pappsomspp/processing/cbor/mzcbor/mzmlconvert.h
* \date 19/11/2025
* \author Olivier Langella
* \brief convert mzML to mzcbor
*/
/*******************************************************************************
* Copyright (c) 2025 Olivier Langella <Olivier.Langella@universite-paris-saclay.fr>.
*
* This file is part of PAPPSOms-tools.
*
* PAPPSOms-tools is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms-tools is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
#include "pappsomspp/core/processing/uimonitor/uimonitorinterface.h"
#include "pappsomspp/core/processing/cbor/cborstreamwriter.h"
#include "pappsomspp/core/processing/xml/xmlstreamreaderinterface.h"
#include "pappsomspp/export-import-config.h"
namespace pappso
{
namespace cbor
{
namespace mzcbor
{
/**
* @todo write docs
*/
class PMSPP_LIB_DECL MzmlConvert : public XmlStreamReaderInterface
{
public:
/**
* Default constructor
*/
MzmlConvert(pappso::UiMonitorInterface *p_monitor, pappso::cbor::CborStreamWriter *p_output);
/**
* Destructor
*/
virtual ~MzmlConvert();
void writeMzcborIndex(pappso::cbor::CborStreamWriter *writer) const;
const std::vector<QString> &getRunIdList() const;
const std::vector<std::vector<qint64>> &getRunAndSpectrumOffsetList() const;
const std::vector<std::vector<QString>> &getRunAndSpectrumIdList() const;
protected:
virtual void readStream() override;
private:
void attributeListToCbor(const QXmlStreamAttributes &xml_attributes);
void attributeValueToCbor(const QStringView &value_str);
void insideElement(QString &last_element, bool &array_started);
void getCurrentSpectrumSize();
void readBinaryDataArrayList();
QString readBinaryDataArray(QVector<double> &double_array);
private:
pappso::UiMonitorInterface *mp_monitor;
pappso::cbor::CborStreamWriter *mp_cborWriter;
std::vector<QString> m_elementStash;
QStringList m_elementToStoreInArray;
std::size_t m_currentSpectrumSize = 0;
QVector<double> m_doubleArray;
std::vector<QString> m_runIdList;
std::vector<std::vector<qint64>> m_runAndSpectrumOffsetList;
std::vector<std::vector<QString>> m_runAndSpectrumIdList;
std::vector<std::vector<qint64>> m_runAndSpectrumTotalIonCountList;
std::vector<std::vector<std::uint8_t>> m_runAndSpectrumMsLevelList;
std::vector<std::vector<double>> m_runAndSpectrumRtList;
QString m_uuid;
};
} // namespace mzcbor
} // namespace cbor
} // namespace pappso
cborstreamwriter.h
pappso::UiMonitorInterface
Definition uimonitorinterface.h:50
pappso::XmlStreamReaderInterface::XmlStreamReaderInterface
XmlStreamReaderInterface()
Definition xmlstreamreaderinterface.cpp:37
pappso::cbor::CborStreamWriter
overrides QCborStreamWriter base class to provide convenient functions
Definition cborstreamwriter.h:45
pappso::cbor::mzcbor::MzmlConvert::readStream
virtual void readStream() override
Definition mzmlconvert.cpp:169
pappso::cbor::mzcbor::MzmlConvert::m_elementStash
std::vector< QString > m_elementStash
Definition mzmlconvert.h:84
pappso::cbor::mzcbor::MzmlConvert::readBinaryDataArray
QString readBinaryDataArray(QVector< double > &double_array)
pappso::cbor::mzcbor::MzmlConvert::m_runAndSpectrumIdList
std::vector< std::vector< QString > > m_runAndSpectrumIdList
Definition mzmlconvert.h:93
pappso::cbor::mzcbor::MzmlConvert::getCurrentSpectrumSize
void getCurrentSpectrumSize()
Definition mzmlconvert.cpp:224
pappso::cbor::mzcbor::MzmlConvert::m_elementToStoreInArray
QStringList m_elementToStoreInArray
Definition mzmlconvert.h:85
pappso::cbor::mzcbor::MzmlConvert::m_runAndSpectrumTotalIonCountList
std::vector< std::vector< qint64 > > m_runAndSpectrumTotalIonCountList
Definition mzmlconvert.h:94
pappso::cbor::mzcbor::MzmlConvert::writeMzcborIndex
void writeMzcborIndex(pappso::cbor::CborStreamWriter *writer) const
Definition mzmlconvert.cpp:65
pappso::cbor::mzcbor::MzmlConvert::m_runAndSpectrumMsLevelList
std::vector< std::vector< std::uint8_t > > m_runAndSpectrumMsLevelList
Definition mzmlconvert.h:95
pappso::cbor::mzcbor::MzmlConvert::getRunAndSpectrumOffsetList
const std::vector< std::vector< qint64 > > & getRunAndSpectrumOffsetList() const
Definition mzmlconvert.cpp:489
pappso::cbor::mzcbor::MzmlConvert::insideElement
void insideElement(QString &last_element, bool &array_started)
Definition mzmlconvert.cpp:265
pappso::cbor::mzcbor::MzmlConvert::getRunIdList
const std::vector< QString > & getRunIdList() const
Definition mzmlconvert.cpp:482
pappso::cbor::mzcbor::MzmlConvert::m_runAndSpectrumRtList
std::vector< std::vector< double > > m_runAndSpectrumRtList
Definition mzmlconvert.h:96
pappso::cbor::mzcbor::MzmlConvert::m_uuid
QString m_uuid
Definition mzmlconvert.h:97
pappso::cbor::mzcbor::MzmlConvert::attributeListToCbor
void attributeListToCbor(const QXmlStreamAttributes &xml_attributes)
Definition mzmlconvert.cpp:460
pappso::cbor::mzcbor::MzmlConvert::getRunAndSpectrumIdList
const std::vector< std::vector< QString > > & getRunAndSpectrumIdList() const
Definition mzmlconvert.cpp:495
pappso::cbor::mzcbor::MzmlConvert::m_runIdList
std::vector< QString > m_runIdList
Definition mzmlconvert.h:91
pappso::cbor::mzcbor::MzmlConvert::mp_monitor
pappso::UiMonitorInterface * mp_monitor
Definition mzmlconvert.h:81
pappso::cbor::mzcbor::MzmlConvert::attributeValueToCbor
void attributeValueToCbor(const QStringView &value_str)
Definition mzmlconvert.cpp:433
pappso::cbor::mzcbor::MzmlConvert::readBinaryDataArrayList
void readBinaryDataArrayList()
Definition mzmlconvert.cpp:233
pappso::cbor::mzcbor::MzmlConvert::MzmlConvert
MzmlConvert(pappso::UiMonitorInterface *p_monitor, pappso::cbor::CborStreamWriter *p_output)
Definition mzmlconvert.cpp:39
pappso::cbor::mzcbor::MzmlConvert::m_doubleArray
QVector< double > m_doubleArray
Definition mzmlconvert.h:89
pappso::cbor::mzcbor::MzmlConvert::m_runAndSpectrumOffsetList
std::vector< std::vector< qint64 > > m_runAndSpectrumOffsetList
Definition mzmlconvert.h:92
pappso::cbor::mzcbor::MzmlConvert::m_currentSpectrumSize
std::size_t m_currentSpectrumSize
Definition mzmlconvert.h:87
pappso::cbor::mzcbor::MzmlConvert::mp_cborWriter
pappso::cbor::CborStreamWriter * mp_cborWriter
Definition mzmlconvert.h:82
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
pappso::cbor::mzcbor
Definition binarydataarray.h:41
pappso::cbor
Definition cborstreamreader.cpp:35
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
uimonitorinterface.h
xmlstreamreaderinterface.h