diff --git a/src/core/peptideevidence.cpp b/src/core/peptideevidence.cpp index bd9d6a306883925014fb9c39022ebdb695d66f50..2ca7d6b3e79c30c26c79210b16ab85870a160740 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 b294cd57fa405aa0e44d9363326348791a4b3752..89f1771b6503e9331f33869afb8f76ad99b88371 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 4f8011af83ae13e58067d3ac407018c43d13f14d..c500a83d4706236df20c3f567def50c03ce26cb2 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 8dcdeb6d836be36a3ae30713a2f5d1c4e214cc39..84009945814b1b1b2b6c4393a1e6a4da8802f94b 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 a68a0ad096b48073ed56b554bb33cdb356a0b211..94f7d00a9d6d91e2c1c08c192b5df75406d4a540 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 11680a241f4941f21e86f201e977083ec057faf3..ea35b97974bc5248d587bcfe532c18f2d4f38ccd 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 c1ce0f21a8d4889588eaa66b60b943c557207786..31f249be1693381adcc2a03f4ea629ae065d47d9 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 e24b944d2b2f54943264c1efd235ed64689e5c6f..2a15bc44b413ee558499360ef5cd3eb3f22346c7 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 90520333e33ccfa02c24a8eeea68c4bd08afbbee..abf30e56d7fec1f8fe4774c500d686bf0f40a4bc 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 7aff217af3a5f2633e58e830f104dc1f31c80bf1..830feef135dbc906cb13643d08e789fbebeed69a 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 e4eed6da624aa158c7de9c9abbdff6c9f363444b..3a815e4c92e81c9bbfe82121f0374d8dab5dc9f6 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 c70fb5af5389c5dbb96454794bc5b6cc2bbc70cd..656eb8505e0448e56ffb8f3cba3ece441821a577 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 43d56b1ff4b0171c8338dce1681834f6b95dba9a..68be493a2e7dc5017b2247bf5a83b5b5c0810923 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 116c3b0f2f97467bd333479ee91cd411270ef21a..32925ba169a745d8831438416d5f9b1226b9cb37 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 };