From ee378003d766fbf779c2ccf2a48cfa58fe291f50 Mon Sep 17 00:00:00 2001 From: Olivier Langella <Olivier.Langella@moulon.inra.fr> Date: Sat, 29 Apr 2017 14:24:53 +0200 Subject: [PATCH] parameters added to peptide match, hyperscore column in ODS spectra --- src/core/peptidematch.cpp | 15 ++++++++++++++- src/core/peptidematch.h | 10 ++++++++++ src/input/xpipsaxhandler.cpp | 1 + src/input/xtandemsaxhandler.cpp | 2 ++ src/utils/types.h | 7 +++++++ 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/core/peptidematch.cpp b/src/core/peptidematch.cpp index 2bcde69a5..2c92fc785 100644 --- a/src/core/peptidematch.cpp +++ b/src/core/peptidematch.cpp @@ -45,7 +45,20 @@ void PeptideMatch::setRetentionTime(pappso::pappso_double rt) { void PeptideMatch::setEvalue(pappso::pappso_double evalue) { _evalue = evalue; } - + + /** \brief set specific parameter value + */ +void PeptideMatch::setParam(PeptideMatchParam param, const QVariant& value) { + _params.insert(std::pair<PeptideMatchParam, QVariant>(param, value)); +} +const QVariant PeptideMatch::getParam(PeptideMatchParam param) const { + try { + return _params.at(param); + } + catch (std::out_of_range) { + return QVariant(); + } +} std::size_t PeptideMatch::getHashPeptideMassSample() const { return PeptideMatch::_hash_fn (QString("%1 %2").arg(_peptide_sp.get()->toAbsoluteString()).arg(_msrunid_sp->getXmlId()).toStdString()); diff --git a/src/core/peptidematch.h b/src/core/peptidematch.h index 42bcbabfe..573442a6a 100644 --- a/src/core/peptidematch.h +++ b/src/core/peptidematch.h @@ -42,6 +42,15 @@ public : void setEvalue(pappso::pappso_double evalue); void setExperimentalMass(pappso::pappso_double exp_mass); + + /** \brief set specific parameter value + */ + virtual void setParam(PeptideMatchParam param, const QVariant& value); + /** \brief get specific parameter value + */ + virtual const QVariant getParam(PeptideMatchParam param) const; + + /** @brief set start position of this peptide inside the protein sequence * @param start position in the protein amino acid sequence (starts at 0) * */ @@ -94,6 +103,7 @@ private : unsigned int _start=0; unsigned int _charge; IdentificationDataSource* _p_identification_source = nullptr; + std::map<PeptideMatchParam, QVariant> _params; /** @brief manually checked by user (true by default) */ diff --git a/src/input/xpipsaxhandler.cpp b/src/input/xpipsaxhandler.cpp index a8f9b20c5..c9288cd27 100644 --- a/src/input/xpipsaxhandler.cpp +++ b/src/input/xpipsaxhandler.cpp @@ -239,6 +239,7 @@ bool XpipSaxHandler::startElement_peptide(QXmlAttributes attributes) { _p_peptide_match->setExperimentalMass(exp_mass); _p_peptide_match->setStart(attributes.value("start").simplified().toUInt()-1); _p_peptide_match->setCharge(attributes.value("charge").simplified().toUInt()); + _p_peptide_match->setParam(PeptideMatchParam::tandem_hyperscore, QVariant( attributes.value("hypercorr").toDouble())); IdentificationDataSource* p_identification_data_source = _p_project->getIdentificationDataSourceStore().getInstance(attributes.value("sample_file").simplified()).get(); _p_peptide_match->setIdentificationDataSource( p_identification_data_source); diff --git a/src/input/xtandemsaxhandler.cpp b/src/input/xtandemsaxhandler.cpp index 58c59468c..acef364d2 100644 --- a/src/input/xtandemsaxhandler.cpp +++ b/src/input/xtandemsaxhandler.cpp @@ -293,6 +293,8 @@ bool XtandemSaxHandler::startElement_domain(QXmlAttributes attributes) { _p_peptide_match->setExperimentalMass(exp_mass); _p_peptide_match->setStart(attributes.value("start").simplified().toUInt()-1); _p_peptide_match->setCharge(_charge); + + _p_peptide_match->setParam(PeptideMatchParam::tandem_hyperscore, QVariant( attributes.value("hyperscore").toDouble())); _p_peptide_match->setIdentificationDataSource( _p_identification_data_source); _p_peptide_match->setChecked(true); diff --git a/src/utils/types.h b/src/utils/types.h index aa354e8cd..7244df994 100644 --- a/src/utils/types.h +++ b/src/utils/types.h @@ -37,6 +37,13 @@ enum class IdentificationEngine { peptider ///< peptider }; +/** \def PeptideMatchParam peptide match specific parameters + * + */ +enum class PeptideMatchParam { + tandem_hyperscore ///< X!Tandem hyperscore +}; + /** \def IdentificationEngineParam identification engine parameters * */ -- GitLab