Loading...
Searching...
No Matches
pappso::cbor::mzcbor::MzcborBuildIndexReader Class Reference

`#include <mzcborbuildindexreader.h>`

Inheritance diagram for pappso::cbor::mzcbor::MzcborBuildIndexReader:

## Public Member Functions

| MzcborBuildIndexReader (const MsRunIdCstSPtr &msrun_id)
virtual | ~MzcborBuildIndexReader ()
virtual void | readCbor (QFile *cborp, pappso::UiMonitorInterface &monitor) override
| read mzCBOR file
const std::vector< qint64 > & | getSpectrumIndexPositionInFile () const
const std::map< QString, std::size_t > & | getNativeId2SpectrumIndexMap () const
Public Member Functions inherited from pappso::cbor::mzcbor::MzcborReaderBase
| MzcborReaderBase ()
virtual | ~MzcborReaderBase ()
virtual void | readCbor (QIODevice *cborp, pappso::UiMonitorInterface &monitor)
| read mzCBOR from any device (memory buffer or else)
virtual void | close ()
| convenient function to clean pointer before leaving
bool | isMzcbor () const
const QStringList & | getMsrunIdList () const
Public Member Functions inherited from pappso::cbor::CborStreamReaderInterface
| CborStreamReaderInterface ()
virtual | ~CborStreamReaderInterface ()

## Protected Member Functions

virtual void | readMsrun () override
| read only the targeted msrun
void | readSpectrumListAndLeave ()
| only the spectrum list of targeted msrun, then stop parsing
void | readSpectrum (qint64 position_of_spectrum_in_file, std::size_t index_count)
| read each spectrum in the targeted msrun (msrunId)
Protected Member Functions inherited from pappso::cbor::mzcbor::MzcborReaderBase
void | readRoot (pappso::UiMonitorInterface &monitor)
virtual void | readReferenceableParamGroupList ()
std::map< QString, CvParam > | getCvParamsMap ()
| read the array containing cvParams to give accessions and values
Protected Member Functions inherited from pappso::cbor::CborStreamReaderInterface
bool | getExpectedString ()
void | initCborReader (QFile *pcborfile)
void | initCborReader (QIODevice *pcborfile)

## Private Attributes

MsRunIdCstSPtr | mcsp_msRunId
QString | m_xmlMzMlRunId
std::vector< qint64 > | m_spectrumIndexPositionInFile
std::map< QString, std::size_t > | m_nativeId2SpectrumIndexMap

## Additional Inherited Members

Protected Attributes inherited from pappso::cbor::mzcbor::MzcborReaderBase
bool | m_stopParsing = false
Protected Attributes inherited from pappso::cbor::CborStreamReaderInterface
CborStreamReader * | mpa_cborReader = nullptr
QString | m_expectedString
QByteArray | m_data

## Detailed Description

Todo
  write docs

Definition at line 45 of file mzcborbuildindexreader.h.

## Constructor & Destructor Documentation

## MzcborBuildIndexReader()

pappso::cbor::mzcbor::MzcborBuildIndexReader::MzcborBuildIndexReader | ( | const MsRunIdCstSPtr & | msrun_id | ) |

Default constructor

Definition at line 39 of file mzcborbuildindexreader.cpp.

: mcsp_msRunId(msrun_id)
{
m_xmlMzMlRunId = msrun_id.get()->getRunId();
}
pappso::cbor::mzcbor::MzcborBuildIndexReader::mcsp_msRunId
MsRunIdCstSPtr mcsp_msRunId
Definition mzcborbuildindexreader.h:82
pappso::cbor::mzcbor::MzcborBuildIndexReader::m_xmlMzMlRunId
QString m_xmlMzMlRunId
Definition mzcborbuildindexreader.h:83

References m_xmlMzMlRunId, and mcsp_msRunId.

## ~MzcborBuildIndexReader()

pappso::cbor::mzcbor::MzcborBuildIndexReader::~MzcborBuildIndexReader | ( |  | ) |

virtual

Destructor

Definition at line 45 of file mzcborbuildindexreader.cpp.

{
}

## Member Function Documentation

## getNativeId2SpectrumIndexMap()

const std::map< QString, std::size_t > & pappso::cbor::mzcbor::MzcborBuildIndexReader::getNativeId2SpectrumIndexMap | ( |  | ) | const

Definition at line 76 of file mzcborbuildindexreader.cpp.

{
return m_nativeId2SpectrumIndexMap;
}
pappso::cbor::mzcbor::MzcborBuildIndexReader::m_nativeId2SpectrumIndexMap
std::map< QString, std::size_t > m_nativeId2SpectrumIndexMap
Definition mzcborbuildindexreader.h:86

References m_nativeId2SpectrumIndexMap.

Referenced by pappso::MzcborMsRunReader::initialize().

## getSpectrumIndexPositionInFile()

const std::vector< qint64 > & pappso::cbor::mzcbor::MzcborBuildIndexReader::getSpectrumIndexPositionInFile | ( |  | ) | const

Definition at line 70 of file mzcborbuildindexreader.cpp.

{
return m_spectrumIndexPositionInFile;
}
pappso::cbor::mzcbor::MzcborBuildIndexReader::m_spectrumIndexPositionInFile
std::vector< qint64 > m_spectrumIndexPositionInFile
Definition mzcborbuildindexreader.h:85

References m_spectrumIndexPositionInFile.

Referenced by pappso::MzcborMsRunReader::initialize().

## readCbor()

void pappso::cbor::mzcbor::MzcborBuildIndexReader::readCbor | ( | QFile * | cborp,
|  | pappso::UiMonitorInterface & | monitor )

override virtual

read mzCBOR file

Parameters

  cborp | file pointer
  monitor | monitor read progress and messages

Reimplemented from pappso::cbor::mzcbor::MzcborReaderBase.

Definition at line 51 of file mzcborbuildindexreader.cpp.

{
qDebug();
initCborReader((QIODevice *)cborp);
if(mpa_cborReader->device() == nullptr)
{
throw pappso::PappsoException(QObject::tr("device is null"));
}
qDebug();
if(mpa_cborReader->isMap())
{
readRoot(monitor);
}
qDebug();
}
pappso::cbor::CborStreamReaderInterface::initCborReader
void initCborReader(QFile *pcborfile)
Definition cborstreamreaderinterface.cpp:80
pappso::cbor::CborStreamReaderInterface::mpa_cborReader
CborStreamReader * mpa_cborReader
Definition cborstreamreaderinterface.h:68
pappso::cbor::mzcbor::MzcborReaderBase::readRoot
void readRoot(pappso::UiMonitorInterface &monitor)
Definition mzcborreaderbase.cpp:75

References pappso::cbor::CborStreamReaderInterface::initCborReader(), pappso::cbor::CborStreamReaderInterface::mpa_cborReader, and pappso::cbor::mzcbor::MzcborReaderBase::readRoot().

Referenced by pappso::MzcborMsRunReader::initialize().

## readMsrun()

void pappso::cbor::mzcbor::MzcborBuildIndexReader::readMsrun | ( |  | ) |

override protected virtual

read only the targeted msrun

Reimplemented from pappso::cbor::mzcbor::MzcborReaderBase.

Definition at line 81 of file mzcborbuildindexreader.cpp.

{
// qDebug();
mpa_cborReader->enterContainer();
bool ms_run_to_read = false;
while(getExpectedString())
{
if(m_expectedString == "id")
{
getExpectedString();
if((m_expectedString == m_xmlMzMlRunId) || (m_xmlMzMlRunId.isEmpty()))
{
ms_run_to_read = true;
}
}
else if(m_expectedString == "spectrumList")
{
if(ms_run_to_read)
{
readSpectrumListAndLeave();
}
else
{
mpa_cborReader->next();
}
}
else
{
mpa_cborReader->next();
}
}
mpa_cborReader->leaveContainer();
}
pappso::cbor::CborStreamReaderInterface::m_expectedString
QString m_expectedString
Definition cborstreamreaderinterface.h:69
pappso::cbor::CborStreamReaderInterface::getExpectedString
bool getExpectedString()
Definition cborstreamreaderinterface.cpp:54
pappso::cbor::mzcbor::MzcborBuildIndexReader::readSpectrumListAndLeave
void readSpectrumListAndLeave()
only the spectrum list of targeted msrun, then stop parsing
Definition mzcborbuildindexreader.cpp:121

References pappso::cbor::CborStreamReaderInterface::getExpectedString(), pappso::cbor::CborStreamReaderInterface::m_expectedString, m_xmlMzMlRunId, pappso::cbor::CborStreamReaderInterface::mpa_cborReader, and readSpectrumListAndLeave().

## readSpectrum()

void pappso::cbor::mzcbor::MzcborBuildIndexReader::readSpectrum | ( | qint64 | position_of_spectrum_in_file,
|  | std::size_t | index_count )

protected

read each spectrum in the targeted msrun (msrunId)

Definition at line 178 of file mzcborbuildindexreader.cpp.

{
qDebug();
mpa_cborReader->enterContainer();
//<spectrum id="controllerType=0 controllerNumber=1 scan=1" index="0" defaultArrayLength="1552">
QString native_id;
std::size_t given_index = 0;
std::map<QString, CvParam> spectrum_parameters;
std::map<QString, CvParam> scan_parameters;
while(getExpectedString())
{
qDebug() << m_expectedString;
if(m_expectedString == "id")
{
getExpectedString();
native_id = m_expectedString;
qDebug() << m_expectedString;
}
else if(m_expectedString == "index")
{
if(mpa_cborReader->isUnsignedInteger())
{
given_index = mpa_cborReader->toUnsignedInteger();
mpa_cborReader->next();
qDebug() << given_index;
// qFatal();
}
else
{
}
}
else if(m_expectedString == "cvParam")
{
mpa_cborReader->next();
// spectrum_parameters = getCvParamsMap();
}
else if(m_expectedString == "scanList")
{
mpa_cborReader->next();
}
else if(m_expectedString == "binaryDataArray")
{
mpa_cborReader->next();
}
else
{
mpa_cborReader->next();
}
}
if((given_index != index_count) || (index_count != m_spectrumIndexPositionInFile.size()))
{
throw pappso::PappsoException(QObject::tr("index inconsistency %1 %2 %3")
.arg(given_index)
.arg(index_count)
.arg(m_spectrumIndexPositionInFile.size()));
}
m_spectrumIndexPositionInFile.push_back(position_of_spectrum_in_file);
m_nativeId2SpectrumIndexMap.insert({native_id, given_index});
mpa_cborReader->leaveContainer();
}

References pappso::cbor::CborStreamReaderInterface::getExpectedString(), pappso::cbor::CborStreamReaderInterface::m_expectedString, m_nativeId2SpectrumIndexMap, m_spectrumIndexPositionInFile, and pappso::cbor::CborStreamReaderInterface::mpa_cborReader.

Referenced by readSpectrumListAndLeave().

## readSpectrumListAndLeave()

void pappso::cbor::mzcbor::MzcborBuildIndexReader::readSpectrumListAndLeave | ( |  | ) |

protected

only the spectrum list of targeted msrun, then stop parsing

Definition at line 121 of file mzcborbuildindexreader.cpp.

{
mpa_cborReader->enterContainer();
// qDebug();
// We'll need it to perform the looping in the spectrum list.
std::size_t spectrum_list_size = 0;
// qDebug() << "The spectrum list has size:" << spectrum_list_size;
while(getExpectedString())
{
qDebug() << m_expectedString;
if(m_expectedString == "count")
{
if(mpa_cborReader->isUnsignedInteger())
{
spectrum_list_size = mpa_cborReader->toUnsignedInteger();
mpa_cborReader->next();
qDebug() << "spectrum count=" << spectrum_list_size;
}
}
else if(m_expectedString == "spectrum")
{
mpa_cborReader->enterContainer(); // start array
qint64 pos = mpa_cborReader->currentOffset();
std::size_t index_count = 0;
while(mpa_cborReader->hasNext())
{
qDebug();
qDebug();
readSpectrum(pos, index_count);
index_count++;
pos = mpa_cborReader->currentOffset();
}
mpa_cborReader->leaveContainer(); // stop array
}
else
{
mpa_cborReader->next();
}
}
mpa_cborReader->leaveContainer();
m_stopParsing = true;
}
pappso::cbor::mzcbor::MzcborBuildIndexReader::readSpectrum
void readSpectrum(qint64 position_of_spectrum_in_file, std::size_t index_count)
read each spectrum in the targeted msrun (msrunId)
Definition mzcborbuildindexreader.cpp:178
pappso::cbor::mzcbor::MzcborReaderBase::m_stopParsing
bool m_stopParsing
Definition mzcborreaderbase.h:90

References pappso::cbor::CborStreamReaderInterface::getExpectedString(), pappso::cbor::CborStreamReaderInterface::m_expectedString, pappso::cbor::mzcbor::MzcborReaderBase::m_stopParsing, pappso::cbor::CborStreamReaderInterface::mpa_cborReader, and readSpectrum().

Referenced by readMsrun().

## Member Data Documentation

## m_nativeId2SpectrumIndexMap

std::map<QString, std::size_t> pappso::cbor::mzcbor::MzcborBuildIndexReader::m_nativeId2SpectrumIndexMap

private

Definition at line 86 of file mzcborbuildindexreader.h.

Referenced by getNativeId2SpectrumIndexMap(), and readSpectrum().

## m_spectrumIndexPositionInFile

std::vector<qint64> pappso::cbor::mzcbor::MzcborBuildIndexReader::m_spectrumIndexPositionInFile

private

Definition at line 85 of file mzcborbuildindexreader.h.

Referenced by getSpectrumIndexPositionInFile(), and readSpectrum().

## m_xmlMzMlRunId

QString pappso::cbor::mzcbor::MzcborBuildIndexReader::m_xmlMzMlRunId

private

Definition at line 83 of file mzcborbuildindexreader.h.

Referenced by MzcborBuildIndexReader(), and readMsrun().

## mcsp_msRunId

MsRunIdCstSPtr pappso::cbor::mzcbor::MzcborBuildIndexReader::mcsp_msRunId

private

Definition at line 82 of file mzcborbuildindexreader.h.

Referenced by MzcborBuildIndexReader().

The documentation for this class was generated from the following files:

- pappsomspp/core/processing/cbor/mzcbor/mzcborbuildindexreader.h
- pappsomspp/core/processing/cbor/mzcbor/mzcborbuildindexreader.cpp