From 8ea82da7ae2e824ed192e7b42ce7a22468d45d79 Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Thu, 18 Oct 2018 16:17:27 +0200 Subject: [PATCH] countSampleScan is able to count dictinctive labels --- src/core/proteinmatch.cpp | 25 ++++++++++++++++++++----- src/core/proteinmatch.h | 3 ++- src/output/ods/comparspectrasheet.cpp | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index 908c11ca..360b897c 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -283,7 +283,8 @@ ProteinMatch::getPeptideMatchList(ValidationState state, unsigned int ProteinMatch::countSampleScan(ValidationState state, - const MsRun *p_msrun_id) const + const MsRun *p_msrun_id, + const Label *p_label) const { std::vector<std::size_t> count_sample_scan; for(auto &peptide_match : _peptide_match_list) @@ -299,10 +300,23 @@ ProteinMatch::countSampleScan(ValidationState state, } else { - if(p_peptide_evidence->getMsRunP() == p_msrun_id) + if(p_label != nullptr) + { + if((p_peptide_evidence->getMsRunP() == p_msrun_id) && + (p_peptide_evidence->getPeptideXtpSp().get()->getLabel() == + p_label)) + { + count_sample_scan.push_back( + p_peptide_evidence->getHashSampleScan()); + } + } + else { - count_sample_scan.push_back( - p_peptide_evidence->getHashSampleScan()); + if(p_peptide_evidence->getMsRunP() == p_msrun_id) + { + count_sample_scan.push_back( + p_peptide_evidence->getHashSampleScan()); + } } } } @@ -316,7 +330,8 @@ unsigned int ProteinMatch::countPeptideMatch(ValidationState state) const { return std::count_if( - _peptide_match_list.begin(), _peptide_match_list.end(), + _peptide_match_list.begin(), + _peptide_match_list.end(), [state](const PeptideMatch &peptide_match) { if(peptide_match.getPeptideEvidence()->getValidationState() >= state) { diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index 015977cd..7bb8efd8 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -127,7 +127,8 @@ class ProteinMatch * identification */ unsigned int countSampleScan(ValidationState state, - const MsRun *p_msrun_id = nullptr) const; + const MsRun *p_msrun_id = nullptr, + const Label *p_label = nullptr) const; /** @brief count peptide (peptide+mass) */ diff --git a/src/output/ods/comparspectrasheet.cpp b/src/output/ods/comparspectrasheet.cpp index cafc0fad..2a94fe0f 100644 --- a/src/output/ods/comparspectrasheet.cpp +++ b/src/output/ods/comparspectrasheet.cpp @@ -50,7 +50,7 @@ ComparSpectraSheet::writeComparValue(const ProteinMatch *p_protein_match, const Label *p_label) { qDebug() << "ComparSpectraSheet::writeComparValue begin"; - _p_writer->writeCell(p_protein_match->countSampleScan(state, p_msrun)); + _p_writer->writeCell(p_protein_match->countSampleScan(state, p_msrun,p_label)); qDebug() << "ComparSpectraSheet::writeComparValue end"; } -- GitLab