From 3e5615beab815b24baab7dd11a54cba00ca91971 Mon Sep 17 00:00:00 2001
From: Olivier Langella <Olivier.Langella@moulon.inra.fr>
Date: Wed, 15 Mar 2017 22:14:01 +0100
Subject: [PATCH] no good

---
 .../identificationdatasource.cpp              |  5 +++
 .../identificationdatasource.h                | 13 +++++-
 src/core/peptidematch.h                       |  3 +-
 src/core/spectrumid.cpp                       | 24 +++++++++++
 src/core/spectrumid.h                         | 41 +++++++++++++++++++
 5 files changed, 84 insertions(+), 2 deletions(-)
 create mode 100644 src/core/spectrumid.cpp
 create mode 100644 src/core/spectrumid.h

diff --git a/src/core/identification_sources/identificationdatasource.cpp b/src/core/identification_sources/identificationdatasource.cpp
index f6c6ca64..d3ac5908 100644
--- a/src/core/identification_sources/identificationdatasource.cpp
+++ b/src/core/identification_sources/identificationdatasource.cpp
@@ -21,6 +21,7 @@
 *     Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and implementation
 ******************************************************************************/
 #include "identificationdatasource.h"
+#include <QFileInfo>
 
 IdentificationDataSource::IdentificationDataSource(pappso::MsRunIdSp & ms_run_sp)
 {
@@ -43,6 +44,10 @@ bool IdentificationDataSource::operator==(const IdentificationDataSource& other)
 
 }
 
+IdentificationDataSourceSp IdentificationDataSource::getInstance(const QString & location) {
+    QFileInfo location_file(location);
+    QString ext = location_file.suffix();
+}
 
 const QString & IdentificationDataSource::getResourceName () const {
     return _resource_name;
diff --git a/src/core/identification_sources/identificationdatasource.h b/src/core/identification_sources/identificationdatasource.h
index 27b99595..d067a3cf 100644
--- a/src/core/identification_sources/identificationdatasource.h
+++ b/src/core/identification_sources/identificationdatasource.h
@@ -25,20 +25,31 @@
 
 
 #include <pappsomspp/msrun/msrunid.h>
+#include <map>
+
+
+class IdentificationDataSource;
+
+typedef std::shared_ptr<IdentificationDataSource> IdentificationDataSourceSp;
+
 class IdentificationDataSource
 {
 public:
+    static IdentificationDataSourceSp getInstance(const QString & location);
+
     IdentificationDataSource(pappso::MsRunIdSp & ms_run_sp);
     IdentificationDataSource(const IdentificationDataSource& other);
     ~IdentificationDataSource();
     bool operator==(const IdentificationDataSource& other) const;
-    
+
     const QString & getResourceName () const;
     pappso::MsRunIdSp getMsRunSp () const;
 
 protected :
     QString _resource_name;
 private :
+    static std::map<QString, IdentificationDataSource *> _map_identification_data_sources;
+    static std::map<QString, pappso::MsRunIdSp> _map_msrunidsp;
     pappso::MsRunIdSp _ms_run_sp = nullptr;
 };
 
diff --git a/src/core/peptidematch.h b/src/core/peptidematch.h
index 0c04c2bb..73896224 100644
--- a/src/core/peptidematch.h
+++ b/src/core/peptidematch.h
@@ -26,6 +26,7 @@
 #include <pappsomspp/msrun/msrunid.h>
 #include <pappsomspp/types.h>
 #include <pappsomspp/peptide/peptide.h>
+#include "identification_sources/identificationdatasource.h"
 
 class PeptideMatch
 {
@@ -42,8 +43,8 @@ public :
 
 private :
     pappso::MsRunIdSp _msrunid_sp;
-    pappso::PeptideSp _peptide_sp;
     unsigned int _scan;
+    pappso::PeptideSp _peptide_sp;
     pappso::pappso_double _rt;
     pappso::pappso_double _evalue;
     pappso::pappso_double _exp_mass;
diff --git a/src/core/spectrumid.cpp b/src/core/spectrumid.cpp
new file mode 100644
index 00000000..69c68d19
--- /dev/null
+++ b/src/core/spectrumid.cpp
@@ -0,0 +1,24 @@
+
+/*******************************************************************************
+* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>.
+*
+* This file is part of XTPcpp.
+*
+*     XTPcpp is free software: you can redistribute it and/or modify
+*     it under the terms of the GNU General Public License as published by
+*     the Free Software Foundation, either version 3 of the License, or
+*     (at your option) any later version.
+*
+*     XTPcpp is distributed in the hope that it will be useful,
+*     but WITHOUT ANY WARRANTY; without even the implied warranty of
+*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*     GNU General Public License for more details.
+*
+*     You should have received a copy of the GNU General Public License
+*     along with XTPcpp.  If not, see <http://www.gnu.org/licenses/>.
+*
+* Contributors:
+*     Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
+******************************************************************************/
+
+#include "spectrumid.h"
diff --git a/src/core/spectrumid.h b/src/core/spectrumid.h
new file mode 100644
index 00000000..d7ea3dbb
--- /dev/null
+++ b/src/core/spectrumid.h
@@ -0,0 +1,41 @@
+
+/*******************************************************************************
+* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>.
+*
+* This file is part of XTPcpp.
+*
+*     XTPcpp is free software: you can redistribute it and/or modify
+*     it under the terms of the GNU General Public License as published by
+*     the Free Software Foundation, either version 3 of the License, or
+*     (at your option) any later version.
+*
+*     XTPcpp is distributed in the hope that it will be useful,
+*     but WITHOUT ANY WARRANTY; without even the implied warranty of
+*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*     GNU General Public License for more details.
+*
+*     You should have received a copy of the GNU General Public License
+*     along with XTPcpp.  If not, see <http://www.gnu.org/licenses/>.
+*
+* Contributors:
+*     Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
+******************************************************************************/
+#include <pappsomspp/msrun/msrunid.h>
+
+#ifndef SPECTRUMID_H
+#define SPECTRUMID_H
+
+class SpectrumId
+{
+
+   
+private :
+     SpectrumId(pappso::MsRunIdSp msrunid_sp, unsigned int scan);
+   
+private :
+    pappso::MsRunIdSp _msrunid_sp;
+    unsigned int _scan;
+
+};
+
+#endif // SPECTRUMID_H
-- 
GitLab