libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::cbor::psm::PsmFileScanProcess Class Referenceabstract

Basic PSM file reader to process scan (parallelized scan processing). More...

#include <psmfilescanprocess.h>

Inheritance diagram for pappso::cbor::psm::PsmFileScanProcess:
pappso::cbor::psm::PsmFileReaderBase pappso::cbor::CborStreamReaderInterface pappso::cbor::psm::PsmFileScanProcessAndCopy pappso::cbor::psm::PsmFeatures pappso::cbor::psm::PsmIonSeries pappso::cbor::psm::PsmNewEval pappso::cbor::psm::PsmSpecGlob pappso::cbor::psm::PsmSpecPeptidOms

Public Member Functions

 PsmFileScanProcess (std::size_t buffer_scan_size)
virtual ~PsmFileScanProcess ()
Public Member Functions inherited from pappso::cbor::psm::PsmFileReaderBase
 PsmFileReaderBase ()
virtual ~PsmFileReaderBase () override
void readCbor (QFile *cborp, pappso::UiMonitorInterface &monitor)
void readCbor (QIODevice *cborp, pappso::UiMonitorInterface &monitor)
Public Member Functions inherited from pappso::cbor::CborStreamReaderInterface
 CborStreamReaderInterface ()
virtual ~CborStreamReaderInterface ()
virtual void close ()
 convenient function to clean pointer before leaving

Protected Member Functions

void readScan (pappso::UiMonitorInterface &monitor) override
void scanFinished (pappso::UiMonitorInterface &monitor) override
void sampleFinished (pappso::UiMonitorInterface &monitor) override
virtual void processBufferScan (pappso::UiMonitorInterface &monitor)
virtual void processBufferScanDone (pappso::UiMonitorInterface &monitor)
virtual CborScanMapBasenewCborScanMap ()=0
void clearScanBuffer ()
Protected Member Functions inherited from pappso::cbor::psm::PsmFileReaderBase
void readRoot (pappso::UiMonitorInterface &monitor)
virtual void readInformations (pappso::UiMonitorInterface &monitor)
virtual void readLog (pappso::UiMonitorInterface &monitor)
virtual void readParameterMap (pappso::UiMonitorInterface &monitor)
virtual void readProteinMap (pappso::UiMonitorInterface &monitor)
virtual void readSample (pappso::UiMonitorInterface &monitor)
virtual void readPsm (pappso::UiMonitorInterface &monitor)
virtual void psmReady (pappso::UiMonitorInterface &monitor)
virtual void logReady (pappso::UiMonitorInterface &monitor)
virtual void informationsReady (pappso::UiMonitorInterface &monitor)
virtual void parameterMapReady (pappso::UiMonitorInterface &monitor)
virtual void fastaFilesReady (pappso::UiMonitorInterface &monitor)
virtual void proteinMapReady (pappso::UiMonitorInterface &monitor)
virtual void sampleListStarted (pappso::UiMonitorInterface &monitor)
virtual void sampleStarted (pappso::UiMonitorInterface &monitor)
virtual void scanStarted (pappso::UiMonitorInterface &monitor)
virtual void sampleListFinished (pappso::UiMonitorInterface &monitor)
PsmFile readPsmFile (bool &is_ok)
void writePsmFile (CborStreamWriter &writer, const PsmFile &psm_file)
void writePsmFileList (CborStreamWriter &writer, const std::vector< PsmFile > &file_list)
PsmProteinRef readPsmProteinRef (bool &is_ok)
pappso::PeptideSp getCurrentPsmPeptideSp () const
pappso::QualifiedMassSpectrumSPtr getCurrentQualifiedMassSpectrumSPtr () const
 get the qualified Spectrum for the current PSM
bool currentProteinRefListContainsDecoy () const
 tells if the current PSM has a decoy accession
bool currentProteinRefListContainsTarget () const
 tells if the current PSM has a target accession
double getPrecursorMass (double mz_prec, uint charge) const
 convenient function do compute precusor ion mass
Protected Member Functions inherited from pappso::cbor::CborStreamReaderInterface
bool getExpectedString ()
void initCborReader (QFile *pcborfile)
void initCborReader (QIODevice *pcborfile)

Protected Attributes

std::size_t m_bufferScanSize = 1000
std::vector< CborScanMapBase * > m_cborScanList
Protected Attributes inherited from pappso::cbor::psm::PsmFileReaderBase
QStringList m_targetFastaFiles
QStringList m_decoyFastaFiles
PsmProteinMap m_proteinMap
QString m_currentSampleName
PsmFile m_currentPeaklistFile
std::vector< PsmFilem_currentIdentificationFileList
QCborMap m_cborInformations
QCborArray m_cborLog
QCborMap m_cborParameterMap
QCborMap m_cborScanId
QCborMap m_cborScanPrecursor
QCborMap m_cborScanMs2
QCborMap m_cborScanProps
QCborMap m_cborScanPsmEval
QCborMap m_cborScanPsmProps
QString m_currentPsmProforma
std::vector< PsmProteinRefm_currentPsmProteinRefList
Protected Attributes inherited from pappso::cbor::CborStreamReaderInterface
CborStreamReadermpa_cborReader = nullptr
QString m_expectedString
QByteArray m_data

Private Attributes

friend CborScanMapBase

Detailed Description

Basic PSM file reader to process scan (parallelized scan processing).

Definition at line 46 of file psmfilescanprocess.h.

Constructor & Destructor Documentation

◆ PsmFileScanProcess()

pappso::cbor::psm::PsmFileScanProcess::PsmFileScanProcess ( std::size_t buffer_scan_size)

Default constructor

Definition at line 41 of file psmfilescanprocess.cpp.

42{
43 m_bufferScanSize = buffer_scan_size;
44}

References m_bufferScanSize.

Referenced by pappso::cbor::psm::PsmFileScanProcessAndCopy::PsmFileScanProcessAndCopy().

◆ ~PsmFileScanProcess()

pappso::cbor::psm::PsmFileScanProcess::~PsmFileScanProcess ( )
virtual

Destructor

Definition at line 46 of file psmfilescanprocess.cpp.

47{
48}

Member Function Documentation

◆ clearScanBuffer()

void pappso::cbor::psm::PsmFileScanProcess::clearScanBuffer ( )
protected

Definition at line 51 of file psmfilescanprocess.cpp.

52{
53 for(CborScanMapBase *cbor_scan_p : m_cborScanList)
54 {
55 delete cbor_scan_p;
56 }
57 m_cborScanList.clear();
58}
std::vector< CborScanMapBase * > m_cborScanList

References CborScanMapBase, and m_cborScanList.

Referenced by newCborScanMap(), sampleFinished(), pappso::cbor::psm::PsmFileScanProcessAndCopy::sampleFinished(), and scanFinished().

◆ newCborScanMap()

virtual CborScanMapBase * pappso::cbor::psm::PsmFileScanProcess::newCborScanMap ( )
protectedpure virtual

◆ processBufferScan()

void pappso::cbor::psm::PsmFileScanProcess::processBufferScan ( pappso::UiMonitorInterface & monitor)
protectedvirtual

Definition at line 102 of file psmfilescanprocess.cpp.

103{
104 // you decide how to process the list of scans
105 // monitor.setStatus(
106 // QObject::tr("PsmFileScanProcess::processBufferScan %1").arg(m_cborScanList.size()));
107 std::function<void(CborScanMapBase *)> mapProcessCborScan = [](CborScanMapBase *cbor_scan_p) {
108 cbor_scan_p->process();
109 };
110
111
112 QFuture<void> res = QtConcurrent::map<std::vector<CborScanMapBase *>::iterator>(
113 m_cborScanList.begin(), m_cborScanList.end(), mapProcessCborScan);
114 res.waitForFinished();
115 processBufferScanDone(monitor);
116
117 // monitor.setStatus(
118 // QObject::tr("PsmFileScanProcess::processBufferScan %1 done").arg(m_cborScanList.size()));
119}
virtual void processBufferScanDone(pappso::UiMonitorInterface &monitor)

References CborScanMapBase, m_cborScanList, and processBufferScanDone().

Referenced by sampleFinished(), pappso::cbor::psm::PsmFileScanProcessAndCopy::sampleFinished(), and scanFinished().

◆ processBufferScanDone()

void pappso::cbor::psm::PsmFileScanProcess::processBufferScanDone ( pappso::UiMonitorInterface & monitor)
protectedvirtual

Reimplemented in pappso::cbor::psm::PsmFileScanProcessAndCopy, pappso::cbor::psm::PsmSpecGlob, and pappso::cbor::psm::PsmSpecPeptidOms.

Definition at line 122 of file psmfilescanprocess.cpp.

123{
124 // you decide what to do with processed scans
125}

Referenced by processBufferScan().

◆ readScan()

void pappso::cbor::psm::PsmFileScanProcess::readScan ( pappso::UiMonitorInterface & monitor)
overrideprotectedvirtual

Reimplemented from pappso::cbor::psm::PsmFileReaderBase.

Definition at line 62 of file psmfilescanprocess.cpp.

63{
64 qDebug();
65 // auto& ref = elections.emplace_back("Nelson Mandela", "South Africa", 1994);
66 CborScanMapBase *scan_map_p = newCborScanMap();
67 m_cborScanList.push_back(scan_map_p);
68
69 if(!mpa_cborReader->readCborMap(*scan_map_p))
70 {
71 throw pappso::PappsoException(QObject::tr("readCborMap scan failed"));
72 }
73 // m_cborScanList.push_back(scan_map);
74 qDebug() << "scan end";
75 scanFinished(monitor);
76 qDebug();
77}
void scanFinished(pappso::UiMonitorInterface &monitor) override
virtual CborScanMapBase * newCborScanMap()=0

References CborScanMapBase, m_cborScanList, pappso::cbor::CborStreamReaderInterface::mpa_cborReader, newCborScanMap(), and scanFinished().

◆ sampleFinished()

void pappso::cbor::psm::PsmFileScanProcess::sampleFinished ( pappso::UiMonitorInterface & monitor)
overrideprotectedvirtual

Reimplemented from pappso::cbor::psm::PsmFileReaderBase.

Reimplemented in pappso::cbor::psm::PsmFileScanProcessAndCopy.

Definition at line 93 of file psmfilescanprocess.cpp.

94{
95 // qWarning() << "sampleFinished";
96 processBufferScan(monitor);
98}
virtual void processBufferScan(pappso::UiMonitorInterface &monitor)

References clearScanBuffer(), and processBufferScan().

◆ scanFinished()

void pappso::cbor::psm::PsmFileScanProcess::scanFinished ( pappso::UiMonitorInterface & monitor)
overrideprotectedvirtual

Reimplemented from pappso::cbor::psm::PsmFileReaderBase.

Definition at line 80 of file psmfilescanprocess.cpp.

81{
82
83 // monitor.setStatus(QObject::tr("PsmFileScanProcess::scanFinished
84 // %1").arg(m_cborScanList.size()));
86 {
87 processBufferScan(monitor);
89 }
90}

References clearScanBuffer(), m_bufferScanSize, m_cborScanList, and processBufferScan().

Referenced by readScan().

Member Data Documentation

◆ CborScanMapBase

friend pappso::cbor::psm::PsmFileScanProcess::CborScanMapBase
private

◆ m_bufferScanSize

std::size_t pappso::cbor::psm::PsmFileScanProcess::m_bufferScanSize = 1000
protected

◆ m_cborScanList

std::vector<CborScanMapBase *> pappso::cbor::psm::PsmFileScanProcess::m_cborScanList
protected

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