From 52d4943c54ef60f693bfc4f14a9e826acc334b73 Mon Sep 17 00:00:00 2001 From: Olivier Langella <Olivier.Langella@moulon.inra.fr> Date: Tue, 28 Mar 2017 15:50:39 +0200 Subject: [PATCH] compute corrected Evalue for proteins --- src/core/proteinmatch.cpp | 42 ++++++++++++++++++++++++++++++++++++++- src/core/proteinmatch.h | 33 ++++++++++++++++++++---------- 2 files changed, 64 insertions(+), 11 deletions(-) diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index 9df85654..3a09a982 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -83,7 +83,8 @@ void ProteinMatch::setEvalue(pappso::pappso_double evalue) { } pappso::pappso_double ProteinMatch::getEvalue() const { - return _evalue; + pappso::MsRunIdSp sp_msrun_id; + return getEvalue(sp_msrun_id); } void ProteinMatch::setProteinXtpSp(ProteinXtpSp protein_sp) { _protein_sp = protein_sp; @@ -181,6 +182,45 @@ unsigned int ProteinMatch::countValidAndCheckedPeptideMassCharge(const pappso::M return sequence_list.size(); } +pappso::pappso_double ProteinMatch::getEvalue(const pappso::MsRunIdSp & sp_msrun_id) const { + std::map<QString, pappso::pappso_double> map_sequence_evalue; + for (auto & p_peptide_match : _peptide_match_list) { + if (p_peptide_match->isValidAndChecked()) { + QString sequence(p_peptide_match->getPeptideXtpSp().get()->getSequence()); + pappso::pappso_double evalue = p_peptide_match->getEvalue(); + if(sp_msrun_id.get() != nullptr) { + //within sample + if (p_peptide_match->getMsRunIdSp().get() == sp_msrun_id.get()) { + auto ret = map_sequence_evalue.insert(std::pair<QString, pappso::pappso_double>(sequence, evalue)); + if (ret.second == false) { + if (ret.first->second < evalue) {//get best evalue for sequence + ret.first->second = evalue; + } + } + } + } + else { + //overall samples + auto ret = map_sequence_evalue.insert(std::pair<QString, pappso::pappso_double>(sequence, evalue)); + if (ret.second == false) { + if (ret.first->second < evalue) {//get best evalue for sequence + ret.first->second = evalue; + } + } + } + } + } + + pappso::pappso_double evalue_prot = 1; + for (auto && peptide_pair: map_sequence_evalue) { + //evalue_prot += std::log10(peptide_pair.second); + evalue_prot *= peptide_pair.second; + } + + //return (std::pow ((double) 10.0,evalue_prot)); + return (evalue_prot); + +} pappso::pappso_double ProteinMatch::getPAI() const { pappso::MsRunIdSp sp_msrun_id; diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index d649e355..9460c4c1 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -37,26 +37,37 @@ class IdentificationGroup; class ProteinMatch { - friend IdentificationGroup; + friend IdentificationGroup; public: ProteinMatch(); ~ProteinMatch(); const ProteinXtpSp & getProteinXtpSp() const; void setEvalue(pappso::pappso_double evalue); + + /** @brief compute protein Evalue overall samples + * */ pappso::pappso_double getEvalue() const; - pappso::pappso_double getCoverage() const; - /** @brief compute Protein Abundance Index (PAI) - * overall sample PAI computation (Rappsilber et al. 2002) - * */ + /** @brief compute protein Evalue within samples + * */ + pappso::pappso_double getEvalue(const pappso::MsRunIdSp & sp_msrun_id) const; + + + /** @brief protein coverage overall samples + * */ + pappso::pappso_double getCoverage() const; + + /** @brief compute Protein Abundance Index (PAI) + * overall sample PAI computation (Rappsilber et al. 2002) + * */ pappso::pappso_double getPAI() const; /** @brief compute Protein Abundance Index (PAI) within sample * PAI computation (Rappsilber et al. 2002) * */ pappso::pappso_double getPAI(const pappso::MsRunIdSp & sp_msrun_id) const; - + void setProteinXtpSp(ProteinXtpSp protein_sp); void addPeptideMatch(PeptideMatch * peptide_match); std::vector<PeptideMatch *> & getPeptideMatchList(); @@ -81,17 +92,20 @@ public: const pappso::GrpProteinSp & getGrpProteinSp() const; const GroupingGroupSp & getGroupingGroupSp() const; - + protected : - + /** @brief validate or invalidate peptides and proteins based automatic filters and manual checks * */ void updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters); void setGroupingExperiment(GroupingExperiment * p_grp_experiment); - + void setGroupInstance(GroupStore & group_store); +private : + unsigned int countValidAndCheckedPeptideMassCharge(const pappso::MsRunIdSp & sp_msrun_id) const; + private: pappso::GrpProteinSp _sp_grp_protein; GroupingGroupSp _sp_group; @@ -106,7 +120,6 @@ private: /** @brief automatic filter result (false by default) */ bool _proxy_valid = false; - unsigned int countValidAndCheckedPeptideMassCharge(const pappso::MsRunIdSp & sp_msrun_id) const; }; -- GitLab