From 8b96932041bdf1645cec5b24d17651ae8d0783d7 Mon Sep 17 00:00:00 2001
From: Olivier Langella <olivier.langella@u-psud.fr>
Date: Thu, 21 Jun 2018 16:09:39 +0200
Subject: [PATCH] display columns of present identification engines

---
 src/gui/peptide_list_view/peptidetablemodel.cpp   | 15 +++++++++++++++
 .../peptide_list_view/peptidetableproxymodel.cpp  |  3 ++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/gui/peptide_list_view/peptidetablemodel.cpp b/src/gui/peptide_list_view/peptidetablemodel.cpp
index 70cf209f..c6daa2cc 100644
--- a/src/gui/peptide_list_view/peptidetablemodel.cpp
+++ b/src/gui/peptide_list_view/peptidetablemodel.cpp
@@ -55,6 +55,21 @@ PeptideTableModel::setProteinMatch(ProteinMatch *p_protein_match)
   // QModelIndex topLeft = createIndex(0,0);
   // QModelIndex bottomRight = createIndex(rowCount(),columnCount());
 
+  std::set<PeptideListColumn> engine_columns;
+  for(auto &&peptide_match : _p_protein_match->getPeptideMatchList())
+    {
+      IdentificationEngine engine =
+        peptide_match.getPeptideEvidence()->getIdentificationEngine();
+      if(engine == IdentificationEngine::XTandem)
+        {
+          engine_columns.insert(PeptideListColumn::hyperscore);
+        }
+      else if(engine == IdentificationEngine::mascot)
+        {
+          engine_columns.insert(PeptideListColumn::mascot_score);
+        }
+    }
+
   _p_peptide_list_window->resizeColumnsToContents();
   // emit dataChanged(topLeft, topLeft);
   // emit headerDataChanged(Qt::Horizontal, 0,3);
diff --git a/src/gui/peptide_list_view/peptidetableproxymodel.cpp b/src/gui/peptide_list_view/peptidetableproxymodel.cpp
index b2920c37..80267509 100644
--- a/src/gui/peptide_list_view/peptidetableproxymodel.cpp
+++ b/src/gui/peptide_list_view/peptidetableproxymodel.cpp
@@ -78,6 +78,7 @@ PeptideTableProxyModel::filterAcceptsColumn(
     }
   return _column_display[source_column];
 }
+
 bool
 PeptideTableProxyModel::filterAcceptsRow(int source_row,
                                          const QModelIndex &source_parent) const
@@ -326,7 +327,7 @@ QVariant
 PeptideTableProxyModel::data(const QModelIndex &index, int role) const
 {
 
-  //auto new_index = this->index(index.row(), mapToSource(index).column());
+  // auto new_index = this->index(index.row(), mapToSource(index).column());
   return sourceModel()->data(mapToSource(index), role);
 }
 
-- 
GitLab