diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index 9f2973d42b199bf0fcf433ea71435f98b05a6677..343155ed6c808cf9b953d6b03cd99d6a69d83da5 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -419,7 +419,8 @@ ProteinMatch::countDistinctMsSamples(ValidationState state) const unsigned int ProteinMatch::countPeptideMassCharge(ValidationState state, - const MsRun *sp_msrun_id) const + const MsRun *sp_msrun_id, + const Label *p_label) const { std::set<QString> sequence_list; for(auto &peptide_match : _peptide_match_list) @@ -431,19 +432,44 @@ ProteinMatch::countPeptideMassCharge(ValidationState state, // within sample if(peptide_match.getPeptideEvidence()->getMsRunP() == sp_msrun_id) { - sequence_list.insert( - QString("%1-%2-%3") - .arg(peptide_match.getPeptideEvidence() - ->getPeptideXtpSp() - .get() - ->getNativePeptideP() - ->getSequenceLi()) - .arg(peptide_match.getPeptideEvidence() - ->getPeptideXtpSp() - .get() - ->getNativePeptideP() - ->getMass()) - .arg(peptide_match.getPeptideEvidence()->getCharge())); + if(p_label != nullptr) + { + if(peptide_match.getPeptideEvidence()->getPeptideXtpSp().get()->getLabel() == + p_label) + { + sequence_list.insert( + QString("%1-%2-%3") + .arg(peptide_match.getPeptideEvidence() + ->getPeptideXtpSp() + .get() + ->getNativePeptideP() + ->getSequenceLi()) + .arg(peptide_match.getPeptideEvidence() + ->getPeptideXtpSp() + .get() + ->getNativePeptideP() + ->getMass()) + .arg(peptide_match.getPeptideEvidence() + ->getCharge())); + } + } + else + { + sequence_list.insert( + QString("%1-%2-%3") + .arg(peptide_match.getPeptideEvidence() + ->getPeptideXtpSp() + .get() + ->getNativePeptideP() + ->getSequenceLi()) + .arg(peptide_match.getPeptideEvidence() + ->getPeptideXtpSp() + .get() + ->getNativePeptideP() + ->getMass()) + .arg( + peptide_match.getPeptideEvidence()->getCharge())); + } } } else @@ -571,13 +597,13 @@ ProteinMatch::getProtoNsaf(const MsRun *sp_msrun_id) const } pappso::pappso_double -ProteinMatch::getPAI(const MsRun *sp_msrun_id) const +ProteinMatch::getPAI(const MsRun *sp_msrun_id, const Label *p_label) const { try { pappso::pappso_double PAI = (pappso::pappso_double)countPeptideMassCharge( - ValidationState::validAndChecked, sp_msrun_id) / + ValidationState::validAndChecked, sp_msrun_id, p_label) / (pappso::pappso_double)_protein_sp.get()->countTrypticPeptidesForPAI(); return PAI; } diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index aa2bbf0f5d83fae50e11a214a01598aa15a62206..e99e2ef5f3534552679ba73248d5c9ad50912589 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -89,7 +89,8 @@ class ProteinMatch /** @brief compute Protein Abundance Index (PAI) within sample * PAI computation (Rappsilber et al. 2002) * */ - pappso::pappso_double getPAI(const MsRun *sp_msrun_id = nullptr) const; + pappso::pappso_double getPAI(const MsRun *sp_msrun_id = nullptr, + const Label *p_label = nullptr) const; /** @brief compute emPAI within sample * Ishihama 2005 @@ -172,7 +173,8 @@ class ProteinMatch * @param p_msrun_id count within the specified sample */ unsigned int countPeptideMassCharge(ValidationState state, - const MsRun *sp_msrun_id = nullptr) const; + const MsRun *sp_msrun_id = nullptr, + const Label *p_label = nullptr) const; /** @brief count distinct MS samples in which the protein is observed * @param state validation state of peptides to count diff --git a/src/output/ods/comparspectrasheet.cpp b/src/output/ods/comparspectrasheet.cpp index 8b58f40c68e7890e08bb49a7c6bddec2e9aad09f..b2fe6ae6f1e0a09b1bfd9a94a00deb03c8407d58 100644 --- a/src/output/ods/comparspectrasheet.cpp +++ b/src/output/ods/comparspectrasheet.cpp @@ -91,7 +91,7 @@ ComparPaiSheet::writeComparValue(const ProteinMatch *p_protein_match, const Label *p_label) { qDebug() << "ComparPaiSheet::writeComparValue begin"; - _p_writer->writeCell(p_protein_match->getPAI(p_msrun)); + _p_writer->writeCell(p_protein_match->getPAI(p_msrun, p_label)); qDebug() << "ComparPaiSheet::writeComparValue end"; }