diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index 9df856540f0dde85e4eccabacc999f1b8603d4f9..3a09a982f2db56840d2756b1c63e000681b499a4 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 d649e35533d39a7f5bd19c29829c4defb5877473..9460c4c14fe2148c91213c23e5eb9fdc12289771 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; };