From 9b3b8529f42fb72e8b6bbc8c6862d57dd3480191 Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Sun, 17 Dec 2017 13:57:45 +0100 Subject: [PATCH] refactoring --- src/core/identificationgroup.cpp | 14 ++++++++++++-- src/core/identificationgroup.h | 4 ++++ src/core/proteinmatch.cpp | 16 ---------------- src/core/proteinmatch.h | 4 ---- 4 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/core/identificationgroup.cpp b/src/core/identificationgroup.cpp index b833fcf53..71c2ab936 100644 --- a/src/core/identificationgroup.cpp +++ b/src/core/identificationgroup.cpp @@ -231,14 +231,24 @@ std::size_t IdentificationGroup::countSubGroup()const { } void IdentificationGroup::collectMhDelta(std::vector< pappso::pappso_double> & delta_list, pappso::PrecisionUnit unit, ValidationState state) const { - std::set<const PeptideEvidence *> already_counted; + std::set<const PeptideEvidence *> peptide_evidence_list; 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(already_counted, delta_list, unit, state); + //p_protein_match->collectMhDelta(already_counted, delta_list, unit, state); + p_protein_match->collectPeptideEvidences(peptide_evidence_list, state); } } } + for (const PeptideEvidence * p_peptide_evidence: peptide_evidence_list) { + if (unit == pappso::PrecisionUnit::ppm) { + delta_list.push_back(p_peptide_evidence->getPpmDeltaMass()); + } + else { + delta_list.push_back(p_peptide_evidence->getDeltaMass()); + } + } + } void IdentificationGroup::startGrouping (const GroupingType & grouping_type, WorkMonitorInterface * p_work_monitor) { qDebug() << "IdentificationGroup::startGrouping begin "; diff --git a/src/core/identificationgroup.h b/src/core/identificationgroup.h index fcd3e485f..bfb0d532d 100644 --- a/src/core/identificationgroup.h +++ b/src/core/identificationgroup.h @@ -126,6 +126,10 @@ public: bool contains (const MsRun * p_msrun) const; + + /** @brief collect mass delta between theoretical mass and observed mass + * each peptide evidence is only counted once + */ void collectMhDelta(std::vector< pappso::pappso_double> & delta_list, pappso::PrecisionUnit unit, ValidationState state) const; private : diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index 3d43d3d7b..ced11738b 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -445,22 +445,6 @@ void ProteinMatch::setGroupInstance(GroupStore & group_store) { } -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) { - const PeptideEvidence * p_peptide_evidence = peptide_match.getPeptideEvidence(); - if ((p_peptide_evidence->getValidationState() >= state)&&(already_counted.find(p_peptide_evidence) == already_counted.end())) { - if (unit == pappso::PrecisionUnit::ppm) { - delta_list.push_back(p_peptide_evidence->getPpmDeltaMass()); - } - else { - delta_list.push_back(p_peptide_evidence->getDeltaMass()); - } - - already_counted.insert(p_peptide_evidence); - } - } -} - void ProteinMatch::collectPeptideEvidences(std::set<const PeptideEvidence *> & peptide_evidence_set, ValidationState state) const { for (auto & peptide_match : _peptide_match_list) { const PeptideEvidence * p_peptide_evidence = peptide_match.getPeptideEvidence(); diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index 22c31745c..37ccefb7e 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -114,10 +114,6 @@ public: * */ void updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters); - /** @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 collect distinct peptide evidences */ -- GitLab