diff --git a/src/core/peptidematch.cpp b/src/core/peptidematch.cpp index da24a53c99ba3b66cff75e0ffa572783b2d52d5b..49fedbac14aa642656cf2f4a03834d2e03f8e56a 100644 --- a/src/core/peptidematch.cpp +++ b/src/core/peptidematch.cpp @@ -59,7 +59,7 @@ void PeptideMatch::setCharge(unsigned int charge) { _charge =charge; } -void PeptideMatch::setPeptideSp (pappso::PeptideSp peptide) { +void PeptideMatch::setPeptideXtpSp (PeptideXtpSp peptide) { _peptide_sp = peptide; } @@ -93,7 +93,7 @@ unsigned int PeptideMatch::getCharge() const { return _charge; } -const pappso::PeptideSp & PeptideMatch::getPeptideSp() const { +const PeptideXtpSp & PeptideMatch::getPeptideXtpSp() const { return _peptide_sp; } diff --git a/src/core/peptidematch.h b/src/core/peptidematch.h index c1eddbb63105163562491024040563c03f7af7b4..61fe5c1c0bfd6174a2b39e43903421e8ff875434 100644 --- a/src/core/peptidematch.h +++ b/src/core/peptidematch.h @@ -25,7 +25,7 @@ #define PEPTIDEMATCH_H #include <pappsomspp/msrun/msrunid.h> #include <pappsomspp/types.h> -#include <pappsomspp/peptide/peptide.h> +#include "peptidextp.h" #include "identification_sources/identificationdatasource.h" #include "automaticfilterparameters.h" @@ -49,7 +49,7 @@ public : * */ unsigned int getStart() const; void setCharge(unsigned int charge); - void setPeptideSp (pappso::PeptideSp peptide); + void setPeptideXtpSp (PeptideXtpSp peptide); void setIdentificationDataSource(IdentificationDataSource* identification_source); void setChecked(bool arg1); bool isChecked() const; @@ -61,7 +61,7 @@ public : unsigned int getScan() const; pappso::pappso_double getRetentionTime() const; unsigned int getCharge() const; - const pappso::PeptideSp & getPeptideSp() const; + const PeptideXtpSp & getPeptideXtpSp() const; pappso::pappso_double getEvalue() const; void setGrpPeptideSp(const pappso::GrpPeptideSp & sp_grp_peptide); @@ -75,7 +75,7 @@ private : pappso::MsRunIdSp _msrunid_sp; unsigned int _scan; pappso::GrpPeptideSp _sp_grp_peptide; - pappso::PeptideSp _peptide_sp; + PeptideXtpSp _peptide_sp; pappso::pappso_double _rt; pappso::pappso_double _evalue; pappso::pappso_double _exp_mass; diff --git a/src/core/peptidextp.cpp b/src/core/peptidextp.cpp index 87db6ca7926bb8bc166c91f480eb6ae587095d1e..f1a4c51062539e7830a5981531721d2431744955 100644 --- a/src/core/peptidextp.cpp +++ b/src/core/peptidextp.cpp @@ -42,3 +42,8 @@ PeptideXtp::~PeptideXtp() PeptideXtpSp PeptideXtp::makePeptideXtpSp() const { return std::make_shared<PeptideXtp>(*this); } + + +pappso::mz PeptideXtp::getGroupingMass() const { + return getMass(); +} diff --git a/src/core/peptidextp.h b/src/core/peptidextp.h index 8b8ddd55f5d4ed11aa9f8bc6521d86d53e81ddf6..4b428681ad5a1d356535934af9e34f36cc8620be 100644 --- a/src/core/peptidextp.h +++ b/src/core/peptidextp.h @@ -40,6 +40,11 @@ public: ~PeptideXtp(); PeptideXtpSp makePeptideXtpSp() const; + /** \brief get the tehoretical mass to use for grouping + * This mass might be different than the true peptide mass to recognize that a tagged + * peptide with taget modification is a light, inter or heavy version of the same peptide + */ + pappso::mz getGroupingMass() const; }; diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index f035edbc52f26df9f71945d246ce5aa9cb845855..83871216e2ee3cb3713191efea442467e8fed56b 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -24,6 +24,7 @@ #include "proteinmatch.h" #include <pappsomspp/msrun/msrunid.h> #include <pappsomspp/grouping/grpprotein.h> +#include <set> ProteinMatch::ProteinMatch() @@ -136,6 +137,26 @@ const pappso::GrpProteinSp & ProteinMatch::getGrpProteinSp() const { return _sp_grp_protein; } +size_t ProteinMatch::countValidSpectrum()const { + return std::count_if (_peptide_match_list.begin(), _peptide_match_list.end(), [](const PeptideMatch * p_peptide_match) { + return (p_peptide_match->isValid()); + }); +} + +size_t ProteinMatch::countValidAndCheckedSpectrum()const { + return std::count_if (_peptide_match_list.begin(), _peptide_match_list.end(), [](const PeptideMatch * p_peptide_match) { + return (p_peptide_match->isValidAndChecked()); + }); +} +size_t ProteinMatch::countUniqueSequence()const { + std::set<QString> sequence_list; + for (auto & p_peptide_match : _peptide_match_list) { + if (p_peptide_match->isValidAndChecked()) { + sequence_list.insert(p_peptide_match->getPeptideXtpSp().get()->getSequence()); + } + } + return sequence_list.size(); +} pappso::pappso_double ProteinMatch::getCoverage() const { size_t prot_size = _protein_sp.get()->size(); @@ -144,7 +165,7 @@ pappso::pappso_double ProteinMatch::getCoverage() const { bool cover_bool[prot_size] = {false}; for (auto & p_peptide_match : _peptide_match_list) { if (p_peptide_match->isValidAndChecked()) { - size_t size = p_peptide_match->getPeptideSp().get()->size(); + size_t size = p_peptide_match->getPeptideXtpSp().get()->size(); size_t offset = p_peptide_match->getStart(); if (offset >= 0) { for (size_t i=0; (i < size) && (offset < prot_size) ; i++,offset++) { diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index 55ceae9ac26a3610bb27d5e210272f6805c3d340..ea42eba339682c61d6f9287f67d8f9d4747a8c73 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -50,12 +50,25 @@ public: bool isValid() const; bool isValidAndChecked() const; + /** @brief count valid spectrums + * */ + size_t countValidSpectrum()const; + + /** @brief count valid and manually checked spectrums + * */ + size_t countValidAndCheckedSpectrum()const; + /** @brief count unique identified sequences (from valid and cheked spectrums) + * */ + size_t countUniqueSequence()const; + + + /** @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); - + const pappso::GrpProteinSp & getGrpProteinSp() const; private: diff --git a/src/grouping/groupingpeptidemass.cpp b/src/grouping/groupingpeptidemass.cpp index 8368af9d7c0868f1123c09bf8c3db25e61206cb4..b9d690fbbe89da467b5cb12535b01204858b2f4d 100644 --- a/src/grouping/groupingpeptidemass.cpp +++ b/src/grouping/groupingpeptidemass.cpp @@ -44,7 +44,7 @@ pappso::GrpProteinSp & GroupingPeptideMass::getGrpProteinSp(ProteinMatch* p_prot } pappso::GrpPeptideSp & GroupingPeptideMass::setGrpPeptide(pappso::GrpProteinSp proteinSp, PeptideMatch* p_peptide_match) { - return _p_grp_experiment->setGrpPeptide(proteinSp,p_peptide_match->getPeptideSp().get()->getSequence(), p_peptide_match->getPeptideSp().get()->getMass()); + return _p_grp_experiment->setGrpPeptide(proteinSp,p_peptide_match->getPeptideXtpSp().get()->getSequence(), p_peptide_match->getPeptideXtpSp().get()->getGroupingMass()); } void GroupingPeptideMass::startGrouping() { diff --git a/src/gui/peptide_list_view/peptidetablemodel.cpp b/src/gui/peptide_list_view/peptidetablemodel.cpp index 261e871b6f062f5cca58c4f573681fd73560a71c..933a843dc1f7b99acbeaa98d27524cb9c70bd6f5 100644 --- a/src/gui/peptide_list_view/peptidetablemodel.cpp +++ b/src/gui/peptide_list_view/peptidetablemodel.cpp @@ -169,7 +169,7 @@ QVariant PeptideTableModel::data(const QModelIndex &index, int role ) const { return QVariant ((quint8) _p_protein_match->getPeptideMatchList().at(row)->getCharge()); } if (col ==6) { - return _p_protein_match->getPeptideMatchList().at(row)->getPeptideSp().get()->getSequence(); + return _p_protein_match->getPeptideMatchList().at(row)->getPeptideXtpSp().get()->getSequence(); } } return QString("Row%1, Column%2") diff --git a/src/gui/protein_list_view/proteintablemodel.cpp b/src/gui/protein_list_view/proteintablemodel.cpp index 711528c84d68b0503800ab83cfd2107e01f57ef4..2b210092aa06f4d18f1c2a17824c831f0fe50108 100644 --- a/src/gui/protein_list_view/proteintablemodel.cpp +++ b/src/gui/protein_list_view/proteintablemodel.cpp @@ -127,7 +127,7 @@ int ProteinTableModel::rowCount(const QModelIndex &parent ) const { return 0; } int ProteinTableModel::columnCount(const QModelIndex &parent ) const { - return 7; + return 8; } QVariant ProteinTableModel::headerData(int section, Qt::Orientation orientation, int role) const { @@ -149,6 +149,8 @@ QVariant ProteinTableModel::headerData(int section, Qt::Orientation orientation, case 5: return QString("spectrum"); case 6: + return QString("unique"); + case 7: return QString("coverage"); } } @@ -203,9 +205,12 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const { } if (col == 5) { - return QVariant ((quint16) _p_identification_group->getProteinMatchList().at(row)->getPeptideMatchList().size()); + return QVariant ((quint16) _p_identification_group->getProteinMatchList().at(row)->countValidAndCheckedSpectrum()); } if (col == 6) { + return QVariant ((quint16) _p_identification_group->getProteinMatchList().at(row)->countUniqueSequence()); + } + if (col == 7) { return QVariant ((qreal)_p_identification_group->getProteinMatchList().at(row)->getCoverage()); } diff --git a/src/input/xpipsaxhandler.cpp b/src/input/xpipsaxhandler.cpp index bfa87f107e6b45a57db1ecf5823735c0fc3e606f..3dd3dae81a413ddf3b61351726022a9e1d9d0a0c 100644 --- a/src/input/xpipsaxhandler.cpp +++ b/src/input/xpipsaxhandler.cpp @@ -280,7 +280,7 @@ bool XpipSaxHandler::endElement_peptide() { PeptideXtpSp peptide_const = PeptideXtp(*(_current_peptide_sp.get())).makePeptideXtpSp(); peptide_const = _p_project->getPeptideStore().getInstance(peptide_const); - _p_peptide_match->setPeptideSp(peptide_const); + _p_peptide_match->setPeptideXtpSp(peptide_const); return true; }