Loading...
Searching...
No Matches
mzcborindexreader.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/core/processing/cbor/mzcbor/mzcborindexreader.cpp
* \date 03/12/2025
* \author Olivier Langella
* \brief read mzcbor index file
*/
/*******************************************************************************
* 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/>.
*
******************************************************************************/
#include "mzcborindexreader.h"
pappso::cbor::mzcbor::MzcborIndexReader::MzcborIndexReader()
{
}
pappso::cbor::mzcbor::MzcborIndexReader::~MzcborIndexReader()
{
}
void
pappso::cbor::mzcbor::MzcborIndexReader::close()
{
}
void
pappso::cbor::mzcbor::MzcborIndexReader::readCbor(QFile *cborp)
{
qDebug();
initCborReader(cborp);
qDebug();
if(mpa_cborReader->isMap())
{
readRoot();
}
qDebug();
}
void
pappso::cbor::mzcbor::MzcborIndexReader::readRoot()
{
qDebug();
mpa_cborReader->enterContainer();
while(getExpectedString())
{
if(m_expectedString == "informations")
{
QCborMap cbor_informations;
mpa_cborReader->readCborMap(cbor_informations);
}
else if(m_expectedString == "from")
{
m_isMzcborIndex = true;
qDebug() << m_expectedString;
if(getExpectedString())
{
m_from = m_expectedString;
}
}
else if(m_expectedString == "runIdList")
{
mpa_cborReader->readArray(m_runIdList);
}
else if(m_expectedString == "runSpectrumIndexList")
{
std::size_t length = mpa_cborReader->length();
mpa_cborReader->enterContainer();
for(std::size_t i = 0; i < length; i++)
{
m_runAndSpectrumOffsetList.push_back(std::vector<qint64>());
mpa_cborReader->readArray(m_runAndSpectrumOffsetList.back());
}
mpa_cborReader->leaveContainer();
}
else if(m_expectedString == "runSpectrumNativeIdList")
{
std::size_t length = mpa_cborReader->length();
mpa_cborReader->enterContainer();
for(std::size_t i = 0; i < length; i++)
{
m_runAndSpectrumIdList.push_back(std::vector<QString>());
mpa_cborReader->readArray(m_runAndSpectrumIdList.back());
}
mpa_cborReader->leaveContainer();
}
else if(m_expectedString == "runSpectrumMsLevelList")
{
std::size_t length = mpa_cborReader->length();
mpa_cborReader->enterContainer();
for(std::size_t i = 0; i < length; i++)
{
m_runAndSpectrumMsLevelList.push_back(std::vector<std::uint8_t>());
mpa_cborReader->readArray(m_runAndSpectrumMsLevelList.back());
}
mpa_cborReader->leaveContainer();
}
else if(m_expectedString == "runSpectrumTotalIonCountList")
{
std::size_t length = mpa_cborReader->length();
mpa_cborReader->enterContainer();
for(std::size_t i = 0; i < length; i++)
{
m_runAndSpectrumTotalIonCountList.push_back(std::vector<qint64>());
mpa_cborReader->readArray(m_runAndSpectrumTotalIonCountList.back());
}
mpa_cborReader->leaveContainer();
}
else if(m_expectedString == "runSpectrumRtList")
{
std::size_t length = mpa_cborReader->length();
mpa_cborReader->enterContainer();
for(std::size_t i = 0; i < length; i++)
{
m_runAndSpectrumRtList.push_back(std::vector<double>());
mpa_cborReader->readArray(m_runAndSpectrumRtList.back());
}
mpa_cborReader->leaveContainer();
}
}
mpa_cborReader->leaveContainer();
}
bool
pappso::cbor::mzcbor::MzcborIndexReader::isMzcborIndex() const
{
return m_isMzcborIndex;
}
const std::vector<QString> &
pappso::cbor::mzcbor::MzcborIndexReader::getRunIdList() const
{
return m_runIdList;
}
const std::vector<std::vector<qint64>> &
pappso::cbor::mzcbor::MzcborIndexReader::getRunAndSpectrumOffsetList() const
{
return m_runAndSpectrumOffsetList;
}
const std::vector<std::vector<QString>> &
pappso::cbor::mzcbor::MzcborIndexReader::getRunAndSpectrumIdList() const
{
return m_runAndSpectrumIdList;
}
const std::vector<std::vector<qint64>> &
pappso::cbor::mzcbor::MzcborIndexReader::getRunAndSpectrumTotalIonCountList() const
{
return m_runAndSpectrumTotalIonCountList;
}
const std::vector<std::vector<double>> &
pappso::cbor::mzcbor::MzcborIndexReader::getRunAndSpectrumRtList() const
{
return m_runAndSpectrumRtList;
}
const std::vector<std::vector<std::uint8_t>> &
pappso::cbor::mzcbor::MzcborIndexReader::getRunAndSpectrumMsLevelList() const
{
return m_runAndSpectrumMsLevelList;
}
pappso::cbor::CborStreamReaderInterface::m_expectedString
QString m_expectedString
Definition cborstreamreaderinterface.h:69
pappso::cbor::CborStreamReaderInterface::initCborReader
void initCborReader(QFile *pcborfile)
Definition cborstreamreaderinterface.cpp:80
pappso::cbor::CborStreamReaderInterface::getExpectedString
bool getExpectedString()
Definition cborstreamreaderinterface.cpp:54
pappso::cbor::CborStreamReaderInterface::mpa_cborReader
CborStreamReader * mpa_cborReader
Definition cborstreamreaderinterface.h:68
pappso::cbor::mzcbor::MzcborIndexReader::getRunAndSpectrumTotalIonCountList
const std::vector< std::vector< qint64 > > & getRunAndSpectrumTotalIonCountList() const
Definition mzcborindexreader.cpp:174
pappso::cbor::mzcbor::MzcborIndexReader::close
virtual void close()
convenient function to clean pointer before leaving
Definition mzcborindexreader.cpp:41
pappso::cbor::mzcbor::MzcborIndexReader::m_runAndSpectrumOffsetList
std::vector< std::vector< qint64 > > m_runAndSpectrumOffsetList
Definition mzcborindexreader.h:76
pappso::cbor::mzcbor::MzcborIndexReader::m_runAndSpectrumMsLevelList
std::vector< std::vector< std::uint8_t > > m_runAndSpectrumMsLevelList
Definition mzcborindexreader.h:79
pappso::cbor::mzcbor::MzcborIndexReader::getRunAndSpectrumMsLevelList
const std::vector< std::vector< std::uint8_t > > & getRunAndSpectrumMsLevelList() const
Definition mzcborindexreader.cpp:186
pappso::cbor::mzcbor::MzcborIndexReader::getRunAndSpectrumOffsetList
const std::vector< std::vector< qint64 > > & getRunAndSpectrumOffsetList() const
Definition mzcborindexreader.cpp:162
pappso::cbor::mzcbor::MzcborIndexReader::m_isMzcborIndex
bool m_isMzcborIndex
Definition mzcborindexreader.h:73
pappso::cbor::mzcbor::MzcborIndexReader::m_runAndSpectrumRtList
std::vector< std::vector< double > > m_runAndSpectrumRtList
Definition mzcborindexreader.h:80
pappso::cbor::mzcbor::MzcborIndexReader::m_from
QString m_from
Definition mzcborindexreader.h:74
pappso::cbor::mzcbor::MzcborIndexReader::getRunAndSpectrumIdList
const std::vector< std::vector< QString > > & getRunAndSpectrumIdList() const
Definition mzcborindexreader.cpp:168
pappso::cbor::mzcbor::MzcborIndexReader::isMzcborIndex
bool isMzcborIndex() const
Definition mzcborindexreader.cpp:148
pappso::cbor::mzcbor::MzcborIndexReader::m_runAndSpectrumTotalIonCountList
std::vector< std::vector< qint64 > > m_runAndSpectrumTotalIonCountList
Definition mzcborindexreader.h:78
pappso::cbor::mzcbor::MzcborIndexReader::getRunIdList
const std::vector< QString > & getRunIdList() const
Definition mzcborindexreader.cpp:155
pappso::cbor::mzcbor::MzcborIndexReader::m_runIdList
std::vector< QString > m_runIdList
Definition mzcborindexreader.h:75
pappso::cbor::mzcbor::MzcborIndexReader::readRoot
void readRoot()
Definition mzcborindexreader.cpp:61
pappso::cbor::mzcbor::MzcborIndexReader::~MzcborIndexReader
virtual ~MzcborIndexReader()
Definition mzcborindexreader.cpp:36
pappso::cbor::mzcbor::MzcborIndexReader::getRunAndSpectrumRtList
const std::vector< std::vector< double > > & getRunAndSpectrumRtList() const
Definition mzcborindexreader.cpp:180
pappso::cbor::mzcbor::MzcborIndexReader::readCbor
virtual void readCbor(QFile *cborp)
Definition mzcborindexreader.cpp:46
pappso::cbor::mzcbor::MzcborIndexReader::MzcborIndexReader
MzcborIndexReader()
Definition mzcborindexreader.cpp:32
pappso::cbor::mzcbor::MzcborIndexReader::m_runAndSpectrumIdList
std::vector< std::vector< QString > > m_runAndSpectrumIdList
Definition mzcborindexreader.h:77
mzcborindexreader.h
read mzcbor index file