Loading...
Searching...
No Matches
pappso::masschroq::PrecursorParser Class Reference

`#include <precursorparser.h>`

Inheritance diagram for pappso::masschroq::PrecursorParser:

## Public Member Functions

| PrecursorParser (pappso::MsRunReaderCstSPtr msrun_reader)
virtual | ~PrecursorParser ()
virtual void | setQualifiedMassSpectrum (const pappso::QualifiedMassSpectrum &qspectrum) override
virtual bool | needPeakList () const override
| tells if we need the peak list (if we want the binary data) for each spectrum
virtual bool | isReadAhead () const override
| tells if we want to read ahead spectrum
const PrecursorSp & | getPrecursorSPtrBySpectrumIndex (std::size_t spectrum_index) const
const PrecursorSp & | getPrecursorSPtrByScanNumber (std::size_t spectrum_index) const
Public Member Functions inherited from pappso::SpectrumCollectionHandlerInterface
virtual bool | needMsLevelPeakList (unsigned int ms_level) const final
| tells if we need the peak list (if we want the binary data) for each spectrum, given an MS level
virtual void | setNeedMsLevelPeakList (unsigned int ms_level, bool want_peak_list) final
| tells if we need the peak list given
virtual bool | shouldStop ()
virtual void | loadingEnded ()
virtual void | spectrumListHasSize (std::size_t size)
virtual void | setReadAhead (bool is_read_ahead) final
| use threads to read a spectrum by batch of batch_size

## Private Member Functions

void | mapScanNumberPrecursor (std::size_t scan_num, PrecursorSp precursor)
| map precursor to its scan number as parsed in the xml file of this msrun
void | mapSpectrumIndexToPrecursor (std::size_t spectrum_index, PrecursorSp precursor)
| map spectrum index to precursor new modern method to replace obsolete scan number

## Private Attributes

pappso::MsRunReaderCstSPtr | msp_msrunReader
std::map< std::size_t, PrecursorSp > | m_scanNumber2PrecursorMap
std::map< std::size_t, PrecursorSp > | m_spectrumIndex2PrecursorMap

## Detailed Description

Todo
  write docs

Definition at line 40 of file precursorparser.h.

## Constructor & Destructor Documentation

## PrecursorParser()

pappso::masschroq::PrecursorParser::PrecursorParser | ( | pappso::MsRunReaderCstSPtr | msrun_reader | ) |

Definition at line 35 of file precursorparser.cpp.

{
msp_msrunReader = msrun_reader;
}
pappso::masschroq::PrecursorParser::msp_msrunReader
pappso::MsRunReaderCstSPtr msp_msrunReader
Definition precursorparser.h:71

References msp_msrunReader.

## ~PrecursorParser()

pappso::masschroq::PrecursorParser::~PrecursorParser | ( |  | ) |

virtual

Definition at line 41 of file precursorparser.cpp.

{
}

## Member Function Documentation

## getPrecursorSPtrByScanNumber()

const pappso::masschroq::PrecursorSp & pappso::masschroq::PrecursorParser::getPrecursorSPtrByScanNumber | ( | std::size_t | spectrum_index | ) | const

Definition at line 160 of file precursorparser.cpp.

{
auto it = m_scanNumber2PrecursorMap.find(spectrum_index);
if(it != m_scanNumber2PrecursorMap.end())
{
}
else
{
throw pappso::PappsoException(QObject::tr("scan number %1 not found in %2")
.arg(spectrum_index)
.arg(msp_msrunReader.get()->getMsRunId()->getXmlId()));
}
return it->second;
}
pappso::masschroq::PrecursorParser::m_scanNumber2PrecursorMap
std::map< std::size_t, PrecursorSp > m_scanNumber2PrecursorMap
Definition precursorparser.h:73

References m_scanNumber2PrecursorMap, and msp_msrunReader.

## getPrecursorSPtrBySpectrumIndex()

const pappso::masschroq::PrecursorSp & pappso::masschroq::PrecursorParser::getPrecursorSPtrBySpectrumIndex | ( | std::size_t | spectrum_index | ) | const

Definition at line 143 of file precursorparser.cpp.

{
auto it = m_spectrumIndex2PrecursorMap.find(spectrum_index);
if(it != m_spectrumIndex2PrecursorMap.end())
{
}
else
{
throw pappso::PappsoException(QObject::tr("spectrum index %1 not found in %2")
.arg(spectrum_index)
.arg(msp_msrunReader.get()->getMsRunId()->getXmlId()));
}
return it->second;
}
pappso::masschroq::PrecursorParser::m_spectrumIndex2PrecursorMap
std::map< std::size_t, PrecursorSp > m_spectrumIndex2PrecursorMap
Definition precursorparser.h:74

References m_spectrumIndex2PrecursorMap, and msp_msrunReader.

## isReadAhead()

bool pappso::masschroq::PrecursorParser::isReadAhead | ( |  | ) | const

override virtual

tells if we want to read ahead spectrum

Reimplemented from pappso::SpectrumCollectionHandlerInterface.

Definition at line 105 of file precursorparser.cpp.

{
return true;
}

## mapScanNumberPrecursor()

void pappso::masschroq::PrecursorParser::mapScanNumberPrecursor | ( | std::size_t | scan_num,
|  | PrecursorSp | precursor )

private

map precursor to its scan number as parsed in the xml file of this msrun

Definition at line 111 of file precursorparser.cpp.

{
if(precursor.get()->getXicCoordSPtr().get() == nullptr)
{
throw pappso::PappsoException(
QObject::tr("precursor.get()->getXicCoordSPtr().get() == nullptr scan_num=%1\n")
.arg(scan_num));
}
m_scanNumber2PrecursorMap[scan_num] = precursor;
}

References pappso::masschroq::Precursor::getXicCoordSPtr(), and m_scanNumber2PrecursorMap.

Referenced by setQualifiedMassSpectrum().

## mapSpectrumIndexToPrecursor()

void pappso::masschroq::PrecursorParser::mapSpectrumIndexToPrecursor | ( | std::size_t | spectrum_index,
|  | PrecursorSp | precursor )

private

map spectrum index to precursor new modern method to replace obsolete scan number

Definition at line 125 of file precursorparser.cpp.

{
qDebug() << " spectrum_index=" << spectrum_index;
if(precursor.get()->getXicCoordSPtr().get() == nullptr)
{
throw pappso::PappsoException(
QObject::tr("precursor.get()->getXicCoordSPtr().get() == nullptr \n")
.arg(msp_msrunReader.get()->getMsRunId()->getXmlId())
.arg(spectrum_index));
}
m_spectrumIndex2PrecursorMap[spectrum_index] = precursor;
qDebug() << " spectrum_index=" << spectrum_index;
}

References pappso::masschroq::Precursor::getXicCoordSPtr(), m_spectrumIndex2PrecursorMap, and msp_msrunReader.

Referenced by setQualifiedMassSpectrum().

## needPeakList()

bool pappso::masschroq::PrecursorParser::needPeakList | ( |  | ) | const

override virtual

tells if we need the peak list (if we want the binary data) for each spectrum

Implements pappso::SpectrumCollectionHandlerInterface.

Definition at line 46 of file precursorparser.cpp.

{
return false;
}

## setQualifiedMassSpectrum()

void pappso::masschroq::PrecursorParser::setQualifiedMassSpectrum | ( | const pappso::QualifiedMassSpectrum & | qspectrum | ) |

override virtual

adding this new precursor to the msrun's hash map of scan_num -> precursor

Implements pappso::SpectrumCollectionHandlerInterface.

Definition at line 51 of file precursorparser.cpp.

{
if(qspectrum.getMsLevel() > 1)
{
pappso::masschroq::PrecursorSp precursor = std::make_shared<pappso::masschroq::Precursor>(
qspectrum.getPrecursorSpectrumIndex(),
qspectrum.getPrecursorMz(),
qspectrum.getPrecursorIntensity(),
msp_msrunReader.get()->newXicCoordSPtrFromQualifiedMassSpectrum(
qspectrum, pappso::PrecisionFactory::getPpmInstance(10)));
qDebug() << " native_id=" << qspectrum.getMassSpectrumId().getNativeId()
<< " scan idx=" << qspectrum.getMassSpectrumId().getSpectrumIndex()
<< " precursor_idx=" << qspectrum.getPrecursorSpectrumIndex()
<< " precursor.get()->getXicCoordSPtr().get()->toString="
<< precursor.get()->getXicCoordSPtr().get()->toString();
if(precursor.get()->getXicCoordSPtr().get() == nullptr)
{
throw pappso::PappsoException(QObject::tr("precursor.get()->getXicCoordSPtr().get() == "
"nullptr\nindex=%1 %2 %3 %4")
.arg(qspectrum.getMassSpectrumId().getNativeId())
.arg(__FILE__)
.arg(__FUNCTION__)
.arg(__LINE__));
}
/// adding this new precursor to the msrun's hash map of scan_num ->
/// precursor
qDebug();
if(qspectrum.getMassSpectrumId().getNativeId().contains("scan="))
{
qDebug();
mapScanNumberPrecursor(pappso::Utils::extractScanNumberFromMzmlNativeId(
qspectrum.getMassSpectrumId().getNativeId()),
precursor);
mapSpectrumIndexToPrecursor(qspectrum.getMassSpectrumId().getSpectrumIndex(), precursor);
qDebug();
}
else
{
qDebug();
mapScanNumberPrecursor(qspectrum.getMassSpectrumId().getSpectrumIndex(), precursor);
mapSpectrumIndexToPrecursor(qspectrum.getMassSpectrumId().getSpectrumIndex(), precursor);
qDebug();
}
qDebug();
}
}
pappso::MassSpectrumId::getSpectrumIndex
std::size_t getSpectrumIndex() const
Definition massspectrumid.cpp:113
pappso::MassSpectrumId::getNativeId
const QString & getNativeId() const
Definition massspectrumid.cpp:99
pappso::PrecisionFactory::getPpmInstance
static PrecisionPtr getPpmInstance(pappso_double value)
get a ppm precision pointer
Definition precision.cpp:155
pappso::QualifiedMassSpectrum::getMsLevel
uint getMsLevel() const
Get the mass spectrum level.
Definition qualifiedmassspectrum.cpp:189
pappso::QualifiedMassSpectrum::getPrecursorIntensity
pappso_double getPrecursorIntensity(bool *ok=nullptr) const
get precursor intensity
Definition qualifiedmassspectrum.cpp:396
pappso::QualifiedMassSpectrum::getMassSpectrumId
const MassSpectrumId & getMassSpectrumId() const
Get the MassSpectrumId.
Definition qualifiedmassspectrum.cpp:154
pappso::QualifiedMassSpectrum::getPrecursorMz
pappso_double getPrecursorMz(bool *ok=nullptr) const
get precursor mz
Definition qualifiedmassspectrum.cpp:240
pappso::QualifiedMassSpectrum::getPrecursorSpectrumIndex
std::size_t getPrecursorSpectrumIndex() const
Get the scan number of the precursor ion.
Definition qualifiedmassspectrum.cpp:422
pappso::Utils::extractScanNumberFromMzmlNativeId
static std::size_t extractScanNumberFromMzmlNativeId(const QString &spectrum_native_id)
Definition utils.cpp:285
pappso::masschroq::PrecursorParser::mapSpectrumIndexToPrecursor
void mapSpectrumIndexToPrecursor(std::size_t spectrum_index, PrecursorSp precursor)
map spectrum index to precursor new modern method to replace obsolete scan number
Definition precursorparser.cpp:125
pappso::masschroq::PrecursorParser::mapScanNumberPrecursor
void mapScanNumberPrecursor(std::size_t scan_num, PrecursorSp precursor)
map precursor to its scan number as parsed in the xml file of this msrun
Definition precursorparser.cpp:111
pappso::masschroq::PrecursorSp
std::shared_ptr< Precursor > PrecursorSp
Definition precursor.h:39

References pappso::Utils::extractScanNumberFromMzmlNativeId(), pappso::QualifiedMassSpectrum::getMassSpectrumId(), pappso::QualifiedMassSpectrum::getMsLevel(), pappso::MassSpectrumId::getNativeId(), pappso::PrecisionFactory::getPpmInstance(), pappso::QualifiedMassSpectrum::getPrecursorIntensity(), pappso::QualifiedMassSpectrum::getPrecursorMz(), pappso::QualifiedMassSpectrum::getPrecursorSpectrumIndex(), pappso::MassSpectrumId::getSpectrumIndex(), pappso::masschroq::Precursor::getXicCoordSPtr(), mapScanNumberPrecursor(), mapSpectrumIndexToPrecursor(), and msp_msrunReader.

## Member Data Documentation

## m_scanNumber2PrecursorMap

std::map<std::size_t, PrecursorSp> pappso::masschroq::PrecursorParser::m_scanNumber2PrecursorMap

private

Definition at line 73 of file precursorparser.h.

Referenced by getPrecursorSPtrByScanNumber(), and mapScanNumberPrecursor().

## m_spectrumIndex2PrecursorMap

std::map<std::size_t, PrecursorSp> pappso::masschroq::PrecursorParser::m_spectrumIndex2PrecursorMap

private

Definition at line 74 of file precursorparser.h.

Referenced by getPrecursorSPtrBySpectrumIndex(), and mapSpectrumIndexToPrecursor().

## msp_msrunReader

pappso::MsRunReaderCstSPtr pappso::masschroq::PrecursorParser::msp_msrunReader

private

Definition at line 71 of file precursorparser.h.

Referenced by PrecursorParser(), getPrecursorSPtrByScanNumber(), getPrecursorSPtrBySpectrumIndex(), mapSpectrumIndexToPrecursor(), and setQualifiedMassSpectrum().

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

- pappsomspp/core/masschroq/input/precursorparser.h
- pappsomspp/core/masschroq/input/precursorparser.cpp