From ac3491eb2dd81f71f9a5c5e579598635d98ddca8 Mon Sep 17 00:00:00 2001
From: Olivier Langella <olivier.langella@u-psud.fr>
Date: Sat, 25 Nov 2017 11:39:32 +0100
Subject: [PATCH] fasta files references added to identification sources in
 xpip

---
 src/input/xtpxpipsaxhandler.cpp | 6 +++++-
 src/output/xpip.cpp             | 8 +++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/input/xtpxpipsaxhandler.cpp b/src/input/xtpxpipsaxhandler.cpp
index f2886d8bf..f1de8e549 100644
--- a/src/input/xtpxpipsaxhandler.cpp
+++ b/src/input/xtpxpipsaxhandler.cpp
@@ -302,7 +302,7 @@ bool XtpXpipSaxHandler::startElement_identification_group(QXmlAttributes attribu
 }
 
 bool XtpXpipSaxHandler::startElement_identification_source(QXmlAttributes attributes) {
-    //<identification_source id="identa0" msrun_id="sampa0" path="/gorgone/pappso/formation/Janvier2014/TD/xml_tandem/20120906_balliau_extract_1_A01_urnb-1.xml" engine="1" version=""/>
+    //<identification_source id="identa0" msrun_id="sampa0" path="/espace/bio/tandem/20120906_balliau_extract_1_A01_urnb-1.xml" engine="1" version="2017.2.1.4" fasta_ids="fastaa0">
 
     qDebug() << "startElement_identification_source ";
 
@@ -315,6 +315,10 @@ bool XtpXpipSaxHandler::startElement_identification_source(QXmlAttributes attrib
     sp_ident_source->setMsRunSp(_map_msruns.at(attributes.value("msrun_id").simplified()));
     qDebug() << "startElement_identification_source setIdentificationEngineVersion";
     sp_ident_source->setIdentificationEngineVersion(attributes.value("version"));
+    
+    for (const QString & fasta_id : attributes.value("fasta_ids").split(" ")) {
+        sp_ident_source.get()->addFastaFile(_map_fasta_files.at(fasta_id));
+    }
 
     //_current_identification_group_p->addMsRunSp(ms_run);
     qDebug() << "startElement_identification_source end" ;
diff --git a/src/output/xpip.cpp b/src/output/xpip.cpp
index 5b48a4b26..db9c2e4d0 100644
--- a/src/output/xpip.cpp
+++ b/src/output/xpip.cpp
@@ -194,6 +194,12 @@ void Xpip::writeIdentificationDataSourceList(const IdentificationDataSourceStore
         _output_stream->writeAttribute("engine",QString("%1").arg(static_cast<std::int8_t>(ident_source_sp.get()->getIdentificationEngine())));
         _output_stream->writeAttribute("version",ident_source_sp.get()->getIdentificationEngineVersion());
 
+        QStringList fasta_file_id;
+        for (FastaFileSp fasta_file :ident_source_sp.get()->getFastaFileList()) {
+            fasta_file_id << fasta_file.get()->getXmlId();
+        }
+        _output_stream->writeAttribute("fasta_ids",fasta_file_id.join(" "));
+
         const std::map<IdentificationEngineParam, QVariant> params = ident_source_sp.get()->getIdentificationEngineParamMap();
         if (params.size() > 0) {
             _output_stream->writeStartElement("params");
@@ -205,7 +211,7 @@ void Xpip::writeIdentificationDataSourceList(const IdentificationDataSourceStore
             }
             _output_stream->writeEndElement();
         }
-        
+
         const std::map<IdentificationEngineStatistics, QVariant> stats = ident_source_sp.get()->getIdentificationEngineStatisticsMap();
         if (stats.size() > 0) {
             _output_stream->writeStartElement("stats");
-- 
GitLab