From 3255bdf048762e31dbb492b24dd5e4d93c6ecb6c Mon Sep 17 00:00:00 2001
From: Olivier Langella <Olivier.Langella@moulon.inra.fr>
Date: Wed, 26 Jul 2017 08:43:25 +0200
Subject: [PATCH] more ptm peptide columns

---
 src/grouping/ptm/ptmsamplescan.cpp                 | 12 ++++++++++++
 src/grouping/ptm/ptmsamplescan.h                   |  1 +
 .../ptm_peptide_list_view/ptmpeptidetablemodel.cpp | 14 ++++++++++++++
 3 files changed, 27 insertions(+)

diff --git a/src/grouping/ptm/ptmsamplescan.cpp b/src/grouping/ptm/ptmsamplescan.cpp
index f3db43d1d..195649f2e 100644
--- a/src/grouping/ptm/ptmsamplescan.cpp
+++ b/src/grouping/ptm/ptmsamplescan.cpp
@@ -52,5 +52,17 @@ bool PtmSampleScan::add(const PeptideMatch * p_peptide_match) {
         return false;
     }
     _peptide_match_list.push_back(p_peptide_match);
+    
+        //sort list
+    std::sort(_peptide_match_list.begin(),_peptide_match_list.end(),[](const PeptideMatch * first, const PeptideMatch * second) {
+        return (first->getEvalue() < second->getEvalue()) ;
+    });
+
     return true;
 }
+
+    std::vector<unsigned int> PtmSampleScan::getBestPtmPositionList() const {
+        std::vector<unsigned int> list;
+        
+        return list;
+    }
diff --git a/src/grouping/ptm/ptmsamplescan.h b/src/grouping/ptm/ptmsamplescan.h
index f0446c3cc..b03cd0177 100644
--- a/src/grouping/ptm/ptmsamplescan.h
+++ b/src/grouping/ptm/ptmsamplescan.h
@@ -49,6 +49,7 @@ public:
     
     const PeptideMatch * getRepresentativePeptideMatch() const;
     bool add(const PeptideMatch * p_peptide_match);
+    std::vector<unsigned int> getBestPtmPositionList() const;
 private:
     std::vector<const PeptideMatch *> _peptide_match_list;
 
diff --git a/src/gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp b/src/gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp
index 0501d7dfd..225405c54 100644
--- a/src/gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp
+++ b/src/gui/ptm_peptide_list_view/ptmpeptidetablemodel.cpp
@@ -88,6 +88,10 @@ const QString PtmPeptideTableModel::getTitle(std::int8_t column) {
         break;
     case (std::int8_t) PtmPeptideListColumn::besthyperscore:
         return "top hyperscore";
+    case (std::int8_t) PtmPeptideListColumn::bestposition:
+        return "top PTM positions";
+    case (std::int8_t) PtmPeptideListColumn::allobservedposition:
+        return "observed PTM positions";
 
     }
     return "";
@@ -134,6 +138,10 @@ const QString PtmPeptideTableModel::getDescription(std::int8_t column) {
         break;
     case (std::int8_t) PtmPeptideListColumn::besthyperscore:
         return "best X!Tandem hyperscore";
+    case (std::int8_t) PtmPeptideListColumn::bestposition:
+        return "PTM positions of the top identified peptide (best Evalue) for this scan";
+    case (std::int8_t) PtmPeptideListColumn::allobservedposition:
+        return "all observed PTM positions for the same scan";
 
     }
     return "";
@@ -212,6 +220,12 @@ QVariant PtmPeptideTableModel::data(const QModelIndex &index, int role ) const {
             case (std::int8_t)PtmPeptideListColumn::besthyperscore:
                 return _ptm_sample_scan_list.at(row).get()->getRepresentativePeptideMatch()->getParam(PeptideMatchParam::tandem_hyperscore);
                 break;
+            case (std::int8_t)PtmPeptideListColumn::bestposition:
+                //return _ptm_sample_scan_list.at(row).get()->getBestPtmPositionList();
+                break;
+            case (std::int8_t)PtmPeptideListColumn::allobservedposition:
+                //return _ptm_sample_scan_list.at(row).get()->getObservedPtmPositionList();
+                break;
 
         }
     }
-- 
GitLab