Loading...
Searching...
No Matches
pappso::cbor::psm::PsmCbor2Json Class Reference

`#include <psmcbor2json.h>`

Inheritance diagram for pappso::cbor::psm::PsmCbor2Json:

## Public Member Functions

| PsmCbor2Json (pappso::cbor::JsonStreamWriter *json_output_p)
virtual | ~PsmCbor2Json ()
void | close () override
| convenient function to clean pointer before leaving
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 ()

## Protected Member Functions

void | informationsReady (pappso::UiMonitorInterface &monitor) override
void | logReady (pappso::UiMonitorInterface &monitor) override
void | parameterMapReady (pappso::UiMonitorInterface &monitor) override
void | fastaFilesReady (pappso::UiMonitorInterface &monitor) override
void | sampleStarted (pappso::UiMonitorInterface &monitor) override
void | sampleFinished (pappso::UiMonitorInterface &monitor) override
void | sampleListStarted (pappso::UiMonitorInterface &monitor) override
void | sampleListFinished (pappso::UiMonitorInterface &monitor) override
void | scanStarted (pappso::UiMonitorInterface &monitor) override
void | scanFinished (pappso::UiMonitorInterface &monitor) override
void | psmReady (pappso::UiMonitorInterface &monitor) override
void | readProteinMap (pappso::UiMonitorInterface &monitor) override
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 | readSample (pappso::UiMonitorInterface &monitor)
virtual void | readScan (pappso::UiMonitorInterface &monitor)
virtual void | readPsm (pappso::UiMonitorInterface &monitor)
virtual void | proteinMapReady (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

pappso::cbor::JsonStreamWriter * | mp_jsonOutput
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< PsmFile > | m_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< PsmProteinRef > | m_currentPsmProteinRefList
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 41 of file psmcbor2json.h.

## Constructor & Destructor Documentation

## PsmCbor2Json()

pappso::cbor::psm::PsmCbor2Json::PsmCbor2Json | ( | pappso::cbor::JsonStreamWriter * | json_output_p | ) |

Default constructor

Definition at line 35 of file psmcbor2json.cpp.

{
mp_jsonOutput = json_output_p;
*mp_jsonOutput << "{" << Qt::endl;
}
pappso::cbor::psm::PsmCbor2Json::mp_jsonOutput
pappso::cbor::JsonStreamWriter * mp_jsonOutput
Definition psmcbor2json.h:78

References mp_jsonOutput.

## ~PsmCbor2Json()

pappso::cbor::psm::PsmCbor2Json::~PsmCbor2Json | ( |  | ) |

virtual

Destructor

Definition at line 43 of file psmcbor2json.cpp.

{
}

## Member Function Documentation

## close()

void pappso::cbor::psm::PsmCbor2Json::close | ( |  | ) |

override virtual

convenient function to clean pointer before leaving

Reimplemented from pappso::cbor::CborStreamReaderInterface.

Definition at line 48 of file psmcbor2json.cpp.

{
mp_jsonOutput->endMap();
}

References mp_jsonOutput.

## fastaFilesReady()

void pappso::cbor::psm::PsmCbor2Json::fastaFilesReady | ( | pappso::UiMonitorInterface & | monitor | ) |

override protected virtual

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

Definition at line 55 of file psmcbor2json.cpp.

{
if(!m_targetFastaFiles.isEmpty())
{
mp_jsonOutput->appendKey("target_fasta_files");
mp_jsonOutput->writeArray(m_targetFastaFiles);
}
if(!m_decoyFastaFiles.isEmpty())
{
mp_jsonOutput->appendKey("decoy_fasta_files");
mp_jsonOutput->writeArray(m_decoyFastaFiles);
}
}
pappso::cbor::psm::PsmFileReaderBase::m_targetFastaFiles
QStringList m_targetFastaFiles
Definition psmfilereaderbase.h:127
pappso::cbor::psm::PsmFileReaderBase::m_decoyFastaFiles
QStringList m_decoyFastaFiles
Definition psmfilereaderbase.h:128

References pappso::cbor::psm::PsmFileReaderBase::m_decoyFastaFiles, pappso::cbor::psm::PsmFileReaderBase::m_targetFastaFiles, and mp_jsonOutput.

## informationsReady()

void pappso::cbor::psm::PsmCbor2Json::informationsReady | ( | pappso::UiMonitorInterface & | monitor | ) |

override protected virtual

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

Definition at line 71 of file psmcbor2json.cpp.

{
mp_jsonOutput->appendKey("informations");
mp_jsonOutput->writeCborMap(m_cborInformations);
}
pappso::cbor::psm::PsmFileReaderBase::m_cborInformations
QCborMap m_cborInformations
Definition psmfilereaderbase.h:133

References pappso::cbor::psm::PsmFileReaderBase::m_cborInformations, and mp_jsonOutput.

## logReady()

void pappso::cbor::psm::PsmCbor2Json::logReady | ( | pappso::UiMonitorInterface & | monitor | ) |

override protected virtual

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

Definition at line 80 of file psmcbor2json.cpp.

{
mp_jsonOutput->appendKey("log");
mp_jsonOutput->writeCborArray(m_cborLog);
}
pappso::cbor::psm::PsmFileReaderBase::m_cborLog
QCborArray m_cborLog
Definition psmfilereaderbase.h:134

References pappso::cbor::psm::PsmFileReaderBase::m_cborLog, and mp_jsonOutput.

## parameterMapReady()

void pappso::cbor::psm::PsmCbor2Json::parameterMapReady | ( | pappso::UiMonitorInterface & | monitor | ) |

override protected virtual

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

Definition at line 88 of file psmcbor2json.cpp.

{
mp_jsonOutput->appendKey("parameter_map");
mp_jsonOutput->writeCborMap(m_cborParameterMap);
}
pappso::cbor::psm::PsmFileReaderBase::m_cborParameterMap
QCborMap m_cborParameterMap
Definition psmfilereaderbase.h:135

References pappso::cbor::psm::PsmFileReaderBase::m_cborParameterMap, and mp_jsonOutput.

## psmReady()

void pappso::cbor::psm::PsmCbor2Json::psmReady | ( | pappso::UiMonitorInterface & | monitor | ) |

override protected virtual

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

Definition at line 206 of file psmcbor2json.cpp.

{
mp_jsonOutput->startMap(); // psm
mp_jsonOutput->appendKey("proforma");
mp_jsonOutput->appendValue(m_currentPsmProforma);
mp_jsonOutput->appendKey("protein_list");
mp_jsonOutput->startArray();
for(auto &protein_ref : m_currentPsmProteinRefList)
{
mp_jsonOutput->startMap();
mp_jsonOutput->appendKey("accession");
mp_jsonOutput->appendValue(protein_ref.accession);
mp_jsonOutput->appendKey("positions");
mp_jsonOutput->startArray();
for(auto position : protein_ref.positions)
{
mp_jsonOutput->appendValue(position);
}
mp_jsonOutput->endArray();
mp_jsonOutput->endMap();
}
mp_jsonOutput->endArray();
if(!m_cborScanPsmProps.isEmpty())
{
mp_jsonOutput->appendKey("props");
mp_jsonOutput->writeCborMap(m_cborScanPsmProps);
}
mp_jsonOutput->appendKey("eval");
mp_jsonOutput->writeCborMap(m_cborScanPsmEval);
mp_jsonOutput->endMap(); // psm
}
pappso::cbor::psm::PsmFileReaderBase::m_currentPsmProteinRefList
std::vector< PsmProteinRef > m_currentPsmProteinRefList
Definition psmfilereaderbase.h:143
pappso::cbor::psm::PsmFileReaderBase::m_cborScanPsmProps
QCborMap m_cborScanPsmProps
Definition psmfilereaderbase.h:141
pappso::cbor::psm::PsmFileReaderBase::m_currentPsmProforma
QString m_currentPsmProforma
Definition psmfilereaderbase.h:142
pappso::cbor::psm::PsmFileReaderBase::m_cborScanPsmEval
QCborMap m_cborScanPsmEval
Definition psmfilereaderbase.h:140

References pappso::cbor::psm::PsmFileReaderBase::m_cborScanPsmEval, pappso::cbor::psm::PsmFileReaderBase::m_cborScanPsmProps, pappso::cbor::psm::PsmFileReaderBase::m_currentPsmProforma, pappso::cbor::psm::PsmFileReaderBase::m_currentPsmProteinRefList, and mp_jsonOutput.

## readProteinMap()

void pappso::cbor::psm::PsmCbor2Json::readProteinMap | ( | pappso::UiMonitorInterface & | monitor | ) |

override protected virtual

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

Definition at line 113 of file psmcbor2json.cpp.

{
mp_jsonOutput->appendKey("protein_map");
mp_jsonOutput->startMap();
if(!mpa_cborReader->enterContainer())
{
throw pappso::PappsoException(QObject::tr("enterContainer in protein map failed"));
}
QString accession;
while(!mpa_cborReader->lastError() && mpa_cborReader->hasNext())
{
mpa_cborReader->decodeString(accession);
mp_jsonOutput->appendKey(accession);
QCborMap cbor_protein;
mpa_cborReader->readCborMap(cbor_protein);
mp_jsonOutput->writeCborMap(cbor_protein);
}
mpa_cborReader->leaveContainer();
mp_jsonOutput->endMap();
}
pappso::cbor::CborStreamReaderInterface::mpa_cborReader
CborStreamReader * mpa_cborReader
Definition cborstreamreaderinterface.h:68

References mp_jsonOutput, and pappso::cbor::CborStreamReaderInterface::mpa_cborReader.

## sampleFinished()

void pappso::cbor::psm::PsmCbor2Json::sampleFinished | ( | pappso::UiMonitorInterface & | monitor | ) |

override protected virtual

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

Definition at line 198 of file psmcbor2json.cpp.

{
mp_jsonOutput->endArray(); // scan_list
mp_jsonOutput->endMap(); // sample
}

References mp_jsonOutput.

## sampleListFinished()

void pappso::cbor::psm::PsmCbor2Json::sampleListFinished | ( | pappso::UiMonitorInterface & | monitor | ) |

override protected virtual

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

Definition at line 105 of file psmcbor2json.cpp.

{
mp_jsonOutput->endArray();
}

References mp_jsonOutput.

## sampleListStarted()

void pappso::cbor::psm::PsmCbor2Json::sampleListStarted | ( | pappso::UiMonitorInterface & | monitor | ) |

override protected virtual

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

Definition at line 96 of file psmcbor2json.cpp.

{
mp_jsonOutput->appendKey("sample_list");
mp_jsonOutput->startArray();
}

References mp_jsonOutput.

## sampleStarted()

void pappso::cbor::psm::PsmCbor2Json::sampleStarted | ( | pappso::UiMonitorInterface & | monitor | ) |

override protected virtual

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

Definition at line 166 of file psmcbor2json.cpp.

{
//"name": "tandem2017_nopatch_20120906_balliau_extract_1_A01_urnb-1",
qDebug();
mp_jsonOutput->startMap(); // sample
mp_jsonOutput->appendKey("name");
mp_jsonOutput->appendValue(m_currentSampleName);
mp_jsonOutput->appendKey("identification_file_list");
mp_jsonOutput->startArray();
for(auto &identification_file : m_currentIdentificationFileList)
{
mp_jsonOutput->startMap();
mp_jsonOutput->appendKey("name");
mp_jsonOutput->appendValue(identification_file.name);
mp_jsonOutput->endMap();
}
mp_jsonOutput->endArray();
mp_jsonOutput->appendKey("peaklist_file");
mp_jsonOutput->startMap();
mp_jsonOutput->appendKey("name");
mp_jsonOutput->appendValue(m_currentPeaklistFile.name);
mp_jsonOutput->endMap();
mp_jsonOutput->appendKey("scan_list");
mp_jsonOutput->startArray();
}
pappso::cbor::psm::PsmFileReaderBase::m_currentPeaklistFile
PsmFile m_currentPeaklistFile
Definition psmfilereaderbase.h:131
pappso::cbor::psm::PsmFileReaderBase::m_currentSampleName
QString m_currentSampleName
Definition psmfilereaderbase.h:130
pappso::cbor::psm::PsmFileReaderBase::m_currentIdentificationFileList
std::vector< PsmFile > m_currentIdentificationFileList
Definition psmfilereaderbase.h:132

References pappso::cbor::psm::PsmFileReaderBase::m_currentIdentificationFileList, pappso::cbor::psm::PsmFileReaderBase::m_currentPeaklistFile, pappso::cbor::psm::PsmFileReaderBase::m_currentSampleName, and mp_jsonOutput.

## scanFinished()

void pappso::cbor::psm::PsmCbor2Json::scanFinished | ( | pappso::UiMonitorInterface & | monitor | ) |

override protected virtual

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

Definition at line 158 of file psmcbor2json.cpp.

{
mp_jsonOutput->endArray(); // psm_list
mp_jsonOutput->endMap(); // scan
}

References mp_jsonOutput.

## scanStarted()

void pappso::cbor::psm::PsmCbor2Json::scanStarted | ( | pappso::UiMonitorInterface & | monitor | ) |

override protected virtual

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

Definition at line 138 of file psmcbor2json.cpp.

{
mp_jsonOutput->startMap();
mp_jsonOutput->appendKey("id");
mp_jsonOutput->writeCborMap(m_cborScanId);
mp_jsonOutput->appendKey("precursor");
mp_jsonOutput->writeCborMap(m_cborScanPrecursor);
mp_jsonOutput->appendKey("ms2");
mp_jsonOutput->writeCborMap(m_cborScanMs2);
if(!m_cborScanProps.isEmpty())
{
mp_jsonOutput->appendKey("props");
mp_jsonOutput->writeCborMap(m_cborScanProps);
};
mp_jsonOutput->appendKey("psm_list");
mp_jsonOutput->startArray();
}
pappso::cbor::psm::PsmFileReaderBase::m_cborScanProps
QCborMap m_cborScanProps
Definition psmfilereaderbase.h:139
pappso::cbor::psm::PsmFileReaderBase::m_cborScanPrecursor
QCborMap m_cborScanPrecursor
Definition psmfilereaderbase.h:137
pappso::cbor::psm::PsmFileReaderBase::m_cborScanId
QCborMap m_cborScanId
Definition psmfilereaderbase.h:136
pappso::cbor::psm::PsmFileReaderBase::m_cborScanMs2
QCborMap m_cborScanMs2
Definition psmfilereaderbase.h:138

References pappso::cbor::psm::PsmFileReaderBase::m_cborScanId, pappso::cbor::psm::PsmFileReaderBase::m_cborScanMs2, pappso::cbor::psm::PsmFileReaderBase::m_cborScanPrecursor, pappso::cbor::psm::PsmFileReaderBase::m_cborScanProps, and mp_jsonOutput.

## Member Data Documentation

## mp_jsonOutput

pappso::cbor::JsonStreamWriter* pappso::cbor::psm::PsmCbor2Json::mp_jsonOutput

protected

Definition at line 78 of file psmcbor2json.h.

Referenced by PsmCbor2Json(), close(), fastaFilesReady(), informationsReady(), logReady(), parameterMapReady(), psmReady(), readProteinMap(), sampleFinished(), sampleListFinished(), sampleListStarted(), sampleStarted(), scanFinished(), and scanStarted().

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

- pappsomspp/core/processing/cbor/psm/psmcbor2json.h
- pappsomspp/core/processing/cbor/psm/psmcbor2json.cpp