Skip to content
Snippets Groups Projects
Commit feb7697e authored by Langella Olivier's avatar Langella Olivier
Browse files

compute FDR on peptide evidence instead of peptide match

parent 7e6c70f0
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
......@@ -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)
* */
......
......@@ -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);
}
}
}
......@@ -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
......
......@@ -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)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment