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

`#include <psmfileappend.h>`

Inheritance diagram for pappso::cbor::psm::PsmFileAppend:

## Classes

struct | SampleStorage

## Public Member Functions

| PsmFileAppend (pappso::cbor::CborStreamWriter *p_output)
virtual | ~PsmFileAppend ()
void | informationsReady (pappso::UiMonitorInterface &monitor) override
void | parameterMapReady (pappso::UiMonitorInterface &monitor) override
void | fastaFilesReady (pappso::UiMonitorInterface &monitor) override
void | readSample (pappso::UiMonitorInterface &monitor) override
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 | mergeParameterMap ()
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 | readScan (pappso::UiMonitorInterface &monitor)
virtual void | readPsm (pappso::UiMonitorInterface &monitor)
virtual void | psmReady (pappso::UiMonitorInterface &monitor)
virtual void | logReady (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 | scanFinished (pappso::UiMonitorInterface &monitor)
virtual void | sampleFinished (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)

## Private Attributes

QTemporaryDir * | mpa_temporaryDirectory
pappso::cbor::CborStreamWriter * | mp_output
bool | m_isInformations = false
QCborMap | m_outputParameterMap
QStringList | m_outputTargetFastaFiles
QStringList | m_outputDecoyFastaFiles
std::vector< SampleStorage > | m_sampleStorageList

## Additional Inherited Members

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 38 of file psmfileappend.h.

## Constructor & Destructor Documentation

## PsmFileAppend()

pappso::cbor::psm::PsmFileAppend::PsmFileAppend | ( | pappso::cbor::CborStreamWriter * | p_output | ) |

Default constructor

Definition at line 31 of file psmfileappend.cpp.

{
mp_output = p_output;
mp_output->startMap();
mpa_temporaryDirectory = new QTemporaryDir();
mpa_temporaryDirectory->setAutoRemove(false);
}
pappso::cbor::psm::PsmFileAppend::mp_output
pappso::cbor::CborStreamWriter * mp_output
Definition psmfileappend.h:71
pappso::cbor::psm::PsmFileAppend::mpa_temporaryDirectory
QTemporaryDir * mpa_temporaryDirectory
Definition psmfileappend.h:70

References mp_output, and mpa_temporaryDirectory.

## ~PsmFileAppend()

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

virtual

Destructor

Definition at line 41 of file psmfileappend.cpp.

{
delete mpa_temporaryDirectory;
}

References mpa_temporaryDirectory.

## Member Function Documentation

## close()

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

override virtual

convenient function to clean pointer before leaving

Reimplemented from pappso::cbor::CborStreamReaderInterface.

Definition at line 67 of file psmfileappend.cpp.

{
qDebug();
mp_output->append("parameter_map");
mp_output->writeCborMap(m_outputParameterMap);
if(!m_outputTargetFastaFiles.isEmpty())
{
mp_output->append("target_fasta_files");
mp_output->writeArray(m_outputTargetFastaFiles);
}
if(!m_outputDecoyFastaFiles.isEmpty())
{
mp_output->append("decoy_fasta_files");
mp_output->writeArray(m_outputDecoyFastaFiles);
}
mp_output->append("protein_map");
m_proteinMap.writeMap(*mp_output);
qDebug();
mp_output->append("sample_list");
mp_output->startArray();
for(auto &tmp_sample : m_sampleStorageList)
{
QFile store_sample_file(tmp_sample.temporaryFile);
store_sample_file.open(QIODevice::ReadOnly);
CborStreamReader tmp_reader(&store_sample_file);
if(tmp_reader.isTag() && tmp_reader.toTag() == QCborKnownTags::Signature)
tmp_reader.next();
QCborMap cbor_sample;
if(!tmp_reader.readCborMap(cbor_sample))
{
throw pappso::PappsoException(
QObject::tr("ERROR writing sample %1").arg(tmp_sample.fileId));
}
mp_output->writeCborMap(cbor_sample);
store_sample_file.close();
}
mp_output->endArray();
qDebug();
mp_output->endMap();
}
pappso::cbor::psm::PsmFileAppend::m_outputTargetFastaFiles
QStringList m_outputTargetFastaFiles
Definition psmfileappend.h:76
pappso::cbor::psm::PsmFileAppend::m_outputParameterMap
QCborMap m_outputParameterMap
Definition psmfileappend.h:75
pappso::cbor::psm::PsmFileAppend::m_outputDecoyFastaFiles
QStringList m_outputDecoyFastaFiles
Definition psmfileappend.h:77
pappso::cbor::psm::PsmFileAppend::m_sampleStorageList
std::vector< SampleStorage > m_sampleStorageList
Definition psmfileappend.h:78
pappso::cbor::psm::PsmFileReaderBase::m_proteinMap
PsmProteinMap m_proteinMap
Definition psmfilereaderbase.h:129

References m_outputDecoyFastaFiles, m_outputParameterMap, m_outputTargetFastaFiles, pappso::cbor::psm::PsmFileReaderBase::m_proteinMap, m_sampleStorageList, mp_output, and pappso::cbor::CborStreamReader::readCborMap().

## fastaFilesReady()

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

override virtual

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

Definition at line 129 of file psmfileappend.cpp.

{
m_outputDecoyFastaFiles = m_decoyFastaFiles;
m_outputTargetFastaFiles = m_targetFastaFiles;
}
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, m_outputDecoyFastaFiles, m_outputTargetFastaFiles, and pappso::cbor::psm::PsmFileReaderBase::m_targetFastaFiles.

## informationsReady()

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

override virtual

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

Definition at line 47 of file psmfileappend.cpp.

{
if(!m_isInformations)
{
mp_output->append("informations");
mp_output->writeCborMap(m_cborInformations);
m_isInformations = true;
}
}
pappso::cbor::psm::PsmFileAppend::m_isInformations
bool m_isInformations
Definition psmfileappend.h:73
pappso::cbor::psm::PsmFileReaderBase::m_cborInformations
QCborMap m_cborInformations
Definition psmfilereaderbase.h:133

References pappso::cbor::psm::PsmFileReaderBase::m_cborInformations, m_isInformations, and mp_output.

## mergeParameterMap()

void pappso::cbor::psm::PsmFileAppend::mergeParameterMap | ( |  | ) |

protected

Definition at line 117 of file psmfileappend.cpp.

{
for(auto cbor_key : m_cborParameterMap.keys())
{
if(!m_outputParameterMap.contains(cbor_key))
{
m_outputParameterMap.insert(cbor_key, m_cborParameterMap.value(cbor_key));
}
}
}
pappso::cbor::psm::PsmFileReaderBase::m_cborParameterMap
QCborMap m_cborParameterMap
Definition psmfilereaderbase.h:135

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

Referenced by parameterMapReady().

## parameterMapReady()

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

override virtual

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

Definition at line 59 of file psmfileappend.cpp.

{
mergeParameterMap();
}
pappso::cbor::psm::PsmFileAppend::mergeParameterMap
void mergeParameterMap()
Definition psmfileappend.cpp:117

References mergeParameterMap().

## readSample()

void pappso::cbor::psm::PsmFileAppend::readSample | ( | pappso::UiMonitorInterface & | monitor | ) |

override virtual

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

Definition at line 137 of file psmfileappend.cpp.

{
QCborMap cbor_current_sample;
mpa_cborReader->readCborMap(cbor_current_sample);
SampleStorage sample_file;
sample_file.fileId = cbor_current_sample.value("name").toString();
QString sample_name = sample_file.fileId;
auto it = std::find_if(m_sampleStorageList.begin(),
m_sampleStorageList.end(),
[sample_name](const SampleStorage &sample) {
if(sample.fileId == sample_name)
return true;
return false;
});
if(it != m_sampleStorageList.end())
{
throw pappso::PappsoException(
QObject::tr("adding the same sample twice is forbidden %1").arg(sample_name));
}
sample_file.temporaryFile =
mpa_temporaryDirectory->filePath(QString("file_%1").arg(m_sampleStorageList.size()));
m_sampleStorageList.push_back(sample_file);
QFile store_sample_file(sample_file.temporaryFile);
store_sample_file.open(QIODevice::WriteOnly);
CborStreamWriter tmp_writer(&store_sample_file);
tmp_writer.writeCborMap(cbor_current_sample);
store_sample_file.close();
}
pappso::cbor::CborStreamReaderInterface::mpa_cborReader
CborStreamReader * mpa_cborReader
Definition cborstreamreaderinterface.h:68
pappso::cbor::psm::PsmFileAppend::SampleStorage
Definition psmfileappend.h:64
pappso::cbor::psm::PsmFileAppend::SampleStorage::fileId
QString fileId
Definition psmfileappend.h:65

References pappso::cbor::psm::PsmFileAppend::SampleStorage::fileId, m_sampleStorageList, pappso::cbor::CborStreamReaderInterface::mpa_cborReader, mpa_temporaryDirectory, pappso::cbor::psm::PsmFileAppend::SampleStorage::temporaryFile, and pappso::cbor::CborStreamWriter::writeCborMap().

## Member Data Documentation

## m_isInformations

bool pappso::cbor::psm::PsmFileAppend::m_isInformations = false

private

Definition at line 73 of file psmfileappend.h.

Referenced by informationsReady().

## m_outputDecoyFastaFiles

QStringList pappso::cbor::psm::PsmFileAppend::m_outputDecoyFastaFiles

private

Definition at line 77 of file psmfileappend.h.

Referenced by close(), and fastaFilesReady().

## m_outputParameterMap

QCborMap pappso::cbor::psm::PsmFileAppend::m_outputParameterMap

private

Definition at line 75 of file psmfileappend.h.

Referenced by close(), and mergeParameterMap().

## m_outputTargetFastaFiles

QStringList pappso::cbor::psm::PsmFileAppend::m_outputTargetFastaFiles

private

Definition at line 76 of file psmfileappend.h.

Referenced by close(), and fastaFilesReady().

## m_sampleStorageList

std::vector<SampleStorage> pappso::cbor::psm::PsmFileAppend::m_sampleStorageList

private

Definition at line 78 of file psmfileappend.h.

Referenced by close(), and readSample().

## mp_output

pappso::cbor::CborStreamWriter* pappso::cbor::psm::PsmFileAppend::mp_output

private

Definition at line 71 of file psmfileappend.h.

Referenced by PsmFileAppend(), close(), and informationsReady().

## mpa_temporaryDirectory

QTemporaryDir* pappso::cbor::psm::PsmFileAppend::mpa_temporaryDirectory

private

Definition at line 70 of file psmfileappend.h.

Referenced by PsmFileAppend(), ~PsmFileAppend(), and readSample().

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

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