diff --git a/src/core/identificationgroup.cpp b/src/core/identificationgroup.cpp index ccc3f1ad01cdf101ac3d7744fb6fed88cca9291b..b833fcf53070eec33b935c22f24ca744c5ec77f7 100644 --- a/src/core/identificationgroup.cpp +++ b/src/core/identificationgroup.cpp @@ -89,17 +89,6 @@ unsigned int IdentificationGroup::countDecoyPeptideMassSample(ValidationState st } -unsigned int IdentificationGroup::countDecoyPeptideMatch(ValidationState state) const { - unsigned int i=0; - for (auto & p_protein_match : _protein_match_list) { - if (p_protein_match->getValidationState() >= state) { - if (p_protein_match->getProteinXtpSp().get()->isDecoy()) { - i+=p_protein_match->countPeptideMatch(state); - } - } - } - return i; -} unsigned int IdentificationGroup::countDecoyProteinMatch(ValidationState state) const { return std::count_if (_protein_match_list.begin(), _protein_match_list.end(), [state](const ProteinMatch * p_protein_match) { if ((p_protein_match->getProteinXtpSp().get()->isDecoy()) && (p_protein_match->getValidationState() >= state)) { @@ -111,6 +100,28 @@ unsigned int IdentificationGroup::countDecoyProteinMatch(ValidationState state) }); } +unsigned int IdentificationGroup::countPeptideEvidence(ValidationState state) const { + std::set<const PeptideEvidence *> peptide_evidence_set; + for (auto & p_protein_match : _protein_match_list) { + if (p_protein_match->getValidationState() >= state) { + p_protein_match->collectPeptideEvidences(peptide_evidence_set,state); + } + } + return peptide_evidence_set.size(); +} + +unsigned int IdentificationGroup::countDecoyPeptideEvidence(ValidationState state) const { + std::set<const PeptideEvidence *> peptide_evidence_set; + for (auto & p_protein_match : _protein_match_list) { + if (p_protein_match->getValidationState() >= state) { + if (p_protein_match->getProteinXtpSp().get()->isDecoy()) { + p_protein_match->collectPeptideEvidences(peptide_evidence_set,state); + } + } + } + return peptide_evidence_set.size(); +} + unsigned int IdentificationGroup::countPeptideMatch(ValidationState state) const { unsigned int i=0; for (auto & p_protein_match : _protein_match_list) { @@ -121,6 +132,17 @@ unsigned int IdentificationGroup::countPeptideMatch(ValidationState state) const return i; } +unsigned int IdentificationGroup::countDecoyPeptideMatch(ValidationState state) const { + unsigned int i=0; + for (auto & p_protein_match : _protein_match_list) { + if (p_protein_match->getValidationState() >= state) { + if (p_protein_match->getProteinXtpSp().get()->isDecoy()) { + i+=p_protein_match->countPeptideMatch(state); + } + } + } + return i; +} unsigned int IdentificationGroup::countProteinMatch(ValidationState state) const { return std::count_if (_protein_match_list.begin(), _protein_match_list.end(), [state](const ProteinMatch * p_protein_match) { if (p_protein_match->getValidationState() >= state) { diff --git a/src/core/identificationgroup.h b/src/core/identificationgroup.h index 243f77811c8cbe52fa210f526f65e130125ed704..fcd3e485f5418afe87b5b80c4c07fc99d5f70a3f 100644 --- a/src/core/identificationgroup.h +++ b/src/core/identificationgroup.h @@ -70,6 +70,14 @@ public: /** @brief count decoy proteins * */ unsigned int countDecoyProteinMatch(ValidationState state) const; + + /** @brief count peptide evidences (peptide spectrum match + identification engine) + * */ + unsigned int countPeptideEvidence(ValidationState state) const; + + /** @brief count peptide evidences (peptide spectrum match + identification engine) + * */ + unsigned int countDecoyPeptideEvidence(ValidationState state) const; /** @brief count peptide match (peptide spectrum match + protein match) * */ diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index 8d978579f28f544edb5afbdc1af84d274fce6ce1..7fb0b3e6af76abbe3ac30651cff30ea97762329e 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -128,7 +128,7 @@ void ProteinMatch::setChecked(bool arg1) { } void ProteinMatch::addPeptideMatch(const PeptideMatch & peptide_match) { - //qDebug() << "ProteinMatch::addPeptideMatch begin " << peptide_match.getPeptideEvidence()->getPeptideXtpSp().get()->toAbsoluteString(); + //qDebug() << "ProteinMatch::addPeptideMatch begin " << peptide_match.getPeptideEvidence()->getPeptideXtpSp().get()->toAbsoluteString(); _peptide_match_list.push_back(peptide_match); } @@ -461,3 +461,12 @@ void ProteinMatch::collectMhDelta(std::set< const PeptideEvidence *> & already_c } } } + +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(); + if (p_peptide_evidence->getValidationState() >= state) { + peptide_evidence_set.insert(p_peptide_evidence); + } + } +} diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index aaee5c199fa240a0e25897cfbedd55b34876d7df..22c31745cdeafce35d9f62345cb018338d2beb08 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -119,6 +119,10 @@ public: */ 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 + */ + void collectPeptideEvidences(std::set<const PeptideEvidence *> & peptide_evidence_set, ValidationState state) const; + /** @brief count distinct sequence taking into account equivalence between Leucine and Isoleucine * @param state validation state of peptides to count * @param p_msrun_id count within the specified sample diff --git a/src/gui/project_view/projectwindow.cpp b/src/gui/project_view/projectwindow.cpp index a85144445d2074d7b00f50eac2731ab1b15f53a2..bcbfed3087acec0b9b6896df02df1237bcbaaaff 100644 --- a/src/gui/project_view/projectwindow.cpp +++ b/src/gui/project_view/projectwindow.cpp @@ -215,10 +215,8 @@ void ProjectWindow::computeFdr(ValidationState state) { for (IdentificationGroup * identification_group : _project_sp.get()->getIdentificationGroupList()) { total_prot += identification_group->countProteinMatch(state); false_prot += identification_group->countDecoyProteinMatch(state); - //total_peptide += identification_group->countPeptideMatch(state); - //false_peptide += identification_group->countDecoyPeptideMatch(state); - total_peptide += identification_group->countPeptideMassSample(state); - false_peptide += identification_group->countDecoyPeptideMassSample(state); + total_peptide += identification_group->countPeptideEvidence(state); + false_peptide += identification_group->countDecoyPeptideEvidence(state); } if (state == ValidationState::grouped) { ui->grouped_protein_fdr_label->setText(QString("%1 %").arg(QString::number((false_prot/total_prot)*100.0,'f',2)));