From acea4912f301251793f0bd208721f780997c5477 Mon Sep 17 00:00:00 2001
From: Olivier Langella <olivier.langella@u-psud.fr>
Date: Thu, 3 May 2018 12:04:11 +0200
Subject: [PATCH] WIP: compute NSAF

---
 src/core/proteinmatch.cpp | 11 +++++++++++
 src/core/proteinmatch.h   |  5 +++++
 2 files changed, 16 insertions(+)

diff --git a/src/core/proteinmatch.cpp b/src/core/proteinmatch.cpp
index 2ffadd6fd..093d6585d 100644
--- a/src/core/proteinmatch.cpp
+++ b/src/core/proteinmatch.cpp
@@ -326,6 +326,17 @@ pappso::pappso_double ProteinMatch::getLogEvalue(const MsRun * sp_msrun_id) cons
 
 }
 
+pappso::pappso_double ProteinMatch::getProtoNsaf(const MsRun * sp_msrun_id) const {
+    try {
+        pappso::pappso_double proto_nsaf =  (pappso::pappso_double) countSampleScan(ValidationState::validAndChecked ,sp_msrun_id) / (pappso::pappso_double) _protein_sp.get()->size();
+        return proto_nsaf;
+
+    }
+    catch (pappso::PappsoException error) {
+        throw pappso::PappsoException(QObject::tr("Error computing proto NSAF for protein %1 :\n%2").arg(this->getProteinXtpSp().get()->getAccession()).arg(error.qwhat()));
+    }
+}
+
 pappso::pappso_double ProteinMatch::getPAI(const MsRun * sp_msrun_id) const {
     try {
         pappso::pappso_double PAI =  (pappso::pappso_double) countPeptideMassCharge(ValidationState::validAndChecked ,sp_msrun_id) / (pappso::pappso_double) _protein_sp.get()->countTrypticPeptidesForPAI();
diff --git a/src/core/proteinmatch.h b/src/core/proteinmatch.h
index 2104a7120..a9e419670 100644
--- a/src/core/proteinmatch.h
+++ b/src/core/proteinmatch.h
@@ -64,6 +64,11 @@ public:
      **/
     const QString getHtmlSequence(PeptideEvidence * peptide_evidence_to_locate = nullptr) const;
 
+        /** @brief compute proto NSAF within sample
+     * Warning: this is not NSAF, just a part
+     * */
+    pappso::pappso_double getProtoNsaf(const MsRun * sp_msrun_id = nullptr) const;
+
     /** @brief compute Protein Abundance Index (PAI) within sample
      * PAI computation (Rappsilber et al. 2002)
      * */
-- 
GitLab