From 77f59a437e7811717df414d0fac71c8136257968 Mon Sep 17 00:00:00 2001
From: Olivier Langella <Olivier.Langella@moulon.inra.fr>
Date: Sat, 1 Apr 2017 19:17:05 +0200
Subject: [PATCH] read spectrum from identification source

---
 src/core/identification_sources/identificationdatasource.h   | 4 ++++
 .../identification_sources/identificationxtandemfile.cpp     | 5 +++++
 src/core/identification_sources/identificationxtandemfile.h  | 2 ++
 src/gui/peptide_detail_view/peptidewindow.cpp                | 4 ++++
 4 files changed, 15 insertions(+)

diff --git a/src/core/identification_sources/identificationdatasource.h b/src/core/identification_sources/identificationdatasource.h
index cc007b31d..6b90eff21 100644
--- a/src/core/identification_sources/identificationdatasource.h
+++ b/src/core/identification_sources/identificationdatasource.h
@@ -25,6 +25,7 @@
 
 
 #include <pappsomspp/msrun/msrunid.h>
+#include <pappsomspp/spectrum/spectrum.h>
 #include <map>
 
 
@@ -43,6 +44,9 @@ public:
     const QString & getResourceName () const;
     void setMsRunSp (pappso::MsRunIdSp ms_run_sp);
     pappso::MsRunIdSp getMsRunSp () const;
+    /** @brief get the spectrum with scan number
+     * */
+    virtual pappso::SpectrumSp getSpectrumSp(unsigned int scan_number) const = 0;
 
 protected :
     QString _resource_name;
diff --git a/src/core/identification_sources/identificationxtandemfile.cpp b/src/core/identification_sources/identificationxtandemfile.cpp
index 27cb17c35..41b4d0e32 100644
--- a/src/core/identification_sources/identificationxtandemfile.cpp
+++ b/src/core/identification_sources/identificationxtandemfile.cpp
@@ -39,3 +39,8 @@ bool IdentificationXtandemFile::operator==(const IdentificationXtandemFile& othe
 {
 
 }
+
+pappso::SpectrumSp IdentificationXtandemFile::getSpectrumSp(unsigned int scan_number) const {
+    pappso::SpectrumSp spectrum_sp;
+    return spectrum_sp;
+}
diff --git a/src/core/identification_sources/identificationxtandemfile.h b/src/core/identification_sources/identificationxtandemfile.h
index d2f364837..a8ae60fe1 100644
--- a/src/core/identification_sources/identificationxtandemfile.h
+++ b/src/core/identification_sources/identificationxtandemfile.h
@@ -34,6 +34,8 @@ public:
     ~IdentificationXtandemFile();
     bool operator==(const IdentificationXtandemFile& other) const;
 
+    virtual pappso::SpectrumSp getSpectrumSp(unsigned int scan_number) const;
+    
 private:
     const QFileInfo _xtandem_file;
 };
diff --git a/src/gui/peptide_detail_view/peptidewindow.cpp b/src/gui/peptide_detail_view/peptidewindow.cpp
index 1e017d378..9f68d3b54 100644
--- a/src/gui/peptide_detail_view/peptidewindow.cpp
+++ b/src/gui/peptide_detail_view/peptidewindow.cpp
@@ -69,6 +69,8 @@ void PeptideWindow::updateDisplay() {
         ui->z_label->setText(QString("%1").arg(_p_peptide_match->getCharge()));
         ui->scan_label->setText(QString("%1").arg(_p_peptide_match->getScan()));
         ui->modification_label->setText(_p_peptide_match->getPeptideXtpSp().get()->getModifString());
+        
+        
     }
     catch (pappso::PappsoException exception_pappso) {
         QMessageBox::warning(this,
@@ -83,5 +85,7 @@ void PeptideWindow::updateDisplay() {
 
 void PeptideWindow::setPeptideMatch(PeptideMatch * p_peptide_match) {
     _p_peptide_match = p_peptide_match;
+    
+    SpectrumSp spectrum = _p_peptide_match->getIdentificationDataSource()->getSpectrumSp(_p_peptide_match->getScan());
     updateDisplay();
 }
-- 
GitLab