From 7f7e2e717042942a7195cd415032987c4f191139 Mon Sep 17 00:00:00 2001
From: Olivier Langella <olivier.langella@u-psud.fr>
Date: Thu, 22 Mar 2018 13:55:22 +0100
Subject: [PATCH] new column added to display experimental precursor m/z

---
 src/grouping/ptm/ptmsamplescan.h              |  8 ++++++
 .../peptide_list_view/peptidetablemodel.cpp   | 11 +++++++-
 src/gui/peptide_list_view/peptidetablemodel.h | 25 ++++++++++---------
 src/output/ods/ptm/ptmspectrasheet.cpp        |  5 ++--
 src/output/ods/spectrasheet.cpp               | 12 ++++-----
 5 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/src/grouping/ptm/ptmsamplescan.h b/src/grouping/ptm/ptmsamplescan.h
index e06758f4..50427558 100644
--- a/src/grouping/ptm/ptmsamplescan.h
+++ b/src/grouping/ptm/ptmsamplescan.h
@@ -48,9 +48,17 @@ public:
     PtmSampleScan(const PtmSampleScan& other);
     ~PtmSampleScan();
     
+    /** @brief get the best peptide Match (Evalue)
+     * peptide match are sorted in this sample/scan by Evalue
+     * The representative peptide match is the first in the sorted array
+     */
     const PeptideMatch & getRepresentativePeptideMatch() const;
     bool add(const PeptideMatch & peptide_match);
     std::vector<unsigned int> getBestPtmPositionList(const PtmGroupingExperiment * p_ptm_grouping_experiment) const;
+    
+    /** @brief get all observed PTM positions for this sample/scan
+     * positions are intended in a peptide (not protein), from 0 (first amino acid) to size-1 (last amino acid)
+     */
     std::vector<unsigned int> getObservedPtmPositionList(const PtmGroupingExperiment * p_ptm_grouping_experiment) const;
     const QString getHtmlSequence(const PtmGroupingExperiment * p_ptm_grouping_experiment) const;
     std::vector<PeptideMatch> & getPeptideMatchList();
diff --git a/src/gui/peptide_list_view/peptidetablemodel.cpp b/src/gui/peptide_list_view/peptidetablemodel.cpp
index 31fc935c..86689402 100644
--- a/src/gui/peptide_list_view/peptidetablemodel.cpp
+++ b/src/gui/peptide_list_view/peptidetablemodel.cpp
@@ -68,7 +68,7 @@ int PeptideTableModel::rowCount(const QModelIndex &parent ) const {
     return 0;
 }
 int PeptideTableModel::columnCount(const QModelIndex &parent ) const {
-    return 19;
+    return 20;
 }
 QVariant PeptideTableModel::headerData(int section, Qt::Orientation orientation, int role) const
 {
@@ -148,6 +148,9 @@ QVariant PeptideTableModel::data(const QModelIndex &index, int role ) const {
             case (std::int8_t)PeptideListColumn::charge:
                 return QVariant ((quint32) _p_protein_match->getPeptideMatchList().at(row).getPeptideEvidence()->getCharge());
                 break;
+            case (std::int8_t)PeptideListColumn::experimental_mz:
+                return QVariant ((qreal) _p_protein_match->getPeptideMatchList().at(row).getPeptideEvidence()->getExperimentalMz());
+                break;
             case (std::int8_t)PeptideListColumn::sequence:
                 return _p_protein_match->getPeptideMatchList().at(row).getPeptideEvidence()->getPeptideXtpSp().get()->getSequence();
                 break;
@@ -251,6 +254,9 @@ const QString PeptideTableModel::getTitle(std::int8_t column) {
     case (std::int8_t) PeptideListColumn::charge:
         return "charge";
         break;
+    case (std::int8_t) PeptideListColumn::experimental_mz:
+        return "observed m/z";
+        break;
     case (std::int8_t) PeptideListColumn::sequence:
         return "sequence";
         break;
@@ -317,6 +323,9 @@ const QString PeptideTableModel::getDescription(std::int8_t column) {
     case (std::int8_t) PeptideListColumn::charge:
         return "peptide charge";
         break;
+    case (std::int8_t) PeptideListColumn::experimental_mz:
+        return "observed m/z (experimental m/z of precursor)";
+        break;
     case (std::int8_t) PeptideListColumn::sequence:
         return "peptide sequence";
         break;
diff --git a/src/gui/peptide_list_view/peptidetablemodel.h b/src/gui/peptide_list_view/peptidetablemodel.h
index c79bd1b0..2281ede6 100644
--- a/src/gui/peptide_list_view/peptidetablemodel.h
+++ b/src/gui/peptide_list_view/peptidetablemodel.h
@@ -39,18 +39,19 @@ enum class PeptideListColumn: std::int8_t {
     rtmin=4,
     rt=5,
     charge=6,
-    sequence=7,
-    modifs=8,
-    label=9,
-    start=10,
-    length=11,
-    used=12,
-    subgroups=13,
-    Evalue=14,
-    theoretical_mhplus=15,
-    delta_mhplus=16,
-    hyperscore=17,
-    mascot_score=18
+    experimental_mz=7,
+    sequence=8,
+    modifs=9,
+    label=10,
+    start=11,
+    length=12,
+    used=13,
+    subgroups=14,
+    Evalue=15,
+    theoretical_mhplus=16,
+    delta_mhplus=17,
+    hyperscore=18,
+    mascot_score=19
 };
 
 class PeptideListWindow;
diff --git a/src/output/ods/ptm/ptmspectrasheet.cpp b/src/output/ods/ptm/ptmspectrasheet.cpp
index e337a379..49bc3ff8 100644
--- a/src/output/ods/ptm/ptmspectrasheet.cpp
+++ b/src/output/ods/ptm/ptmspectrasheet.cpp
@@ -56,7 +56,8 @@ void PtmSpectraSheet::writeCellHeader(PeptideListColumn column) {
 
 
 void PtmSpectraSheet::writeHeaders(IdentificationGroup * p_ident)  {
-    // Group ID	Peptide ID	Sample	Scan	Rt (minutes)	Sequence (top)	Modifs (top)	Number of subgroups	Sub-groups Ids	Best E-value	Best hyperscore	m/z Obs	Charge	MH+ Obs	MH+ theo	DeltaMH+	Delta-ppm
+    // Group ID	Sub-group ID	Phosphopeptide ID	Sample	Scan	Rt	Sequence (top)	Modifs (top)	Best position in peptide	All observed positions in phosphopeptide	Number of phosphoislands	Phosphoislands Ids	Best e-value	Charge	MH+ Obs	MH+ theo	DeltaMH+	Delta-ppm
+
 
     //MS Sample :	20120906_balliau_extract_1_A01_urnb-1
     const std::vector<MsRunSp> msrun_list = p_ident->getMsRunSpList();
@@ -73,7 +74,7 @@ void PtmSpectraSheet::writeHeaders(IdentificationGroup * p_ident)  {
     _p_writer->writeCell("Peptide ID");
     _p_writer->setCellAnnotation("MS sample name (MS run)");
     _p_writer->writeCell("Sample");
-    _p_writer->writeCell("Scan");
+    writeCellHeader(PeptideListColumn::scan);
     _p_writer->setCellAnnotation("retention time in seconds");
     _p_writer->writeCell("Rt (seconds)");
     _p_writer->setCellAnnotation("experimental precursor m/z");
diff --git a/src/output/ods/spectrasheet.cpp b/src/output/ods/spectrasheet.cpp
index c10af12f..ffbd9aee 100644
--- a/src/output/ods/spectrasheet.cpp
+++ b/src/output/ods/spectrasheet.cpp
@@ -71,13 +71,11 @@ void SpectraSheet::writeHeaders(IdentificationGroup * p_ident)  {
     _p_writer->writeLine();
     _p_writer->writeCell("Group ID");
     _p_writer->writeCell("Peptide ID");
-    _p_writer->setCellAnnotation("MS sample name (MS run)");
-    _p_writer->writeCell("Sample");
-    _p_writer->writeCell("Scan");
-    _p_writer->setCellAnnotation("retention time in seconds");
-    _p_writer->writeCell("Rt (seconds)");
-    _p_writer->setCellAnnotation("experimental precursor m/z");
-    _p_writer->writeCell("Precursor m/z");
+    
+    writeCellHeader(PeptideListColumn::sample);
+    writeCellHeader(PeptideListColumn::scan);
+    writeCellHeader(PeptideListColumn::rt);
+    writeCellHeader(PeptideListColumn::experimental_mz);
     _p_writer->setCellAnnotation("peptide sequence (best match)");
     _p_writer->writeCell("Sequence (top)");
     _p_writer->setCellAnnotation("peptide charge (best match)");
-- 
GitLab