From a9ecf09d0ff051b6d665eaf31985e3096634a13d Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Sat, 16 Dec 2017 22:58:25 +0100 Subject: [PATCH] change in mass delta compute : a peptide evidence is only counted once --- src/core/identificationgroup.cpp | 4 ++-- src/core/proteinmatch.cpp | 10 ++++++---- src/core/proteinmatch.h | 6 +++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/core/identificationgroup.cpp b/src/core/identificationgroup.cpp index be027124b..ccc3f1ad0 100644 --- a/src/core/identificationgroup.cpp +++ b/src/core/identificationgroup.cpp @@ -209,11 +209,11 @@ std::size_t IdentificationGroup::countSubGroup()const { } void IdentificationGroup::collectMhDelta(std::vector< pappso::pappso_double> & delta_list, pappso::PrecisionUnit unit, ValidationState state) const { - std::set<PeptideEvidence *> already_counted; + std::set<const PeptideEvidence *> already_counted; for (auto & p_protein_match : _protein_match_list) { if (p_protein_match->getValidationState() >= state) { if (!p_protein_match->getProteinXtpSp().get()->isDecoy()) { - p_protein_match->collectMhDelta(delta_list, unit, state); + p_protein_match->collectMhDelta(already_counted, delta_list, unit, state); } } } diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index 392ef2885..8d978579f 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -445,17 +445,19 @@ void ProteinMatch::setGroupInstance(GroupStore & group_store) { } -void ProteinMatch::collectMhDelta(std::vector< pappso::pappso_double> & delta_list, pappso::PrecisionUnit unit, ValidationState state) const { +void ProteinMatch::collectMhDelta(std::set< const PeptideEvidence *> & already_counted, std::vector< pappso::pappso_double> & delta_list, pappso::PrecisionUnit unit, ValidationState state) const { for (auto & peptide_match : _peptide_match_list) { - if (peptide_match.getPeptideEvidence()->getValidationState() >= state) { - pappso::pappso_double diff = peptide_match.getPeptideEvidence()->getDeltaMass(); + const PeptideEvidence * p_peptide_evidence = peptide_match.getPeptideEvidence(); + if ((p_peptide_evidence->getValidationState() >= state)&&(already_counted.find(p_peptide_evidence) == already_counted.end())) { + pappso::pappso_double diff = p_peptide_evidence->getDeltaMass(); if (unit == pappso::PrecisionUnit::ppm) { while (diff < -0.5) { diff = diff + pappso::DIFFC12C13; } - diff = (diff / peptide_match.getPeptideEvidence()->getPeptideXtpSp().get()->getMz(1)) * pappso::ONEMILLION; + diff = (diff / p_peptide_evidence->getPeptideXtpSp().get()->getMz(1)) * pappso::ONEMILLION; } delta_list.push_back(diff); + already_counted.insert(p_peptide_evidence); } } } diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index e397ea51a..aaee5c199 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -23,6 +23,7 @@ #include <QColor> #include <vector> +#include <set> #include <pappsomspp/types.h> #include "proteinxtp.h" #include "peptidematch.h" @@ -113,7 +114,10 @@ public: * */ void updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters); - void collectMhDelta(std::vector< pappso::pappso_double> & delta_list, pappso::PrecisionUnit unit, ValidationState state) const; + /** @brief collect mass delta between theoretical mass and observed mass + * each peptide evidence is only counted once + */ + void collectMhDelta(std::set<const PeptideEvidence *> & already_counted, std::vector< pappso::pappso_double> & delta_list, pappso::PrecisionUnit unit, ValidationState state) const; /** @brief count distinct sequence taking into account equivalence between Leucine and Isoleucine * @param state validation state of peptides to count -- GitLab