diff --git a/src/core/identificationgroup.cpp b/src/core/identificationgroup.cpp index 82ab9dd38735ab0c9c0d7385b56c1d2f384fce78..666e75c8194577803f8a329e43b5f56e03c9385f 100644 --- a/src/core/identificationgroup.cpp +++ b/src/core/identificationgroup.cpp @@ -48,6 +48,16 @@ const GroupStore & IdentificationGroup::getGroupStore() const { return _group_store; } +pappso::pappso_double IdentificationGroup::computeProtoNsafSum(const MsRun * p_msrun_id ) const { + pappso::pappso_double nsaf_sum = 0; + for (auto & p_protein_match : _protein_match_list) { + if (p_protein_match->getValidationState() >= ValidationState::grouped) { + nsaf_sum += p_protein_match->getProtoNsaf(p_msrun_id); + } + } + return nsaf_sum; +} + unsigned int IdentificationGroup::countPeptideMass(ValidationState state) const { std::vector<pappso::GrpPeptide *> count_peptide_mass; diff --git a/src/core/identificationgroup.h b/src/core/identificationgroup.h index 110d7d9aff63e6becc661ef62fada025a455cf7d..2e1627856c49e97be7b8f31aae9ffa053b4a40ae 100644 --- a/src/core/identificationgroup.h +++ b/src/core/identificationgroup.h @@ -54,6 +54,12 @@ public: void addIdentificationDataSourceP(IdentificationDataSource * p_identification_source); const PtmGroupingExperiment * getPtmGroupingExperiment() const; + + /** @brief compute proto NSAF sum within msrun + * Warning: this is not NSAF, just a part + * @param p_msrun_id pointer on the msrun to get NSAF. if not defined, NSAF is computed overall msruns + * */ + pappso::pappso_double computeProtoNsafSum(const MsRun * p_msrun_id = nullptr) const; /** @brief count groups * */ diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp index 093d6585de6e153a3c0c1ef1a9285ab7e1cb36e6..cf3ba339fcb91f622c1944bb7cae8f5c5b053d7a 100644 --- a/src/core/proteinmatch.cpp +++ b/src/core/proteinmatch.cpp @@ -325,6 +325,9 @@ pappso::pappso_double ProteinMatch::getLogEvalue(const MsRun * sp_msrun_id) cons return (evalue_prot); } +pappso::pappso_double ProteinMatch::getNsaf(pappso::pappso_double proto_nsaf_sum, const MsRun * p_msrun_id) const { + return (getProtoNsaf(p_msrun_id)/proto_nsaf_sum); +} pappso::pappso_double ProteinMatch::getProtoNsaf(const MsRun * sp_msrun_id) const { try { diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h index a9e4196705a62a265a57e6ba64cfee1ee3872626..4b1bcebbf4d770eeac710a3ab106388e98c7a308 100644 --- a/src/core/proteinmatch.h +++ b/src/core/proteinmatch.h @@ -64,10 +64,18 @@ public: **/ const QString getHtmlSequence(PeptideEvidence * peptide_evidence_to_locate = nullptr) const; - /** @brief compute proto NSAF within sample + /** @brief compute proto NSAF within msrun * Warning: this is not NSAF, just a part + * @param p_msrun_id pointer on the msrun to get NSAF. if not defined, NSAF is computed overall msruns * */ - pappso::pappso_double getProtoNsaf(const MsRun * sp_msrun_id = nullptr) const; + pappso::pappso_double getProtoNsaf(const MsRun * p_msrun_id = nullptr) const; + + /** @brief compute NSAF within msrun + * Warning: this is not NSAF, just a part + * @param proto_nsaf_sum the sum of proto nsaf of all proteins within the msrun + * @param p_msrun_id pointer on the msrun to get NSAF. if not defined, NSAF is computed overall msruns + * */ + pappso::pappso_double getNsaf(pappso::pappso_double proto_nsaf_sum, const MsRun * p_msrun_id = nullptr) const; /** @brief compute Protein Abundance Index (PAI) within sample * PAI computation (Rappsilber et al. 2002) diff --git a/src/gui/protein_list_view/proteinlistwindow.cpp b/src/gui/protein_list_view/proteinlistwindow.cpp index e71b9ecd24e37a61304bde62ab347616f397672b..d7c02cf41537ed3d044e57472b50aaed261a1cd6 100644 --- a/src/gui/protein_list_view/proteinlistwindow.cpp +++ b/src/gui/protein_list_view/proteinlistwindow.cpp @@ -272,6 +272,9 @@ void ProteinListWindow::doIdentificationGroupGrouped(IdentificationGroup * p_ide if (_p_identification_group == p_identification_group) { //_protein_table_model_p->setIdentificationGroup(p_identification_group); //_p_proxy_model->setSourceModel(_protein_table_model_p); + //if(getProteinListColumnDisplay) { + sumProtoNsaf(); + //} emit proteinDataChanged(); } @@ -347,3 +350,11 @@ void ProteinListWindow::resizeColumnsToContents() { ProjectWindow * ProteinListWindow::getProjectWindow() { return _project_window; } + + + pappso::pappso_double ProteinListWindow::getProtoNsafSum() const { + return _sum_proto_nsaf; + } + void ProteinListWindow::sumProtoNsaf() { + _sum_proto_nsaf = _p_identification_group->computeProtoNsafSum(); + } diff --git a/src/gui/protein_list_view/proteinlistwindow.h b/src/gui/protein_list_view/proteinlistwindow.h index e5d1d9d7163ebf27993b51e103bf703bf67bb721..98a3e63250cfe3eac27deb880ada6847203b54a4 100644 --- a/src/gui/protein_list_view/proteinlistwindow.h +++ b/src/gui/protein_list_view/proteinlistwindow.h @@ -98,6 +98,8 @@ protected : void askProteinDetailView(ProteinMatch * p_protein_match); void askPeptideListView(ProteinMatch * p_protein_match); ProjectWindow * getProjectWindow(); + pappso::pappso_double getProtoNsafSum() const; + void sumProtoNsaf(); @@ -110,6 +112,7 @@ private: QMenu * _p_context_menu = nullptr; bool _display_evalue = true; bool _display_accession = true; + pappso::pappso_double _sum_proto_nsaf; }; diff --git a/src/gui/protein_list_view/proteintablemodel.cpp b/src/gui/protein_list_view/proteintablemodel.cpp index a6e3cd24e0c00db8e4e5b9c2506da62ff0f624d2..ee1dbfc6194358dc73caedc745029496d07f8277 100644 --- a/src/gui/protein_list_view/proteintablemodel.cpp +++ b/src/gui/protein_list_view/proteintablemodel.cpp @@ -65,7 +65,7 @@ int ProteinTableModel::rowCount(const QModelIndex &parent ) const { int ProteinTableModel::columnCount(const QModelIndex &parent ) const { //qDebug() << "ProteinTableModel::columnCount begin "; if (_p_identification_group != nullptr) { - return 14; + return 15; } return 0; } @@ -127,6 +127,10 @@ const QString ProteinTableModel::getTitle(std::int8_t column) { case (std::int8_t) ProteinListColumn::molecular_weight: return "MW"; break; + + case (std::int8_t) ProteinListColumn::nsaf: + return "NSAF"; + break; } return ""; @@ -180,6 +184,8 @@ const QString ProteinTableModel::getDescription(std::int8_t column) { case (std::int8_t) ProteinListColumn::molecular_weight: return "protein molecular weight in Dalton"; + case (std::int8_t) ProteinListColumn::nsaf: + return "NSAF"; } return ""; } @@ -331,6 +337,9 @@ QVariant ProteinTableModel::data(const QModelIndex &index, int role ) const { if (col == (std::int8_t) ProteinListColumn::molecular_weight ) { return QVariant ((qreal)_p_identification_group->getProteinMatchList().at(row)->getProteinXtpSp().get()->getMass()); } + if (col == (std::int8_t) ProteinListColumn::nsaf ) { + return QVariant ((qreal)_p_identification_group->getProteinMatchList().at(row)->getNsaf(_p_protein_list_window->getProtoNsafSum())); + } return QVariant(); } return QVariant(); diff --git a/src/gui/protein_list_view/proteintablemodel.h b/src/gui/protein_list_view/proteintablemodel.h index a3f103260b31cb002f89ab043ae3e69519d17543..04f37015cb0587433c1899ae7d5fb51239101b05 100644 --- a/src/gui/protein_list_view/proteintablemodel.h +++ b/src/gui/protein_list_view/proteintablemodel.h @@ -47,6 +47,7 @@ enum class ProteinListColumn: std::int8_t { molecular_weight=11, ///< protein molecular weight in Dalton pai=12, ///< PAI empai=13, ///< emPAI + nsaf=14, ///< NSAF }; class ProteinListWindow;