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

`#include <mzidentmlreader.h>`

Inheritance diagram for pappso::cbor::psm::MzIdentMlReader:

## Classes

struct | CvParam
struct | Modification
struct | MzidDBSequence
struct | MzidSearchDatabase
struct | MzidSpectraData
struct | MzidPeptideEvidence
struct | UserParam
struct | SpectrumIdentificationItem
struct | SpectrumIdentificationResult

## Public Member Functions

| MzIdentMlReader (pappso::UiMonitorInterface *p_monitor, pappso::cbor::CborStreamWriter *p_output, const QFileInfo &mzident_file)
virtual | ~MzIdentMlReader ()
Public Member Functions inherited from pappso::XmlStreamReaderInterface
| XmlStreamReaderInterface ()
virtual | ~XmlStreamReaderInterface ()
virtual bool | readFile (const QString &fileName)
bool | read (QIODevice *device)
bool | read (const QString &xml_content)
QString | errorString () const

## Protected Member Functions

virtual void | readStream () override
Protected Member Functions inherited from pappso::XmlStreamReaderInterface
void | cloneStartElement (QXmlStreamWriter &output) const
void | cloneElement (QXmlStreamWriter &output)
void | cloneNode (QXmlStreamWriter &output)

## Private Types

enum class | IdentificationEngine : std::int8_t { unknown = 0 , XTandem = 1 , mascot = 2 , peptider = 3 , OMSSA = 4 , SEQUEST = 5 , Comet = 6 , Morpheus = 7 , MSGFplus = 8 , SpecOMS = 9 , sage = 10 , PEAKS_Studio = 11 }

## Private Member Functions

bool | readAnalysisSoftware ()
bool | readSequenceCollectionItem ()
bool | readAnalysisCollectionItem ()
bool | readDataCollectionItem ()
void | readDBSequence ()
void | readPeptide ()
bool | readPeptideEvidence ()
void | readSpectrumIdentification ()
void | readInputs ()
void | readAnalysisData ()
bool | readSearchDatabase ()
void | readSpectraData ()
void | readSpectrumIdentificationResult ()
void | readAnalysisProtocolCollection ()
void | finalDebrief ()
CvParam | readCvParam ()
UserParam | readUserParam ()
void | readSpectrumIdentificationItem (SpectrumIdentificationResult &spectrum_identification_result)
void | writeSpectrumIdentificationResult (const SpectrumIdentificationResult &spectrum_identificatio_result)
bool | writeTandemEval (const std::vector< CvParam > &cv_param_list)
void | writeSpectrumIdentificationItem (const SpectrumIdentificationItem &spectrum_identification_item)

## Private Attributes

pappso::UiMonitorInterface * | mp_monitor
IdentificationEngine | m_identificationEngine
QString | m_analysisSoftwareVersion
pappso::cbor::CborStreamWriter * | mp_cborWriter
PsmProteinMap | m_proteinMap
std::map< QString, IdentificationEngine > | m_IdentificationEngineMap
| store association between xml ID and an identification engine
std::map< QString, MzidSearchDatabase > | m_mzidSearchDatabaseIdMap
| store association between xml ID and fasta files
std::map< QString, PeptideSp > | m_PeptideIdMap
| store association between xml ID and peptide sequence
std::map< QString, MzidPeptideEvidence > | m_MzidPeptideEvidenceIdMap
| store association between xml ID and peptide evidence
std::map< QString, MzidSpectraData > | m_mzidSpectraDataIdMap
| store association between xml ID and SpectraData
std::map< QString, MzidDBSequence > | m_MzidDBSequenceIdMap
| store association between xml ID and DBSequence
std::map< QString, std::vector< ProteinSp > > | m_searchDatabase_ref2proteinList
| associates database ref id to protein shared pointer because the search database id is not described before the protein (silly idea IMHO) we keep association of protein to database in this map until the real search database definition appears We then have to reprocess each protein to set the right fasta file pointer
std::map< QString, std::vector< SpectrumIdentificationResult > > | m_spectrumIdentificationResultBySpectraIdMap
| store all identification results by spectra xml id
QFileInfo | m_mzidentFile
QCborMap | m_cborParameterMap

## Additional Inherited Members

Protected Attributes inherited from pappso::XmlStreamReaderInterface
QXmlStreamReader | m_qxmlStreamReader

## Detailed Description

Todo
  write docs

Definition at line 50 of file mzidentmlreader.h.

## Member Enumeration Documentation

## IdentificationEngine

enum class pappso::cbor::psm::MzIdentMlReader::IdentificationEngine : std::int8_t

strong private

Enumerator
unknown | X!Tandem.
XTandem | MS:1001476 X!Tandem was used to analyze the spectra.
mascot | MS:1001207 The name of the Mascot search engine.
peptider | peptider
OMSSA | MS:1001475 Open Mass Spectrometry Search Algorithm was used to analyze the spectra.
SEQUEST | MS:1001208 The name of the SEQUEST search engine.
Comet | MS:1002251 Comet open-source sequence search engine developed at the University of Washington. PMID:23148064
Morpheus | MS:1002661 "Morpheus search engine." [PMID:23323968].
MSGFplus | MS:1002048 "MS-GF+ software used to analyze the spectra." [PSI:PI].
SpecOMS | SpecOMS C++ implementation.
sage | sage
PEAKS_Studio | PEAKS Studio.

Definition at line 91 of file mzidentmlreader.h.

{
unknown = 0, ///< X!Tandem
XTandem = 1, ///< MS:1001476 X!Tandem was used to analyze the spectra.
mascot = 2, ///< MS:1001207 The name of the Mascot search engine.
peptider = 3, ///< peptider
OMSSA = 4, ///< MS:1001475 Open Mass Spectrometry Search Algorithm was used to
///< analyze the spectra.
SEQUEST = 5, ///< MS:1001208 The name of the SEQUEST search engine.
Comet = 6, ///< MS:1002251 Comet open-source sequence search engine developed
///< at the University of Washington. PMID:23148064
Morpheus = 7, ///< MS:1002661 "Morpheus search engine." [PMID:23323968]
MSGFplus = 8, ///< MS:1002048 "MS-GF+ software used to analyze the spectra." [PSI:PI]
SpecOMS = 9, ///< SpecOMS C++ implementation
sage = 10, ///< sage
PEAKS_Studio = 11, ///< PEAKS Studio
};
pappso::Enums::MsDataFormat::unknown
@ unknown
unknown format
Definition types.h:149

## Constructor & Destructor Documentation

## MzIdentMlReader()

pappso::cbor::psm::MzIdentMlReader::MzIdentMlReader | ( | pappso::UiMonitorInterface * | p_monitor,
|  | pappso::cbor::CborStreamWriter * | p_output,
|  | const QFileInfo & | mzident_file )

Default constructor

Definition at line 62 of file mzidentmlreader.cpp.

{
mp_monitor = p_monitor;
qDebug() << mzident_file.absoluteFilePath() << "'";
m_identificationEngine = IdentificationEngine::unknown;
m_mzidentFile = mzident_file;
try
{
mp_cborWriter = p_output;
mp_cborWriter->startMap();
mp_cborWriter->writeInformations(
"mzidentml_file_reader", Utils::getVersion(), "psm", "mzidentml reader");
if(!readFile(mzident_file.absoluteFilePath()))
{
if(errorString() == "Not an MzIdentML file")
{
throw pappso::ExceptionNotRecognized(
QObject::tr("Error reading %1 not mzIdentML file :\n %2")
.arg(mzident_file.absoluteFilePath())
.arg(errorString()));
}
else
{
throw pappso::PappsoException(QObject::tr("Error reading %1 mzIdentML file :\n %2")
.arg(mzident_file.absoluteFilePath())
.arg(errorString()));
}
}
mp_cborWriter->endMap();
}
catch(pappso::ExceptionNotRecognized &err)
{
throw err;
}
catch(pappso::PappsoException &other_err)
{
throw pappso::PappsoException(QObject::tr("Error reading mzIdentML file %1:\n%2")
.arg(mzident_file.absoluteFilePath())
.arg(other_err.qwhat()));
}
}
pappso::PappsoException::qwhat
virtual const QString & qwhat() const
Definition pappsoexception.h:66
pappso::Utils::getVersion
static QString getVersion()
Definition utils.cpp:650
pappso::XmlStreamReaderInterface::errorString
QString errorString() const
Definition xmlstreamreaderinterface.cpp:46
pappso::XmlStreamReaderInterface::readFile
virtual bool readFile(const QString &fileName)
Definition xmlstreamreaderinterface.cpp:61
pappso::cbor::psm::MzIdentMlReader::mp_cborWriter
pappso::cbor::CborStreamWriter * mp_cborWriter
Definition mzidentmlreader.h:222
pappso::cbor::psm::MzIdentMlReader::m_identificationEngine
IdentificationEngine m_identificationEngine
Definition mzidentmlreader.h:220
pappso::cbor::psm::MzIdentMlReader::IdentificationEngine::unknown
@ unknown
X!Tandem.
Definition mzidentmlreader.h:93
pappso::cbor::psm::MzIdentMlReader::mp_monitor
pappso::UiMonitorInterface * mp_monitor
Definition mzidentmlreader.h:218
pappso::cbor::psm::MzIdentMlReader::m_mzidentFile
QFileInfo m_mzidentFile
Definition mzidentmlreader.h:268

References pappso::XmlStreamReaderInterface::errorString(), pappso::Utils::getVersion(), m_identificationEngine, m_mzidentFile, mp_cborWriter, mp_monitor, pappso::PappsoException::qwhat(), pappso::XmlStreamReaderInterface::readFile(), and unknown.

## ~MzIdentMlReader()

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

virtual

Destructor

Definition at line 116 of file mzidentmlreader.cpp.

{
}

## Member Function Documentation

## finalDebrief()

void pappso::cbor::psm::MzIdentMlReader::finalDebrief | ( |  | ) |

private

Definition at line 122 of file mzidentmlreader.cpp.

{
qDebug();
mp_cborWriter->append("parameter_map");
mp_cborWriter->writeCborMap(m_cborParameterMap);
QStringList fasta_files;
for(auto &pair_searchdb : m_mzidSearchDatabaseIdMap)
{
fasta_files << pair_searchdb.second.file;
}
mp_cborWriter->append("target_fasta_files");
mp_cborWriter->writeArray(fasta_files);
for(std::pair<const QString, MzidDBSequence> &pair_sequence : m_MzidDBSequenceIdMap)
{
PsmProtein psm_protein;
psm_protein.isContaminant = false;
psm_protein.isTarget = !pair_sequence.second.is_decoy;
psm_protein.protein_sp = pair_sequence.second.protein_sp;
m_proteinMap.insert(psm_protein);
}
mp_cborWriter->append(QString("protein_map"));
m_proteinMap.writeMap(*mp_cborWriter);
mp_cborWriter->append("sample_list");
mp_cborWriter->startArray();
for(std::pair<const QString, std::vector<SpectrumIdentificationResult>> &pair_spectra :
m_spectrumIdentificationResultBySpectraIdMap)
{
mp_cborWriter->startMap();
mp_cborWriter->append("name");
mp_cborWriter->append(m_mzidSpectraDataIdMap.at(pair_spectra.first).name);
mp_cborWriter->append("identification_file_list");
mp_cborWriter->startMap();
mp_cborWriter->append("name");
mp_cborWriter->append(m_mzidentFile.absoluteFilePath());
mp_cborWriter->endMap();
// one_sample.cbor_core_sample.value("identification_file_list")
// .toCbor(m_sageReader.getCborStreamWriter());
mp_cborWriter->append("peaklist_file");
mp_cborWriter->startMap();
mp_cborWriter->append("name");
mp_cborWriter->append(m_mzidSpectraDataIdMap.at(pair_spectra.first).file);
mp_cborWriter->endMap();
//"scan_list": [
mp_cborWriter->append("scan_list");
mp_cborWriter->startArray(pair_spectra.second.size());
for(SpectrumIdentificationResult &it_spectrum_ident : pair_spectra.second)
{
writeSpectrumIdentificationResult(it_spectrum_ident);
}
mp_cborWriter->endArray();
mp_cborWriter->endMap();
}
mp_cborWriter->endArray();
qDebug();
}
pappso::cbor::psm::MzIdentMlReader::m_proteinMap
PsmProteinMap m_proteinMap
Definition mzidentmlreader.h:223
pappso::cbor::psm::MzIdentMlReader::m_cborParameterMap
QCborMap m_cborParameterMap
Definition mzidentmlreader.h:269
pappso::cbor::psm::MzIdentMlReader::writeSpectrumIdentificationResult
void writeSpectrumIdentificationResult(const SpectrumIdentificationResult &spectrum_identificatio_result)
Definition mzidentmlreader.cpp:1450
pappso::cbor::psm::MzIdentMlReader::m_mzidSpectraDataIdMap
std::map< QString, MzidSpectraData > m_mzidSpectraDataIdMap
store association between xml ID and SpectraData
Definition mzidentmlreader.h:248
pappso::cbor::psm::MzIdentMlReader::m_mzidSearchDatabaseIdMap
std::map< QString, MzidSearchDatabase > m_mzidSearchDatabaseIdMap
store association between xml ID and fasta files
Definition mzidentmlreader.h:233
pappso::cbor::psm::MzIdentMlReader::m_spectrumIdentificationResultBySpectraIdMap
std::map< QString, std::vector< SpectrumIdentificationResult > > m_spectrumIdentificationResultBySpectraIdMap
store all identification results by spectra xml id
Definition mzidentmlreader.h:266
pappso::cbor::psm::MzIdentMlReader::m_MzidDBSequenceIdMap
std::map< QString, MzidDBSequence > m_MzidDBSequenceIdMap
store association between xml ID and DBSequence
Definition mzidentmlreader.h:252
pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult
Definition mzidentmlreader.h:180

References pappso::cbor::psm::PsmProtein::isContaminant, pappso::cbor::psm::PsmProtein::isTarget, m_cborParameterMap, m_MzidDBSequenceIdMap, m_mzidentFile, m_mzidSearchDatabaseIdMap, m_mzidSpectraDataIdMap, m_proteinMap, m_spectrumIdentificationResultBySpectraIdMap, mp_cborWriter, pappso::cbor::psm::PsmProtein::protein_sp, and writeSpectrumIdentificationResult().

Referenced by readAnalysisData().

## readAnalysisCollectionItem()

bool pappso::cbor::psm::MzIdentMlReader::readAnalysisCollectionItem | ( |  | ) |

private

Definition at line 817 of file mzidentmlreader.cpp.

{
qDebug();
if(m_qxmlStreamReader.readNextStartElement())
{
if(m_qxmlStreamReader.name().toString() == "SpectrumIdentification")
{
readSpectrumIdentification();
qDebug();
}
else if(m_qxmlStreamReader.name().toString() == "ProteinDetection")
{
m_qxmlStreamReader.skipCurrentElement();
}
else
{
m_qxmlStreamReader.raiseError(
QObject::tr("Error in MzIdentML/AnalysisCollection, unexpected %1 t")
.arg(m_qxmlStreamReader.name()));
m_qxmlStreamReader.skipCurrentElement();
return false;
}
return true;
}
return false;
}
pappso::XmlStreamReaderInterface::m_qxmlStreamReader
QXmlStreamReader m_qxmlStreamReader
Definition xmlstreamreaderinterface.h:71
pappso::cbor::psm::MzIdentMlReader::readSpectrumIdentification
void readSpectrumIdentification()
Definition mzidentmlreader.cpp:846

References pappso::XmlStreamReaderInterface::m_qxmlStreamReader, and readSpectrumIdentification().

Referenced by readStream().

## readAnalysisData()

void pappso::cbor::psm::MzIdentMlReader::readAnalysisData | ( |  | ) |

private

Definition at line 981 of file mzidentmlreader.cpp.

{
qDebug() << m_qxmlStreamReader.name();
while(m_qxmlStreamReader.readNextStartElement())
{
qDebug() << m_qxmlStreamReader.name();
if(m_qxmlStreamReader.name().toString() == "SpectrumIdentificationList")
{
while(m_qxmlStreamReader.readNextStartElement())
{
qDebug() << m_qxmlStreamReader.name();
if(m_qxmlStreamReader.name().toString() == "SpectrumIdentificationResult")
{
readSpectrumIdentificationResult();
}
else if(m_qxmlStreamReader.name().toString() == "FragmentationTable")
{
m_qxmlStreamReader.skipCurrentElement();
}
else
{
m_qxmlStreamReader.raiseError(
QObject::tr("Error in "
"MzIdentML/DataCollection/AnalysisData/"
"SpectrumIdentificationList, unexpected %1 tag")
.arg(m_qxmlStreamReader.name()));
m_qxmlStreamReader.skipCurrentElement();
}
}
}
else if(m_qxmlStreamReader.name().toString() == "ProteinDetectionList")
{
// ProteinDetectionList
m_qxmlStreamReader.skipCurrentElement();
}
else
{
m_qxmlStreamReader.raiseError(
QObject::tr("Error in MzIdentML/DataCollection/AnalysisData, "
"unexpected %1 tag")
.arg(m_qxmlStreamReader.name()));
m_qxmlStreamReader.skipCurrentElement();
}
}
qDebug();
finalDebrief();
}
pappso::cbor::psm::MzIdentMlReader::readSpectrumIdentificationResult
void readSpectrumIdentificationResult()
Definition mzidentmlreader.cpp:1031
pappso::cbor::psm::MzIdentMlReader::finalDebrief
void finalDebrief()
Definition mzidentmlreader.cpp:122

References finalDebrief(), pappso::XmlStreamReaderInterface::m_qxmlStreamReader, and readSpectrumIdentificationResult().

Referenced by readDataCollectionItem().

## readAnalysisProtocolCollection()

void pappso::cbor::psm::MzIdentMlReader::readAnalysisProtocolCollection | ( |  | ) |

private

Definition at line 276 of file mzidentmlreader.cpp.

{
//<AnalysisProtocolCollection>
qDebug();
while(m_qxmlStreamReader.readNextStartElement())
{
qDebug() << m_qxmlStreamReader.name();
if(m_qxmlStreamReader.name().toString() == "SpectrumIdentificationProtocol")
{
auto it_soft = m_IdentificationEngineMap.find(
m_qxmlStreamReader.attributes().value("analysisSoftware_ref").toString());
if(it_soft != m_IdentificationEngineMap.end())
{
IdentificationEngine identification_engine = it_soft->second;
if(identification_engine == IdentificationEngine::XTandem)
{
//<SpectrumIdentificationProtocol analysisSoftware_ref="ID_software"
// id="SearchProtocol_1">
QCborMap identification_engine_parameters;
while(m_qxmlStreamReader.readNextStartElement())
{
if(m_qxmlStreamReader.name().toString() == "SearchType")
{
m_qxmlStreamReader.skipCurrentElement();
}
else if(m_qxmlStreamReader.name().toString() == "ModificationParams")
{
m_qxmlStreamReader.skipCurrentElement();
}
else if(m_qxmlStreamReader.name().toString() == "Threshold")
{
m_qxmlStreamReader.skipCurrentElement();
}
else if(m_qxmlStreamReader.name().toString() == "ParentTolerance")
{
m_qxmlStreamReader.skipCurrentElement();
}
else if(m_qxmlStreamReader.name().toString() == "FragmentTolerance")
{
m_qxmlStreamReader.skipCurrentElement();
}
else if(m_qxmlStreamReader.name().toString() == "Enzymes")
{
m_qxmlStreamReader.skipCurrentElement();
}
else if(m_qxmlStreamReader.name().toString() == "AdditionalSearchParams")
{
while(m_qxmlStreamReader.readNextStartElement())
{
if(m_qxmlStreamReader.name().toString() == "userParam")
{
//<userParam name="list path, default parameters"
// value="/tmp/i2masschroq.ubFSuT/QExactive_analysis_FDR_nosemi.xml"/>
identification_engine_parameters.insert(
m_qxmlStreamReader.attributes().value("name").toString(),
m_qxmlStreamReader.attributes().value("value").toString());
m_qxmlStreamReader.skipCurrentElement();
}
else
{
m_qxmlStreamReader.skipCurrentElement();
}
}
}
else
{
m_qxmlStreamReader.raiseError(QObject::tr("element %1 not implemented")
.arg(m_qxmlStreamReader.name()));
m_qxmlStreamReader.skipCurrentElement();
}
}
m_cborParameterMap.insert(QString("xtandem"),
identification_engine_parameters.toCborValue());
// qWarning() << "coucou";
}
else
{
// other than tandem
m_qxmlStreamReader.skipCurrentElement();
}
}
else
{
m_qxmlStreamReader.skipCurrentElement();
}
}
else
{
m_qxmlStreamReader.raiseError(
QObject::tr("element %1 not implemented").arg(m_qxmlStreamReader.name()));
m_qxmlStreamReader.skipCurrentElement();
}
}
qDebug();
}
pappso::cbor::psm::MzIdentMlReader::IdentificationEngine
IdentificationEngine
Definition mzidentmlreader.h:92
pappso::cbor::psm::MzIdentMlReader::IdentificationEngine::XTandem
@ XTandem
MS:1001476 X!Tandem was used to analyze the spectra.
Definition mzidentmlreader.h:94
pappso::cbor::psm::MzIdentMlReader::m_IdentificationEngineMap
std::map< QString, IdentificationEngine > m_IdentificationEngineMap
store association between xml ID and an identification engine
Definition mzidentmlreader.h:228

References m_cborParameterMap, m_IdentificationEngineMap, pappso::XmlStreamReaderInterface::m_qxmlStreamReader, and XTandem.

Referenced by readStream().

## readAnalysisSoftware()

bool pappso::cbor::psm::MzIdentMlReader::readAnalysisSoftware | ( |  | ) |

private

stores the current analysis software id

tells if the software name has been found and is handled by the parser

Definition at line 379 of file mzidentmlreader.cpp.

{
/** @brief stores the current analysis software id
*/
QString analysisSoftwareId;
/** @brief tells if the software name has been found and is handled by the
* parser
*/
IdentificationEngine analysisSotwareNameFound = IdentificationEngine::unknown;
if(m_qxmlStreamReader.readNextStartElement())
{
if(m_qxmlStreamReader.name().toString() == "AnalysisSoftware")
{
// <AnalysisSoftware version="0.0.9" name="DeepProt" id="as1">
analysisSoftwareId = m_qxmlStreamReader.attributes().value("id").toString();
QString software_name = m_qxmlStreamReader.attributes().value("name").toString();
m_analysisSoftwareVersion = m_qxmlStreamReader.attributes().value("version").toString();
if(software_name == "SpecOMS")
{
analysisSotwareNameFound = IdentificationEngine::SpecOMS;
m_qxmlStreamReader.skipCurrentElement();
}
else if(software_name == "DeepProt")
{
analysisSotwareNameFound = IdentificationEngine::SpecOMS;
m_qxmlStreamReader.skipCurrentElement();
}
else
{
while(m_qxmlStreamReader.readNextStartElement())
{
if(m_qxmlStreamReader.name().toString() == "SoftwareName")
{
while(m_qxmlStreamReader.readNextStartElement())
{
if(m_qxmlStreamReader.name().toString() == "cvParam")
{
CvParam cv_param = readCvParam();
if(cv_param.accession == "MS:1001476")
{
analysisSotwareNameFound = IdentificationEngine::XTandem;
}
else if(cv_param.accession == "MS:1002048")
{
analysisSotwareNameFound = IdentificationEngine::MSGFplus;
}
else if(cv_param.accession == "MS:1001946")
{
analysisSotwareNameFound = IdentificationEngine::PEAKS_Studio;
}
}
}
}
else
{
m_qxmlStreamReader.skipCurrentElement();
}
}
}
switch(analysisSotwareNameFound)
{
case IdentificationEngine::SpecOMS:
break;
case IdentificationEngine::MSGFplus:
break;
case IdentificationEngine::XTandem:
break;
case IdentificationEngine::PEAKS_Studio:
break;
default:
m_qxmlStreamReader.raiseError(
QObject::tr("identification results from %1 are not supported yet, "
"Please contact "
"the PAPPSO team.")
.arg(software_name));
return false;
}
auto it = m_IdentificationEngineMap.insert(
std::pair<QString, IdentificationEngine>(analysisSoftwareId, analysisSotwareNameFound));
if(it.second == false)
{
it.first->second = analysisSotwareNameFound;
}
}
else
{
m_qxmlStreamReader.raiseError(QObject::tr("Not an MzIdentML input file"));
m_qxmlStreamReader.skipCurrentElement();
return false;
}
return true;
}
return false;
}
pappso::cbor::psm::MzIdentMlReader::IdentificationEngine::SpecOMS
@ SpecOMS
SpecOMS C++ implementation.
Definition mzidentmlreader.h:104
pappso::cbor::psm::MzIdentMlReader::IdentificationEngine::MSGFplus
@ MSGFplus
MS:1002048 "MS-GF+ software used to analyze the spectra." [PSI:PI].
Definition mzidentmlreader.h:103
pappso::cbor::psm::MzIdentMlReader::IdentificationEngine::PEAKS_Studio
@ PEAKS_Studio
PEAKS Studio.
Definition mzidentmlreader.h:106
pappso::cbor::psm::MzIdentMlReader::readCvParam
CvParam readCvParam()
Definition mzidentmlreader.cpp:592
pappso::cbor::psm::MzIdentMlReader::m_analysisSoftwareVersion
QString m_analysisSoftwareVersion
Definition mzidentmlreader.h:221
pappso::cbor::psm::MzIdentMlReader::CvParam
Definition mzidentmlreader.h:111

References pappso::cbor::psm::MzIdentMlReader::CvParam::accession, m_analysisSoftwareVersion, m_IdentificationEngineMap, pappso::XmlStreamReaderInterface::m_qxmlStreamReader, MSGFplus, PEAKS_Studio, readCvParam(), SpecOMS, unknown, and XTandem.

Referenced by readStream().

## readCvParam()

MzIdentMlReader::CvParam pappso::cbor::psm::MzIdentMlReader::readCvParam | ( |  | ) |

private

Definition at line 592 of file mzidentmlreader.cpp.

{
CvParam cv_param;
cv_param.cvRef = m_qxmlStreamReader.attributes().value("cvRef").toString();
cv_param.accession = m_qxmlStreamReader.attributes().value("accession").toString();
cv_param.name = m_qxmlStreamReader.attributes().value("name").toString();
cv_param.value = m_qxmlStreamReader.attributes().value("value").toString();
cv_param.unitAccession = m_qxmlStreamReader.attributes().value("unitAccession").toString();
cv_param.unitName = m_qxmlStreamReader.attributes().value("unitName").toString();
cv_param.unitCvRef = m_qxmlStreamReader.attributes().value("unitCvRef").toString();
m_qxmlStreamReader.skipCurrentElement();
return cv_param;
}
pappso::cbor::psm::MzIdentMlReader::CvParam::cvRef
QString cvRef
Definition mzidentmlreader.h:112

References pappso::cbor::psm::MzIdentMlReader::CvParam::accession, pappso::cbor::psm::MzIdentMlReader::CvParam::cvRef, pappso::XmlStreamReaderInterface::m_qxmlStreamReader, pappso::cbor::psm::MzIdentMlReader::CvParam::name, pappso::cbor::psm::MzIdentMlReader::CvParam::unitAccession, pappso::cbor::psm::MzIdentMlReader::CvParam::unitCvRef, pappso::cbor::psm::MzIdentMlReader::CvParam::unitName, and pappso::cbor::psm::MzIdentMlReader::CvParam::value.

Referenced by readAnalysisSoftware(), readDBSequence(), readPeptide(), readSpectrumIdentificationItem(), and readSpectrumIdentificationResult().

## readDataCollectionItem()

bool pappso::cbor::psm::MzIdentMlReader::readDataCollectionItem | ( |  | ) |

private

Definition at line 853 of file mzidentmlreader.cpp.

{
qDebug();
if(m_qxmlStreamReader.readNextStartElement())
{
if(m_qxmlStreamReader.name().toString() == "Inputs")
{
readInputs();
}
// AnalysisData
else if(m_qxmlStreamReader.name().toString() == "AnalysisData")
{
qDebug();
readAnalysisData();
}
else
{
m_qxmlStreamReader.raiseError(
QObject::tr("Error in MzIdentML/DataCollection, unexpected %1 tag")
.arg(m_qxmlStreamReader.name()));
m_qxmlStreamReader.skipCurrentElement();
return false;
}
return true;
}
return false;
}
pappso::cbor::psm::MzIdentMlReader::readInputs
void readInputs()
Definition mzidentmlreader.cpp:884
pappso::cbor::psm::MzIdentMlReader::readAnalysisData
void readAnalysisData()
Definition mzidentmlreader.cpp:981

References pappso::XmlStreamReaderInterface::m_qxmlStreamReader, readAnalysisData(), and readInputs().

Referenced by readStream().

## readDBSequence()

void pappso::cbor::psm::MzIdentMlReader::readDBSequence | ( |  | ) |

private

Definition at line 524 of file mzidentmlreader.cpp.

{
// attributes.value("base_name")
// ProteinXtpSp sp_xtp_protein = _current_protein.makeProteinXtpSp();
MzidDBSequence dbsequence;
dbsequence.is_decoy = false;
dbsequence.accession = m_qxmlStreamReader.attributes().value("accession").toString();
QString accession_description = dbsequence.accession;
dbsequence.searchDatabase_ref =
m_qxmlStreamReader.attributes().value("searchDatabase_ref").toString();
QString id = m_qxmlStreamReader.attributes().value("id").toString();
while(m_qxmlStreamReader.readNextStartElement())
{
if(m_qxmlStreamReader.name().toString() == "cvParam")
{
CvParam cv_param = readCvParam();
if(cv_param.accession == "MS:1001088")
{
// protein description
// protein.get()->setDescription(cv_param.value);
dbsequence.description = cv_param.value;
accession_description.append(" ").append(dbsequence.description);
}
else if(cv_param.accession == "MS:1001195")
{
// PSI-MS MS:1001195 decoy DB type reverse
// protein.get()->setIsDecoy(true);
dbsequence.is_decoy = true;
}
else
{
dbsequence.cvParamList.push_back(cv_param);
}
}
else if(m_qxmlStreamReader.name().toString().toLower() == "seq")
{
dbsequence.sequence = m_qxmlStreamReader.readElementText();
}
else
{
m_qxmlStreamReader.raiseError(
QObject::tr("Error in MzIdentML/DBSequence unexpected %1 tag")
.arg(m_qxmlStreamReader.name()));
m_qxmlStreamReader.skipCurrentElement();
}
}
// qWarning() << accession_description;
dbsequence.protein_sp = std::make_shared<Protein>(accession_description, dbsequence.sequence);
m_MzidDBSequenceIdMap.insert({id, dbsequence});
// searchDatabase_ref="SearchDB_1"
// protein.get()->setFastaFileP(fastaFile.get());
}
pappso::cbor::psm::MzIdentMlReader::MzidDBSequence
Definition mzidentmlreader.h:131
pappso::cbor::psm::MzIdentMlReader::MzidDBSequence::is_decoy
bool is_decoy
Definition mzidentmlreader.h:137

References pappso::cbor::psm::MzIdentMlReader::CvParam::accession, pappso::cbor::psm::MzIdentMlReader::MzidDBSequence::accession, pappso::cbor::psm::MzIdentMlReader::MzidDBSequence::cvParamList, pappso::cbor::psm::MzIdentMlReader::MzidDBSequence::description, pappso::cbor::psm::MzIdentMlReader::MzidDBSequence::is_decoy, m_MzidDBSequenceIdMap, pappso::XmlStreamReaderInterface::m_qxmlStreamReader, pappso::cbor::psm::MzIdentMlReader::MzidDBSequence::protein_sp, readCvParam(), pappso::cbor::psm::MzIdentMlReader::MzidDBSequence::searchDatabase_ref, pappso::cbor::psm::MzIdentMlReader::MzidDBSequence::sequence, and pappso::cbor::psm::MzIdentMlReader::CvParam::value.

Referenced by readSequenceCollectionItem().

## readInputs()

void pappso::cbor::psm::MzIdentMlReader::readInputs | ( |  | ) |

private

Definition at line 884 of file mzidentmlreader.cpp.

{
while(m_qxmlStreamReader.readNextStartElement())
{
if(m_qxmlStreamReader.name().toString() == "SearchDatabase")
{
readSearchDatabase();
}
else if(m_qxmlStreamReader.name().toString() == "SpectraData")
{
readSpectraData();
}
else if(m_qxmlStreamReader.name().toString() == "SourceFile")
{
m_qxmlStreamReader.skipCurrentElement();
}
else
{
m_qxmlStreamReader.raiseError(
QObject::tr("Error in MzIdentML/DataCollection/Inputs, unexpected %1 tag")
.arg(m_qxmlStreamReader.name()));
m_qxmlStreamReader.skipCurrentElement();
}
}
}
pappso::cbor::psm::MzIdentMlReader::readSpectraData
void readSpectraData()
Definition mzidentmlreader.cpp:963
pappso::cbor::psm::MzIdentMlReader::readSearchDatabase
bool readSearchDatabase()
Definition mzidentmlreader.cpp:923

References pappso::XmlStreamReaderInterface::m_qxmlStreamReader, readSearchDatabase(), and readSpectraData().

Referenced by readDataCollectionItem().

## readPeptide()

void pappso::cbor::psm::MzIdentMlReader::readPeptide | ( |  | ) |

private

Definition at line 620 of file mzidentmlreader.cpp.

{
std::shared_ptr<pappso::Peptide> peptide_sp;
QString xml_id = m_qxmlStreamReader.attributes().value("id").toString();
// PeptideSequence
if(m_qxmlStreamReader.readNextStartElement())
{
if(m_qxmlStreamReader.name().toString() == "PeptideSequence")
{
peptide_sp = std::make_shared<Peptide>(m_qxmlStreamReader.readElementText().simplified());
}
else
{
m_qxmlStreamReader.raiseError(
QObject::tr("Error in MzIdentML/Peptide no PeptideSequence"));
}
}
while(m_qxmlStreamReader.readNextStartElement())
{
if(m_qxmlStreamReader.name().toString() == "Modification")
{
// <Modification monoisotopicMassDelta="-0.02682025649"
// location="1">
// <cvParam accession="-0.0268203" cvRef="PSI-MOD" name=""/>
// </Modification>
Modification modification;
modification.monoisotopicMassDelta =
m_qxmlStreamReader.attributes().value("monoisotopicMassDelta").toDouble();
modification.location = m_qxmlStreamReader.attributes().value("location").toUInt();
bool is_cv_param = false;
while(m_qxmlStreamReader.readNextStartElement())
{
if(m_qxmlStreamReader.name().toString() == "cvParam")
{
is_cv_param = true;
modification.cvParam = readCvParam();
// qDebug() << "startElement_aa ";
pappso::AaModificationP modif = nullptr;
qDebug() << modification.monoisotopicMassDelta;
if(modification.cvParam.accession != "")
{
qDebug() << modification.cvParam.accession;
if(modification.cvParam.accession.startsWith("UNIMOD:"))
{
modif = pappso::Utils::translateAaModificationFromUnimod(
modification.cvParam.accession);
}
else
{
// hope it is psi mod:
if(modification.cvParam.accession.startsWith("MOD:"))
{
modif =
pappso::AaModification::getInstance(modification.cvParam.accession);
}
else if(modification.cvParam.accession == "MS:1001460")
{
//[Term]
// id: MS:1001460
// name: unknown modification
// def: "This term should be given if the
// modification was unknown." [PSI:PI] is_a:
// MS:1001471 ! peptide modification details
modif = pappso::AaModification::getInstanceCustomizedMod(
modification.monoisotopicMassDelta);
}
else
{
qInfo() << "MzIdentMlSaxHandler::endElement_"
"Modification unknown "
"modification "
<< modification.cvParam.accession << " "
<< modification.cvParam.name;
}
}
}
if(modif == nullptr)
{
m_qxmlStreamReader.raiseError(
QObject::tr("Error in MzIdentML/Peptide/Modification/cvParam "
"modification accession %1 not found")
.arg(modification.cvParam.accession));
return;
}
if(modification.location == 0)
{
peptide_sp.get()->addAaModification(modif, 0);
}
else
{
peptide_sp.get()->addAaModification(modif, modification.location - 1);
}
}
else
{
m_qxmlStreamReader.raiseError(
QObject::tr("Error in MzIdentML/Peptide/Modification "
"unexpected %1 tag")
.arg(m_qxmlStreamReader.name()));
}
}
if(is_cv_param == false)
{
pappso::AaModificationP modif_without_cvparam = nullptr;
// no cv param element
if(modification.location == 0)
{
modif_without_cvparam =
pappso::Utils::guessAaModificationPbyMonoisotopicMassDelta(
peptide_sp.get()->getAa(0).getAminoAcidChar(),
modification.monoisotopicMassDelta);
peptide_sp.get()->addAaModification(modif_without_cvparam, 0);
}
else
{
modif_without_cvparam =
pappso::Utils::guessAaModificationPbyMonoisotopicMassDelta(
peptide_sp.get()->getAa(modification.location - 1).getAminoAcidChar(),
modification.monoisotopicMassDelta);
peptide_sp.get()->addAaModification(modif_without_cvparam,
modification.location - 1);
}
}
}
else
{
m_qxmlStreamReader.raiseError(QObject::tr("Error in MzIdentML/Peptide unexpected %1 tag")
.arg(m_qxmlStreamReader.name()));
}
}
m_PeptideIdMap.insert(std::pair<QString, PeptideSp>(xml_id, peptide_sp));
}
pappso::AaModification::getInstance
static AaModificationP getInstance(const QString &accession)
Definition aamodification.cpp:368
pappso::AaModification::getInstanceCustomizedMod
static AaModificationP getInstanceCustomizedMod(pappso_double modificationMass)
Definition aamodification.cpp:349
pappso::Utils::guessAaModificationPbyMonoisotopicMassDelta
static AaModificationP guessAaModificationPbyMonoisotopicMassDelta(Enums::AminoAcidChar aa, pappso_double mass)
Definition utils.cpp:658
pappso::Utils::translateAaModificationFromUnimod
static AaModificationP translateAaModificationFromUnimod(const QString &unimod_accession)
Definition utils.cpp:734
pappso::cbor::psm::MzIdentMlReader::m_PeptideIdMap
std::map< QString, PeptideSp > m_PeptideIdMap
store association between xml ID and peptide sequence
Definition mzidentmlreader.h:238
pappso::AaModificationP
const AaModification * AaModificationP
Definition aamodification.h:52
pappso::cbor::psm::MzIdentMlReader::Modification
Definition mzidentmlreader.h:124
pappso::cbor::psm::MzIdentMlReader::Modification::monoisotopicMassDelta
double monoisotopicMassDelta
Definition mzidentmlreader.h:125

References pappso::cbor::psm::MzIdentMlReader::CvParam::accession, pappso::cbor::psm::MzIdentMlReader::Modification::cvParam, pappso::AaModification::getInstance(), pappso::AaModification::getInstanceCustomizedMod(), pappso::Utils::guessAaModificationPbyMonoisotopicMassDelta(), pappso::cbor::psm::MzIdentMlReader::Modification::location, m_PeptideIdMap, pappso::XmlStreamReaderInterface::m_qxmlStreamReader, pappso::cbor::psm::MzIdentMlReader::Modification::monoisotopicMassDelta, pappso::cbor::psm::MzIdentMlReader::CvParam::name, readCvParam(), and pappso::Utils::translateAaModificationFromUnimod().

Referenced by readSequenceCollectionItem().

## readPeptideEvidence()

bool pappso::cbor::psm::MzIdentMlReader::readPeptideEvidence | ( |  | ) |

private

Definition at line 772 of file mzidentmlreader.cpp.

{
qDebug();
MzidPeptideEvidence pe;
auto itprot =
m_MzidDBSequenceIdMap.find(m_qxmlStreamReader.attributes().value("dBSequence_ref").toString());
if(itprot == m_MzidDBSequenceIdMap.end())
{
m_qxmlStreamReader.raiseError(
QObject::tr("dBSequence_ref %1 not defined")
.arg(m_qxmlStreamReader.attributes().value("dBSequence_ref").toString()));
return false;
}
qDebug();
pe.protein = itprot->second.protein_sp;
auto itpep = m_PeptideIdMap.find(m_qxmlStreamReader.attributes().value("peptide_ref").toString());
if(itpep == m_PeptideIdMap.end())
{
m_qxmlStreamReader.raiseError(
QObject::tr("peptide_ref %1 not defined")
.arg(m_qxmlStreamReader.attributes().value("peptide_ref").toString()));
return false;
}
qDebug();
pe.peptide = itpep->second;
pe.start = m_qxmlStreamReader.attributes().value("start").toUInt() - 1;
pe.end = m_qxmlStreamReader.attributes().value("end").toUInt() - 1;
pe.isDecoy = false;
if(m_qxmlStreamReader.attributes().value("isDecoy").toString() == "true")
{
pe.isDecoy = true;
}
qDebug();
m_MzidPeptideEvidenceIdMap.insert(std::pair<QString, MzidPeptideEvidence>(
m_qxmlStreamReader.attributes().value("id").toString(), pe));
m_qxmlStreamReader.skipCurrentElement();
qDebug();
return true;
}
pappso::cbor::psm::MzIdentMlReader::m_MzidPeptideEvidenceIdMap
std::map< QString, MzidPeptideEvidence > m_MzidPeptideEvidenceIdMap
store association between xml ID and peptide evidence
Definition mzidentmlreader.h:243
pappso::cbor::psm::MzIdentMlReader::MzidPeptideEvidence
Definition mzidentmlreader.h:152

References pappso::cbor::psm::MzIdentMlReader::MzidPeptideEvidence::end, pappso::cbor::psm::MzIdentMlReader::MzidPeptideEvidence::isDecoy, m_MzidDBSequenceIdMap, m_MzidPeptideEvidenceIdMap, m_PeptideIdMap, pappso::XmlStreamReaderInterface::m_qxmlStreamReader, pappso::cbor::psm::MzIdentMlReader::MzidPeptideEvidence::peptide, pappso::cbor::psm::MzIdentMlReader::MzidPeptideEvidence::protein, and pappso::cbor::psm::MzIdentMlReader::MzidPeptideEvidence::start.

Referenced by readSequenceCollectionItem().

## readSearchDatabase()

bool pappso::cbor::psm::MzIdentMlReader::readSearchDatabase | ( |  | ) |

private

Definition at line 923 of file mzidentmlreader.cpp.

{
/* <SearchDatabase
location="/gorgone/pappso/versions_logiciels_pappso/tandemng/database/Genome_Z_mays_5a.fasta"
id="SearchDB_0"> <FileFormat> <cvParam accession="MS:1001348" cvRef="PSI-MS" name="FASTA
format"/>
</FileFormat>
<DatabaseName>
<userParam name="DatabaseName" value="Genome_Z_mays_5a.fasta"/>
</DatabaseName>
<cvParam accession="MS:1001197" cvRef="PSI-MS" name="DB composition
target+decoy"/> <cvParam accession="MS: 1001283" cvRef="PSI-MS" name="decoy DB accession
regexp" value="^XXX"/> <cvParam accession="MS: 1001195" cvRef="PSI-MS" name="decoy DB type
reverse"/>
</SearchDatabase>
*/
qDebug();
QString id = m_qxmlStreamReader.attributes().value("id").toString();
// auto itfasta = m_FastaFileIdMap.find(id);
MzidSearchDatabase search_database;
search_database.file = m_qxmlStreamReader.attributes().value("location").toString();
if(search_database.file.isEmpty())
{
m_qxmlStreamReader.raiseError(QObject::tr("SearchDatabase id %1 location is empty").arg(id));
return false;
}
m_mzidSearchDatabaseIdMap.insert({id, search_database});
m_qxmlStreamReader.skipCurrentElement();
qDebug();
return true;
}
pappso::cbor::psm::MzIdentMlReader::MzidSearchDatabase
Definition mzidentmlreader.h:142
pappso::cbor::psm::MzIdentMlReader::MzidSearchDatabase::file
QString file
Definition mzidentmlreader.h:143

References pappso::cbor::psm::MzIdentMlReader::MzidSearchDatabase::file, m_mzidSearchDatabaseIdMap, and pappso::XmlStreamReaderInterface::m_qxmlStreamReader.

Referenced by readInputs().

## readSequenceCollectionItem()

bool pappso::cbor::psm::MzIdentMlReader::readSequenceCollectionItem | ( |  | ) |

private

Definition at line 493 of file mzidentmlreader.cpp.

{
if(m_qxmlStreamReader.readNextStartElement())
{
if(m_qxmlStreamReader.name().toString() == "DBSequence")
{
readDBSequence();
}
else if(m_qxmlStreamReader.name().toString() == "Peptide")
{
readPeptide();
}
// PeptideEvidence
else if(m_qxmlStreamReader.name().toString() == "PeptideEvidence")
{
readPeptideEvidence();
}
else
{
m_qxmlStreamReader.raiseError(
QObject::tr("Error in MzIdentML input file, %1 no DBSequence")
.arg(m_qxmlStreamReader.name()));
m_qxmlStreamReader.skipCurrentElement();
return false;
}
return true;
}
return false;
}
pappso::cbor::psm::MzIdentMlReader::readDBSequence
void readDBSequence()
Definition mzidentmlreader.cpp:524
pappso::cbor::psm::MzIdentMlReader::readPeptideEvidence
bool readPeptideEvidence()
Definition mzidentmlreader.cpp:772
pappso::cbor::psm::MzIdentMlReader::readPeptide
void readPeptide()
Definition mzidentmlreader.cpp:620

References pappso::XmlStreamReaderInterface::m_qxmlStreamReader, readDBSequence(), readPeptide(), and readPeptideEvidence().

Referenced by readStream().

## readSpectraData()

void pappso::cbor::psm::MzIdentMlReader::readSpectraData | ( |  | ) |

private

Definition at line 963 of file mzidentmlreader.cpp.

{
qDebug();
MzidSpectraData spectra_data;
spectra_data.file = m_qxmlStreamReader.attributes().value("location").toString();
// msrun.get()->setXmlId(attributes.value("id"));
spectra_data.name = m_qxmlStreamReader.attributes().value("name").toString();
m_mzidSpectraDataIdMap.insert(std::pair<QString, MzidSpectraData>(
m_qxmlStreamReader.attributes().value("id").toString(), spectra_data));
m_qxmlStreamReader.skipCurrentElement();
}
pappso::cbor::psm::MzIdentMlReader::MzidSpectraData
Definition mzidentmlreader.h:147
pappso::cbor::psm::MzIdentMlReader::MzidSpectraData::file
QString file
Definition mzidentmlreader.h:148

References pappso::cbor::psm::MzIdentMlReader::MzidSpectraData::file, m_mzidSpectraDataIdMap, pappso::XmlStreamReaderInterface::m_qxmlStreamReader, and pappso::cbor::psm::MzIdentMlReader::MzidSpectraData::name.

Referenced by readInputs().

## readSpectrumIdentification()

void pappso::cbor::psm::MzIdentMlReader::readSpectrumIdentification | ( |  | ) |

private

Definition at line 846 of file mzidentmlreader.cpp.

{
m_qxmlStreamReader.skipCurrentElement();
}

References pappso::XmlStreamReaderInterface::m_qxmlStreamReader.

Referenced by readAnalysisCollectionItem().

## readSpectrumIdentificationItem()

void pappso::cbor::psm::MzIdentMlReader::readSpectrumIdentificationItem | ( | MzIdentMlReader::SpectrumIdentificationResult & | spectrum_identification_result | ) |

private

Definition at line 1179 of file mzidentmlreader.cpp.

{
qDebug();
spectrum_identification_result.spectrumIdentificationItemList.push_back(
SpectrumIdentificationItem());
spectrum_identification_result.spectrumIdentificationItemList.back()
.mzidPeptideEvidenceList.clear();
spectrum_identification_result.spectrumIdentificationItemList.back().cvParamList.clear();
spectrum_identification_result.spectrumIdentificationItemList.back().userParamList.clear();
spectrum_identification_result.spectrumIdentificationItemList.back().chargeState =
m_qxmlStreamReader.attributes().value("chargeState").toUInt();
spectrum_identification_result.spectrumIdentificationItemList.back().experimentalMassToCharge =
m_qxmlStreamReader.attributes().value("experimentalMassToCharge").toDouble();
auto itpeptide =
m_PeptideIdMap.find(m_qxmlStreamReader.attributes().value("peptide_ref").toString());
if(itpeptide == m_PeptideIdMap.end())
{
m_qxmlStreamReader.raiseError(QObject::tr("peptide_ref %1 not defined")
.arg(m_qxmlStreamReader.attributes().value("peptide_ref")));
}
spectrum_identification_result.spectrumIdentificationItemList.back().peptide = itpeptide->second;
while(m_qxmlStreamReader.readNextStartElement())
{
qDebug() << m_qxmlStreamReader.name();
if(m_qxmlStreamReader.name() == QString("PeptideEvidenceRef"))
{
auto itpeptideEvidence = m_MzidPeptideEvidenceIdMap.find(
m_qxmlStreamReader.attributes().value("peptideEvidence_ref").toString());
if(itpeptideEvidence == m_MzidPeptideEvidenceIdMap.end())
{
m_qxmlStreamReader.raiseError(
QObject::tr("peptideEvidence_ref %1 not defined")
.arg(m_qxmlStreamReader.attributes().value("peptideEvidence_ref")));
}
spectrum_identification_result.spectrumIdentificationItemList.back()
.mzidPeptideEvidenceList.push_back(itpeptideEvidence->second);
m_qxmlStreamReader.skipCurrentElement();
}
else if(m_qxmlStreamReader.name() == QString("cvParam"))
{
spectrum_identification_result.spectrumIdentificationItemList.back()
.cvParamList.push_back(readCvParam());
qDebug() << spectrum_identification_result.spectrumIdentificationItemList.back()
.cvParamList.back()
.toString();
}
else if(m_qxmlStreamReader.name() == QString("userParam"))
{
UserParam user_param = readUserParam();
spectrum_identification_result.spectrumIdentificationItemList.back()
.userParamList.push_back(user_param);
qDebug() << user_param.toString();
}
else
{
m_qxmlStreamReader.raiseError(QObject::tr("Error in "
"MzIdentML/DataCollection/AnalysisData/"
"SpectrumIdentificationList/"
"SpectrumIdentificationResult/"
"SpectrumIdentificationItem, unexpected %1 tag")
.arg(m_qxmlStreamReader.name()));
}
}
qDebug();
}
pappso::cbor::psm::MzIdentMlReader::readUserParam
UserParam readUserParam()
Definition mzidentmlreader.cpp:607
pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationItem
Definition mzidentmlreader.h:168
pappso::cbor::psm::MzIdentMlReader::UserParam
Definition mzidentmlreader.h:161

References m_MzidPeptideEvidenceIdMap, m_PeptideIdMap, pappso::XmlStreamReaderInterface::m_qxmlStreamReader, readCvParam(), readUserParam(), pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::spectrumIdentificationItemList, and pappso::cbor::psm::MzIdentMlReader::UserParam::toString().

Referenced by readSpectrumIdentificationResult().

## readSpectrumIdentificationResult()

void pappso::cbor::psm::MzIdentMlReader::readSpectrumIdentificationResult | ( |  | ) |

private

Definition at line 1031 of file mzidentmlreader.cpp.

{
qDebug() << m_qxmlStreamReader.name();
QString spectra_id = m_qxmlStreamReader.attributes().value("spectraData_ref").toString();
auto it_spectra_data = m_mzidSpectraDataIdMap.find(spectra_id);
if(it_spectra_data == m_mzidSpectraDataIdMap.end())
{
m_qxmlStreamReader.raiseError(QObject::tr("spectraData_ref %1 not defined in "
"m_mzidSpectraDataIdMap")
.arg(spectra_id));
}
auto it_insert_ident = m_spectrumIdentificationResultBySpectraIdMap.insert({spectra_id, {}});
it_insert_ident.first->second.push_back({});
SpectrumIdentificationResult &spectrum_identification_result =
it_insert_ident.first->second.back();
spectrum_identification_result.cvParamList.clear();
spectrum_identification_result.userParamList.clear();
spectrum_identification_result.spectrumIdentificationItemList.clear();
spectrum_identification_result.spectrumID =
m_qxmlStreamReader.attributes().value("spectrumID").toString();
spectrum_identification_result.id = m_qxmlStreamReader.attributes().value("id").toString();
qDebug() << m_qxmlStreamReader.name();
while(m_qxmlStreamReader.readNextStartElement())
{
qDebug() << m_qxmlStreamReader.name();
if(m_qxmlStreamReader.name() == QString("SpectrumIdentificationItem"))
{
qDebug();
readSpectrumIdentificationItem(spectrum_identification_result);
}
else if(m_qxmlStreamReader.name() == QString("cvParam"))
{
CvParam cv_param = readCvParam();
qDebug() << cv_param.toString();
spectrum_identification_result.cvParamList.push_back(cv_param);
}
else if(m_qxmlStreamReader.name() == QString("userParam"))
{
UserParam user_param = readUserParam();
qDebug() << user_param.toString();
}
else
{
m_qxmlStreamReader.raiseError(
QObject::tr("Error in "
"MzIdentML/DataCollection/AnalysisData/"
"SpectrumIdentificationList/"
"SpectrumIdentificationResult, unexpected %1 tag")
.arg(m_qxmlStreamReader.name()));
// m_qxmlStreamReader.skipCurrentElement();
}
}
if(m_qxmlStreamReader.hasError())
return;
qDebug() << m_qxmlStreamReader.name();
// find scan number
spectrum_identification_result.spectrumIndex = 0;
spectrum_identification_result.isSpectrumIndex = false;
spectrum_identification_result.scanNum = 0;
spectrum_identification_result.retentionTime = 0;
// spectrumID="index=194"
if(spectrum_identification_result.spectrumID.startsWith("index="))
{
bool is_ok = false;
spectrum_identification_result.spectrumIndex =
spectrum_identification_result.spectrumID.mid(6).toULongLong(&is_ok);
spectrum_identification_result.isSpectrumIndex = true;
if(!is_ok)
{
m_qxmlStreamReader.raiseError(QObject::tr("reading spectrum index failed in %1"
"SpectrumIdentificationResult id %2")
.arg(spectrum_identification_result.spectrumID)
.arg(spectrum_identification_result.id));
return;
}
}
// <cvParam cvRef="PSI-MS" accession="MS:1001115" name="scan number(s)"
// value="16079"/>
for(auto cvParam : spectrum_identification_result.cvParamList)
{
qDebug() << cvParam.toString();
if(cvParam.accession == "MS:1001115")
{
spectrum_identification_result.scanNum = cvParam.value.toUInt();
}
else if(cvParam.accession == "MS:1003062")
{
spectrum_identification_result.isSpectrumIndex = true;
spectrum_identification_result.spectrumIndex = cvParam.value.toUInt();
}
else if((cvParam.accession == "MS:1000016") || (cvParam.accession == "MS:1000894"))
{
//[Term]
// id: MS:1000894
// name: retention time
// def: "A time interval from the start of chromatography when an
// analyte exits a chromatographic column." [PSI:MS]
// [Term]
// id: MS:1000016
// name: scan start time
// def: "The time that an analyzer started a scan, relative to the
// start of the MS run." [PSI:MS]
spectrum_identification_result.retentionTime = cvParam.value.toDouble();
}
}
if((spectrum_identification_result.scanNum == 0) &&
(spectrum_identification_result.isSpectrumIndex == false))
{
m_qxmlStreamReader.raiseError(QObject::tr("scan number or spectrum index not found in "
"SpectrumIdentificationResult id %1")
.arg(spectrum_identification_result.id));
}
if(spectrum_identification_result.retentionTime == 0)
{
m_qxmlStreamReader.raiseError(
QObject::tr("retention time not found in SpectrumIdentificationResult id %1")
.arg(spectrum_identification_result.id));
}
for(auto spectrumIdentificationItem :
spectrum_identification_result.spectrumIdentificationItemList)
{
// processSpectrumIdentificationItem(spectrum_identification_result,
// spectrumIdentificationItem);
}
}
pappso::cbor::psm::MzIdentMlReader::readSpectrumIdentificationItem
void readSpectrumIdentificationItem(SpectrumIdentificationResult &spectrum_identification_result)
Definition mzidentmlreader.cpp:1179
pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::cvParamList
std::vector< CvParam > cvParamList
Definition mzidentmlreader.h:191

References pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::cvParamList, pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::id, pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::isSpectrumIndex, m_mzidSpectraDataIdMap, pappso::XmlStreamReaderInterface::m_qxmlStreamReader, m_spectrumIdentificationResultBySpectraIdMap, readCvParam(), readSpectrumIdentificationItem(), readUserParam(), pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::retentionTime, pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::scanNum, pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::spectrumID, pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::spectrumIdentificationItemList, pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::spectrumIndex, pappso::cbor::psm::MzIdentMlReader::CvParam::toString(), pappso::cbor::psm::MzIdentMlReader::UserParam::toString(), and pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::userParamList.

Referenced by readAnalysisData().

## readStream()

void pappso::cbor::psm::MzIdentMlReader::readStream | ( |  | ) |

override protected virtual

Implements pappso::XmlStreamReaderInterface.

Definition at line 194 of file mzidentmlreader.cpp.

{
// mp_monitor->setStatus("reading X!Tandem result file");
if(m_qxmlStreamReader.readNextStartElement())
{
qDebug() << m_qxmlStreamReader.name().toString();
if(m_qxmlStreamReader.name().toString().toLower() == "mzidentml")
{
while(m_qxmlStreamReader.readNextStartElement())
{
// cvList
if(m_qxmlStreamReader.name().toString() == "cvList")
{
m_qxmlStreamReader.skipCurrentElement();
}
// AnalysisSoftwareList
else if(m_qxmlStreamReader.name().toString() == "AnalysisSoftwareList")
{
while(readAnalysisSoftware())
{
}
} // Provider
else if(m_qxmlStreamReader.name().toString() == "Provider")
{
m_qxmlStreamReader.skipCurrentElement();
}
// AuditCollection
else if(m_qxmlStreamReader.name().toString() == "AuditCollection")
{
m_qxmlStreamReader.skipCurrentElement();
}
// SequenceCollection
else if(m_qxmlStreamReader.name().toString() == "SequenceCollection")
{
while(readSequenceCollectionItem())
{
}
}
// AnalysisCollection
else if(m_qxmlStreamReader.name().toString() == "AnalysisCollection")
{
while(readAnalysisCollectionItem())
{
}
}
// AnalysisProtocolCollection
else if(m_qxmlStreamReader.name().toString() == "AnalysisProtocolCollection")
{
readAnalysisProtocolCollection();
}
// DataCollection
else if(m_qxmlStreamReader.name().toString() == "DataCollection")
{
while(readDataCollectionItem())
{
}
}
else if(m_qxmlStreamReader.name().toString() == "BibliographicReference")
{
m_qxmlStreamReader.skipCurrentElement();
}
else
{
m_qxmlStreamReader.raiseError(
QObject::tr("element %1 not implemented").arg(m_qxmlStreamReader.name()));
m_qxmlStreamReader.skipCurrentElement();
}
}
}
else
{
m_qxmlStreamReader.raiseError(QObject::tr("Not an MzIdentML input file"));
m_qxmlStreamReader.skipCurrentElement();
}
}
}
pappso::cbor::psm::MzIdentMlReader::readAnalysisCollectionItem
bool readAnalysisCollectionItem()
Definition mzidentmlreader.cpp:817
pappso::cbor::psm::MzIdentMlReader::readSequenceCollectionItem
bool readSequenceCollectionItem()
Definition mzidentmlreader.cpp:493
pappso::cbor::psm::MzIdentMlReader::readAnalysisProtocolCollection
void readAnalysisProtocolCollection()
Definition mzidentmlreader.cpp:276
pappso::cbor::psm::MzIdentMlReader::readAnalysisSoftware
bool readAnalysisSoftware()
Definition mzidentmlreader.cpp:379
pappso::cbor::psm::MzIdentMlReader::readDataCollectionItem
bool readDataCollectionItem()
Definition mzidentmlreader.cpp:853

References pappso::XmlStreamReaderInterface::m_qxmlStreamReader, readAnalysisCollectionItem(), readAnalysisProtocolCollection(), readAnalysisSoftware(), readDataCollectionItem(), and readSequenceCollectionItem().

## readUserParam()

MzIdentMlReader::UserParam pappso::cbor::psm::MzIdentMlReader::readUserParam | ( |  | ) |

private

Definition at line 607 of file mzidentmlreader.cpp.

{
UserParam user_param;
user_param.name = m_qxmlStreamReader.attributes().value("name").toString();
user_param.value = m_qxmlStreamReader.attributes().value("value").toString();
m_qxmlStreamReader.skipCurrentElement();
return user_param;
}
pappso::cbor::psm::MzIdentMlReader::UserParam::name
QString name
Definition mzidentmlreader.h:162

References pappso::XmlStreamReaderInterface::m_qxmlStreamReader, pappso::cbor::psm::MzIdentMlReader::UserParam::name, and pappso::cbor::psm::MzIdentMlReader::UserParam::value.

Referenced by readSpectrumIdentificationItem(), and readSpectrumIdentificationResult().

## writeSpectrumIdentificationItem()

void pappso::cbor::psm::MzIdentMlReader::writeSpectrumIdentificationItem | ( | const SpectrumIdentificationItem & | spectrum_identification_item | ) |

private

Definition at line 1501 of file mzidentmlreader.cpp.

{
mp_cborWriter->startMap(); // psm
mp_cborWriter->append("proforma");
mp_cborWriter->append(spectrum_identification_item.peptide.get()->toProForma());
std::map<QString, std::vector<std::size_t>> map_protein_positions;
for(auto &it_peptide_evidence : spectrum_identification_item.mzidPeptideEvidenceList)
{
auto it_insert =
map_protein_positions.insert({it_peptide_evidence.protein.get()->getAccession(), {}});
it_insert.first->second.push_back(it_peptide_evidence.start);
}
mp_cborWriter->append("protein_list");
mp_cborWriter->startArray(map_protein_positions.size());
for(auto &it_prot_pos : map_protein_positions)
{
mp_cborWriter->startMap();
mp_cborWriter->append("accession");
mp_cborWriter->append(it_prot_pos.first);
mp_cborWriter->append("positions");
mp_cborWriter->writeArray(it_prot_pos.second);
mp_cborWriter->endMap();
}
mp_cborWriter->endArray();
mp_cborWriter->append("eval");
mp_cborWriter->startMap(); // start eval
bool is_ok = false;
is_ok = writeTandemEval(spectrum_identification_item.cvParamList);
mp_cborWriter->endMap(); // end eval
if(!is_ok)
{
throw pappso::PappsoException("This identification engine is not taken into account");
}
mp_cborWriter->endMap(); // end psm
}
pappso::cbor::psm::MzIdentMlReader::writeTandemEval
bool writeTandemEval(const std::vector< CvParam > &cv_param_list)
Definition mzidentmlreader.cpp:1544

References pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationItem::cvParamList, mp_cborWriter, pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationItem::mzidPeptideEvidenceList, pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationItem::peptide, and writeTandemEval().

Referenced by writeSpectrumIdentificationResult().

## writeSpectrumIdentificationResult()

void pappso::cbor::psm::MzIdentMlReader::writeSpectrumIdentificationResult | ( | const SpectrumIdentificationResult & | spectrum_identificatio_result | ) |

private

Definition at line 1450 of file mzidentmlreader.cpp.

{
mp_cborWriter->startMap(); // one scan
mp_cborWriter->append("id");
mp_cborWriter->startMap(); // id
mp_cborWriter->append("index");
mp_cborWriter->append((qint64)spectrum_identificatio_result.spectrumIndex);
mp_cborWriter->append("native_id");
mp_cborWriter->append(spectrum_identificatio_result.spectrumID);
mp_cborWriter->endMap(); // end id
mp_cborWriter->append("ms2");
mp_cborWriter->startMap(); // ms2
mp_cborWriter->append("rt");
mp_cborWriter->append(spectrum_identificatio_result.retentionTime);
mp_cborWriter->endMap(); // end ms2
uint charge = spectrum_identificatio_result.spectrumIdentificationItemList.front().chargeState;
double exp_mz =
spectrum_identificatio_result.spectrumIdentificationItemList.front().experimentalMassToCharge;
mp_cborWriter->append("precursor");
mp_cborWriter->startMap(); // precursor
mp_cborWriter->append("z");
mp_cborWriter->append(charge);
mp_cborWriter->append("mz");
mp_cborWriter->append(exp_mz);
mp_cborWriter->endMap(); // end precursor
mp_cborWriter->append("psm_list");
mp_cborWriter->startArray(spectrum_identificatio_result.spectrumIdentificationItemList.size());
for(auto &spectrum_ident_item : spectrum_identificatio_result.spectrumIdentificationItemList)
{
if(spectrum_ident_item.chargeState != charge)
{ // error
}
if(spectrum_ident_item.experimentalMassToCharge != exp_mz)
{ // error
}
writeSpectrumIdentificationItem(spectrum_ident_item);
}
mp_cborWriter->endArray();
mp_cborWriter->endMap(); // end one scan
}
pappso::cbor::psm::MzIdentMlReader::writeSpectrumIdentificationItem
void writeSpectrumIdentificationItem(const SpectrumIdentificationItem &spectrum_identification_item)
Definition mzidentmlreader.cpp:1501
pappso::uint
unsigned int uint
Definition types.h:67

References mp_cborWriter, pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::retentionTime, pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::spectrumID, pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::spectrumIdentificationItemList, pappso::cbor::psm::MzIdentMlReader::SpectrumIdentificationResult::spectrumIndex, and writeSpectrumIdentificationItem().

Referenced by finalDebrief().

## writeTandemEval()

bool pappso::cbor::psm::MzIdentMlReader::writeTandemEval | ( | const std::vector< CvParam > & | cv_param_list | ) |

private

Definition at line 1544 of file mzidentmlreader.cpp.

{
// <cvParam accession="MS:1001330" cvRef="PSI-MS" name="X!Tandem:expect"
// value="0.0410883"/>
// <cvParam accession="MS:1001331" cvRef="PSI-MS" name="X!Tandem:hyperscore" value="25.9"/>
auto it_find =
std::find_if(cv_param_list.begin(), cv_param_list.end(), [](const CvParam &cv_param) {
return cv_param.accession == "MS:1001330";
});
if(it_find != cv_param_list.end())
{
mp_cborWriter->append("xtandem");
mp_cborWriter->startMap(); // start tandem
mp_cborWriter->append("evalue");
mp_cborWriter->append(it_find->value.toDouble());
auto it_find =
std::find_if(cv_param_list.begin(), cv_param_list.end(), [](const CvParam &cv_param) {
return cv_param.accession == "MS:1001331";
});
mp_cborWriter->append("hyperscore");
mp_cborWriter->append(it_find->value.toDouble());
mp_cborWriter->endMap(); // end tandem
return true;
}
return false;
}

References mp_cborWriter.

Referenced by writeSpectrumIdentificationItem().

## Member Data Documentation

## m_analysisSoftwareVersion

QString pappso::cbor::psm::MzIdentMlReader::m_analysisSoftwareVersion

private

Definition at line 221 of file mzidentmlreader.h.

Referenced by readAnalysisSoftware().

## m_cborParameterMap

QCborMap pappso::cbor::psm::MzIdentMlReader::m_cborParameterMap

private

Definition at line 269 of file mzidentmlreader.h.

Referenced by finalDebrief(), and readAnalysisProtocolCollection().

## m_identificationEngine

IdentificationEngine pappso::cbor::psm::MzIdentMlReader::m_identificationEngine

private

Definition at line 220 of file mzidentmlreader.h.

Referenced by MzIdentMlReader().

## m_IdentificationEngineMap

std::map<QString, IdentificationEngine> pappso::cbor::psm::MzIdentMlReader::m_IdentificationEngineMap

private

store association between xml ID and an identification engine

Definition at line 228 of file mzidentmlreader.h.

Referenced by readAnalysisProtocolCollection(), and readAnalysisSoftware().

## m_MzidDBSequenceIdMap

std::map<QString, MzidDBSequence> pappso::cbor::psm::MzIdentMlReader::m_MzidDBSequenceIdMap

private

store association between xml ID and DBSequence

Definition at line 252 of file mzidentmlreader.h.

Referenced by finalDebrief(), readDBSequence(), and readPeptideEvidence().

## m_mzidentFile

QFileInfo pappso::cbor::psm::MzIdentMlReader::m_mzidentFile

private

Definition at line 268 of file mzidentmlreader.h.

Referenced by MzIdentMlReader(), and finalDebrief().

## m_MzidPeptideEvidenceIdMap

std::map<QString, MzidPeptideEvidence> pappso::cbor::psm::MzIdentMlReader::m_MzidPeptideEvidenceIdMap

private

store association between xml ID and peptide evidence

Definition at line 243 of file mzidentmlreader.h.

Referenced by readPeptideEvidence(), and readSpectrumIdentificationItem().

## m_mzidSearchDatabaseIdMap

std::map<QString, MzidSearchDatabase> pappso::cbor::psm::MzIdentMlReader::m_mzidSearchDatabaseIdMap

private

store association between xml ID and fasta files

Definition at line 233 of file mzidentmlreader.h.

Referenced by finalDebrief(), and readSearchDatabase().

## m_mzidSpectraDataIdMap

std::map<QString, MzidSpectraData> pappso::cbor::psm::MzIdentMlReader::m_mzidSpectraDataIdMap

private

store association between xml ID and SpectraData

Definition at line 248 of file mzidentmlreader.h.

Referenced by finalDebrief(), readSpectraData(), and readSpectrumIdentificationResult().

## m_PeptideIdMap

std::map<QString, PeptideSp> pappso::cbor::psm::MzIdentMlReader::m_PeptideIdMap

private

store association between xml ID and peptide sequence

Definition at line 238 of file mzidentmlreader.h.

Referenced by readPeptide(), readPeptideEvidence(), and readSpectrumIdentificationItem().

## m_proteinMap

PsmProteinMap pappso::cbor::psm::MzIdentMlReader::m_proteinMap

private

Definition at line 223 of file mzidentmlreader.h.

Referenced by finalDebrief().

## m_searchDatabase_ref2proteinList

std::map<QString, std::vector<ProteinSp> > pappso::cbor::psm::MzIdentMlReader::m_searchDatabase_ref2proteinList

private

associates database ref id to protein shared pointer because the search database id is not described before the protein (silly idea IMHO) we keep association of protein to database in this map until the real search database definition appears We then have to reprocess each protein to set the right fasta file pointer

Definition at line 260 of file mzidentmlreader.h.

## m_spectrumIdentificationResultBySpectraIdMap

std::map<QString, std::vector<SpectrumIdentificationResult> > pappso::cbor::psm::MzIdentMlReader::m_spectrumIdentificationResultBySpectraIdMap

private

store all identification results by spectra xml id

Definition at line 266 of file mzidentmlreader.h.

Referenced by finalDebrief(), and readSpectrumIdentificationResult().

## mp_cborWriter

pappso::cbor::CborStreamWriter* pappso::cbor::psm::MzIdentMlReader::mp_cborWriter

private

Definition at line 222 of file mzidentmlreader.h.

Referenced by MzIdentMlReader(), finalDebrief(), writeSpectrumIdentificationItem(), writeSpectrumIdentificationResult(), and writeTandemEval().

## mp_monitor

pappso::UiMonitorInterface* pappso::cbor::psm::MzIdentMlReader::mp_monitor

private

Definition at line 218 of file mzidentmlreader.h.

Referenced by MzIdentMlReader().

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

- pappsomspp/core/processing/cbor/psm/mzidentml/mzidentmlreader.h
- pappsomspp/core/processing/cbor/psm/mzidentml/mzidentmlreader.cpp