From f02ed81ff1f8eb6ee9d7c11e1ddbbb20c55c3392 Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Thu, 23 Nov 2017 09:24:53 +0100 Subject: [PATCH] PeptideMatchParam renamed to PeptideEvidenceParam --- src/core/peptideevidence.cpp | 8 +++---- src/core/peptideevidence.h | 8 +++---- src/gui/peptide_detail_view/peptidewindow.cpp | 2 +- .../peptide_list_view/peptidetablemodel.cpp | 2 +- .../ptmpeptidetablemodel.cpp | 2 +- src/input/identificationpwizreader.cpp | 2 +- src/input/xpipsaxhandler.cpp | 2 +- src/input/xtandemsaxhandler.cpp | 2 +- src/input/xtpxpipsaxhandler.cpp | 23 +++++++++++++++++-- src/input/xtpxpipsaxhandler.h | 2 ++ src/output/ods/spectrasheet.cpp | 2 +- src/output/proticdbml.cpp | 2 +- src/output/xpip.cpp | 4 ++-- src/utils/types.h | 8 +++---- 14 files changed, 45 insertions(+), 24 deletions(-) diff --git a/src/core/peptideevidence.cpp b/src/core/peptideevidence.cpp index bd9d6a306..2ca7d6b3e 100644 --- a/src/core/peptideevidence.cpp +++ b/src/core/peptideevidence.cpp @@ -75,10 +75,10 @@ void PeptideEvidence::setEvalue(pappso::pappso_double evalue) { /** \brief set specific parameter value */ -void PeptideEvidence::setParam(PeptideMatchParam param, const QVariant& value) { - _params.insert(std::pair<PeptideMatchParam, QVariant>(param, value)); +void PeptideEvidence::setParam(PeptideEvidenceParam param, const QVariant& value) { + _params.insert(std::pair<PeptideEvidenceParam, QVariant>(param, value)); } -const QVariant PeptideEvidence::getParam(PeptideMatchParam param) const { +const QVariant PeptideEvidence::getParam(PeptideEvidenceParam param) const { try { return _params.at(param); } @@ -86,7 +86,7 @@ const QVariant PeptideEvidence::getParam(PeptideMatchParam param) const { return QVariant(); } } -const std::map<PeptideMatchParam, QVariant> & PeptideEvidence::getParamList() const { +const std::map<PeptideEvidenceParam, QVariant> & PeptideEvidence::getParamList() const { return _params; } diff --git a/src/core/peptideevidence.h b/src/core/peptideevidence.h index b294cd57f..89f1771b6 100644 --- a/src/core/peptideevidence.h +++ b/src/core/peptideevidence.h @@ -77,12 +77,12 @@ public : /** \brief set specific parameter value */ - virtual void setParam(PeptideMatchParam param, const QVariant& value); + virtual void setParam(PeptideEvidenceParam param, const QVariant& value); /** \brief get specific parameter value */ - virtual const QVariant getParam(PeptideMatchParam param) const; + virtual const QVariant getParam(PeptideEvidenceParam param) const; - const std::map<PeptideMatchParam, QVariant> & getParamList() const; + const std::map<PeptideEvidenceParam, QVariant> & getParamList() const; void setCharge(unsigned int charge); @@ -133,7 +133,7 @@ private : pappso::pappso_double _exp_mass; unsigned int _charge; IdentificationDataSource* _p_identification_source = nullptr; - std::map<PeptideMatchParam, QVariant> _params; + std::map<PeptideEvidenceParam, QVariant> _params; /** @brief manually checked by user (true by default) */ diff --git a/src/gui/peptide_detail_view/peptidewindow.cpp b/src/gui/peptide_detail_view/peptidewindow.cpp index 4f8011af8..c500a83d4 100644 --- a/src/gui/peptide_detail_view/peptidewindow.cpp +++ b/src/gui/peptide_detail_view/peptidewindow.cpp @@ -138,7 +138,7 @@ void PeptideWindow::updateDisplay() { ui->scan_label->setText(QString("%1").arg(_p_peptide_evidence->getScan())); ui->sample_label->setText(_p_peptide_evidence->getMsRunP()->getSampleName()); ui->modification_label->setText(_p_peptide_evidence->getPeptideXtpSp().get()->getModifString()); - ui->hyperscore_label->setText(_p_peptide_evidence->getParam(PeptideMatchParam::tandem_hyperscore).toString()); + ui->hyperscore_label->setText(_p_peptide_evidence->getParam(PeptideEvidenceParam::tandem_hyperscore).toString()); ui->evalue_label->setText(QString::number(_p_peptide_evidence->getEvalue(), 'g', 4)); ui->mh_label->setText(QString::number(_p_peptide_evidence->getPeptideXtpSp().get()->getMz(1), 'f', 4)); ui->mz_label->setText(QString::number(_p_peptide_evidence->getPeptideXtpSp().get()->getMz(_p_peptide_evidence->getCharge()), 'f', 4)); diff --git a/src/gui/peptide_list_view/peptidetablemodel.cpp b/src/gui/peptide_list_view/peptidetablemodel.cpp index 8dcdeb6d8..840099458 100644 --- a/src/gui/peptide_list_view/peptidetablemodel.cpp +++ b/src/gui/peptide_list_view/peptidetablemodel.cpp @@ -186,7 +186,7 @@ QVariant PeptideTableModel::data(const QModelIndex &index, int role ) const { return QVariant((qreal) _p_protein_match->getPeptideMatchList().at(row).getPeptideEvidence()->getDeltaMass()); break; case (std::int8_t)PeptideListColumn::hyperscore: - return _p_protein_match->getPeptideMatchList().at(row).getPeptideEvidence()->getParam(PeptideMatchParam::tandem_hyperscore); + return _p_protein_match->getPeptideMatchList().at(row).getPeptideEvidence()->getParam(PeptideEvidenceParam::tandem_hyperscore); break; } } diff --git a/src/gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp b/src/gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp index a68a0ad09..94f7d00a9 100644 --- a/src/gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp +++ b/src/gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp @@ -228,7 +228,7 @@ QVariant PtmPeptideTableModel::data(const QModelIndex &index, int role ) const { return QVariant((qreal) _ptm_sample_scan_list.at(row).get()->getRepresentativePeptideMatch().getPeptideEvidence()->getDeltaMass()); break; case (std::int8_t)PtmPeptideListColumn::besthyperscore: - return _ptm_sample_scan_list.at(row).get()->getRepresentativePeptideMatch().getPeptideEvidence()->getParam(PeptideMatchParam::tandem_hyperscore); + return _ptm_sample_scan_list.at(row).get()->getRepresentativePeptideMatch().getPeptideEvidence()->getParam(PeptideEvidenceParam::tandem_hyperscore); break; case (std::int8_t)PtmPeptideListColumn::bestposition: for (unsigned int position :_ptm_sample_scan_list.at(row).get()->getBestPtmPositionList(_p_ptm_grouping_experiment)) { diff --git a/src/input/identificationpwizreader.cpp b/src/input/identificationpwizreader.cpp index 11680a241..ea35b9797 100644 --- a/src/input/identificationpwizreader.cpp +++ b/src/input/identificationpwizreader.cpp @@ -255,7 +255,7 @@ void IdentificationPwizReader::read( QVariant hyperscore = getQVariantDoubleParam(spid_item.get(), pwiz::cv::MS_X_Tandem_hyperscore); if (!hyperscore.isNull()) { - p_peptide_evidence->setParam(PeptideMatchParam::tandem_hyperscore, hyperscore); + p_peptide_evidence->setParam(PeptideEvidenceParam::tandem_hyperscore, hyperscore); } diff --git a/src/input/xpipsaxhandler.cpp b/src/input/xpipsaxhandler.cpp index c1ce0f21a..31f249be1 100644 --- a/src/input/xpipsaxhandler.cpp +++ b/src/input/xpipsaxhandler.cpp @@ -263,7 +263,7 @@ bool XpipSaxHandler::startElement_peptide(QXmlAttributes attributes) { _p_peptide_evidence->setExperimentalMass(exp_mass); _current_peptide_match.setStart(attributes.value("start").simplified().toUInt()-1); _p_peptide_evidence->setCharge(attributes.value("charge").simplified().toUInt()); - _p_peptide_evidence->setParam(PeptideMatchParam::tandem_hyperscore, QVariant( attributes.value("hypercorr").toDouble())); + _p_peptide_evidence->setParam(PeptideEvidenceParam::tandem_hyperscore, QVariant( attributes.value("hypercorr").toDouble())); IdentificationDataSource* p_identification_data_source = _p_project->getIdentificationDataSourceStore().getInstance(attributes.value("sample_file").simplified()).get(); _p_peptide_evidence->setIdentificationDataSource( p_identification_data_source); diff --git a/src/input/xtandemsaxhandler.cpp b/src/input/xtandemsaxhandler.cpp index e24b944d2..2a15bc44b 100644 --- a/src/input/xtandemsaxhandler.cpp +++ b/src/input/xtandemsaxhandler.cpp @@ -299,7 +299,7 @@ bool XtandemSaxHandler::startElement_domain(QXmlAttributes attributes) { _current_peptide_match.setStart(attributes.value("start").simplified().toUInt()-1); _p_peptide_evidence->setCharge(_charge); - _p_peptide_evidence->setParam(PeptideMatchParam::tandem_hyperscore, QVariant( attributes.value("hyperscore").toDouble())); + _p_peptide_evidence->setParam(PeptideEvidenceParam::tandem_hyperscore, QVariant( attributes.value("hyperscore").toDouble())); _p_peptide_evidence->setIdentificationDataSource( _p_identification_data_source); _p_peptide_evidence->setChecked(true); diff --git a/src/input/xtpxpipsaxhandler.cpp b/src/input/xtpxpipsaxhandler.cpp index 90520333e..abf30e56d 100644 --- a/src/input/xtpxpipsaxhandler.cpp +++ b/src/input/xtpxpipsaxhandler.cpp @@ -74,6 +74,8 @@ bool XtpXpipSaxHandler::startElement(const QString & namespaceURI, const QString is_ok = startElement_protein(attributes); } else if (qName == "identification_source") { is_ok = startElement_identification_source(attributes); + } else if (qName == "param") { + is_ok = startElement_param(attributes); } //<sample value="P6_08_10"/> else if (qName == "sample") { @@ -180,6 +182,23 @@ bool XtpXpipSaxHandler::startElement_description(QXmlAttributes attributes) { return true; } + +bool XtpXpipSaxHandler::startElement_param(QXmlAttributes attributes) { + + /* + <param key="0" value="48.5"/> + */ + qDebug() << "startElement_param "; + + if (_sp_current_peptide_evidence.get() != nullptr) { + PeptideEvidenceParam type = static_cast<PeptideEvidenceParam>(attributes.value("key").toUInt()); + _sp_current_peptide_evidence.get()->setParam(type, QVariant( attributes.value("value").toDouble())); + } + + qDebug() << "startElement_param end" ; + return true; +} + bool XtpXpipSaxHandler::startElement_modification(QXmlAttributes attributes) { /* @@ -249,8 +268,8 @@ bool XtpXpipSaxHandler::startElement_peptide_evidence(QXmlAttributes attributes) _p_peptide_evidence->setExperimentalMass(attributes.value("exp_mass").toDouble()); _p_peptide_evidence->setPeptideXtpSp(_map_peptides.at( attributes.value("peptide_id").simplified())); - PeptideEvidenceSp sp_peptide_evidence = sp_ident_source.get()->getPeptideEvidenceStore().getInstance(_p_peptide_evidence); - _map_peptide_evidences.insert(std::pair<QString, PeptideEvidenceSp>(attributes.value("id").simplified(), sp_peptide_evidence)); + _sp_current_peptide_evidence = sp_ident_source.get()->getPeptideEvidenceStore().getInstance(_p_peptide_evidence); + _map_peptide_evidences.insert(std::pair<QString, PeptideEvidenceSp>(attributes.value("id").simplified(), _sp_current_peptide_evidence)); qDebug() << "startElement_peptide_evidence end" ; return true; } diff --git a/src/input/xtpxpipsaxhandler.h b/src/input/xtpxpipsaxhandler.h index 7aff217af..830feef13 100644 --- a/src/input/xtpxpipsaxhandler.h +++ b/src/input/xtpxpipsaxhandler.h @@ -78,6 +78,7 @@ private: bool startElement_identification_source(QXmlAttributes attributes); bool startElement_modification(QXmlAttributes attributes); bool startElement_mod(QXmlAttributes attributes); + bool startElement_param(QXmlAttributes attributes); //bool endElement_identification(); bool endElement_sequence(); bool endElement_protein(); @@ -103,6 +104,7 @@ private: std::map<QString, MsRunSp> _map_msruns; std::map<QString, IdentificationDataSourceSp> _map_ident_sources; std::map<QString, PeptideEvidenceSp> _map_peptide_evidences; + PeptideEvidenceSp _sp_current_peptide_evidence; ProteinXtp _current_protein; PeptideXtpSp _current_peptide_sp; std::map<QString, PeptideXtpSp> _map_peptides; diff --git a/src/output/ods/spectrasheet.cpp b/src/output/ods/spectrasheet.cpp index e4eed6da6..3a815e4c9 100644 --- a/src/output/ods/spectrasheet.cpp +++ b/src/output/ods/spectrasheet.cpp @@ -107,7 +107,7 @@ void SpectraSheet::writeBestPeptideEvidence(const GroupingGroup * p_group,const } } _p_writer->writeCell(p_peptide_evidence->getEvalue()); - _p_writer->writeCell(p_peptide_evidence->getParam(PeptideMatchParam::tandem_hyperscore).toDouble()); + _p_writer->writeCell(p_peptide_evidence->getParam(PeptideEvidenceParam::tandem_hyperscore).toDouble()); } diff --git a/src/output/proticdbml.cpp b/src/output/proticdbml.cpp index c70fb5af5..656eb8505 100644 --- a/src/output/proticdbml.cpp +++ b/src/output/proticdbml.cpp @@ -487,7 +487,7 @@ void ProticdbMl::writePeptideHit(QString xml_id, ProticPeptideHit & protic_pepti writeCvParam("PROTICdbO:0000287", Utils::getXmlDouble(protic_peptide_hit.peptide_match->getPeptideEvidence()->getEvalue()), "xtandem peptide evalue"); - writeCvParam("PROTICdbO:0000288", Utils::getXmlDouble(protic_peptide_hit.peptide_match->getPeptideEvidence()->getParam(PeptideMatchParam::tandem_hyperscore).toDouble()), + writeCvParam("PROTICdbO:0000288", Utils::getXmlDouble(protic_peptide_hit.peptide_match->getPeptideEvidence()->getParam(PeptideEvidenceParam::tandem_hyperscore).toDouble()), "xtandem peptide hyperscore"); } diff --git a/src/output/xpip.cpp b/src/output/xpip.cpp index 43d56b1ff..68be493a2 100644 --- a/src/output/xpip.cpp +++ b/src/output/xpip.cpp @@ -389,11 +389,11 @@ void Xpip::writePeptideEvidence(const PeptideEvidence * p_peptide_evidence) { _output_stream->writeAttribute("checked","false"); } - const std::map<PeptideMatchParam, QVariant> & params = p_peptide_evidence->getParamList(); + const std::map<PeptideEvidenceParam, QVariant> & params = p_peptide_evidence->getParamList(); //if (params.size() > 0) { // _output_stream->writeStartElement("stats"); - for (const std::pair<PeptideMatchParam, QVariant> param_pair: params) { + for (const std::pair<PeptideEvidenceParam, QVariant> param_pair: params) { _output_stream->writeStartElement("param"); _output_stream->writeAttribute("key",QString("%1").arg(static_cast<std::int8_t>(param_pair.first))); _output_stream->writeAttribute("value",param_pair.second.toString()); diff --git a/src/utils/types.h b/src/utils/types.h index 116c3b0f2..32925ba16 100644 --- a/src/utils/types.h +++ b/src/utils/types.h @@ -50,18 +50,18 @@ enum class IdentificationEngine: std::int8_t { peptider=3 ///< peptider }; -/** \def PeptideMatchParam peptide match specific parameters +/** \def PeptideEvidenceParam peptide evidence specific parameters * */ -enum class PeptideMatchParam: std::int8_t { +enum class PeptideEvidenceParam: std::int8_t { tandem_hyperscore=0 ///< X!Tandem hyperscore }; /** \def IdentificationEngineParam identification engine parameters * */ -enum class IdentificationEngineParam { - tandem_param ///< X!Tandem xml parameters file +enum class IdentificationEngineParam: std::int8_t { + tandem_param=0 ///< X!Tandem xml parameters file }; -- GitLab