From 3243071d5cd374ee9c7a7f73e583a48c5d552568 Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Tue, 5 Sep 2017 21:05:53 +0200 Subject: [PATCH] first X\!Tandem run ok --- src/core/tandem_run/tandembatchprocess.cpp | 14 +++++++++----- src/core/tandem_run/tandembatchprocess.h | 1 + src/gui/tandem_run_dialog/tandemrundialog.cpp | 2 +- src/gui/workerthread.cpp | 5 +++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/core/tandem_run/tandembatchprocess.cpp b/src/core/tandem_run/tandembatchprocess.cpp index 20c2d4b3..50005afa 100644 --- a/src/core/tandem_run/tandembatchprocess.cpp +++ b/src/core/tandem_run/tandembatchprocess.cpp @@ -30,8 +30,8 @@ #include "tandembatchprocess.h" #include <QProcess> #include <pappsomspp/pappsoexception.h> -#include <QXmlStreamWriter> #include <QFileInfo> +#include <QDebug> TandemBatchProcess::TandemBatchProcess(WorkMonitorInterface * p_monitor, const TandemRunBatch & tandem_run_batch) { _tandem_run_batch = tandem_run_batch; @@ -79,6 +79,7 @@ void TandemBatchProcess::prepareXmlDatabaseFile() { void TandemBatchProcess::run() { + qDebug() << "TandemBatchProcess::run begin " << _tandem_run_batch._preset_file; _preset_file = _tandem_run_batch._preset_file; prepareXmlDatabaseFile(); @@ -86,6 +87,7 @@ void TandemBatchProcess::run() { for (QString mz_file : _tandem_run_batch._mz_file_list) { runOne(mz_file); } + qDebug() << "TandemBatchProcess::run end" ; } void TandemBatchProcess::writeXmlInputFile (QXmlStreamWriter * p_out, const QString & mz_file) { @@ -98,7 +100,7 @@ void TandemBatchProcess::writeXmlInputFile (QXmlStreamWriter * p_out, const QStr //<bioml label="20170405_Delastour_11.xml"> p_out->writeStartElement("bioml"); - p_out->writeAttribute("label",mz_file_info.getFilename()); + p_out->writeAttribute("label",mz_file_info.fileName()); //<note type="heading">Paths</note> p_out->writeStartElement("note"); @@ -117,7 +119,7 @@ void TandemBatchProcess::writeXmlInputFile (QXmlStreamWriter * p_out, const QStr p_out->writeStartElement("note"); p_out->writeAttribute("type","input"); p_out->writeAttribute("label","list path, taxonomy information"); - p_out->writeCharacters(_xml_database_file.getFilename()); + p_out->writeCharacters(_xml_database_file.fileName()); p_out->writeEndElement(); @@ -148,10 +150,11 @@ void TandemBatchProcess::writeXmlInputFile (QXmlStreamWriter * p_out, const QStr p_out->writeEndElement(); //<note type="input" label="output, path">/gorgone/pappso/jouy/users/Didier/Xcal2017/2017_05_04_Delastours/Interrogation_souches_sequencees/Patient27/J42/20170405_Delastour_11.xml</note> + p_out->writeStartElement("note"); p_out->writeAttribute("type","input"); p_out->writeAttribute("label","output, path"); - p_out->writeCharacters("usedefined"); + p_out->writeCharacters(QString("%1/%2.xml").arg(_tandem_run_batch._output_directory).arg(mz_file_info.baseName())); p_out->writeEndElement(); //</bioml> @@ -163,6 +166,7 @@ void TandemBatchProcess::writeXmlInputFile (QXmlStreamWriter * p_out, const QStr void TandemBatchProcess::runOne(const QString & mz_file) { QTemporaryFile xml_input_file; + xml_input_file.setAutoRemove(false); if (xml_input_file.open()) { QXmlStreamWriter * p_out = new QXmlStreamWriter(); @@ -200,7 +204,7 @@ void TandemBatchProcess::runOne(const QString & mz_file) { if (Status != 0) { // != QProcess::NormalExit - throw pappso::PappsoException(QObject::tr("error executing X!Tandem Status != 0 : %1 %2\n%3").arg(_tandem_run_batch._tandem_bin_path).arg(arguments.join(" ").arg(result.toStdString().c_str()))); + throw pappso::PappsoException(QObject::tr("error executing X!Tandem Status != 0 : %1 %2\n%3").arg(_tandem_run_batch._tandem_bin_path).arg(arguments.join(" ").arg(result.data()))); } delete xt_process; diff --git a/src/core/tandem_run/tandembatchprocess.h b/src/core/tandem_run/tandembatchprocess.h index 9e1dbdbc..cdc6397e 100644 --- a/src/core/tandem_run/tandembatchprocess.h +++ b/src/core/tandem_run/tandembatchprocess.h @@ -32,6 +32,7 @@ #include "tandemrunbatch.h" #include "../../utils/workmonitor.h" #include <QTemporaryFile> +#include <QXmlStreamWriter> class TandemBatchProcess { diff --git a/src/gui/tandem_run_dialog/tandemrundialog.cpp b/src/gui/tandem_run_dialog/tandemrundialog.cpp index 9d40f8e8..e3a2ebf8 100644 --- a/src/gui/tandem_run_dialog/tandemrundialog.cpp +++ b/src/gui/tandem_run_dialog/tandemrundialog.cpp @@ -198,7 +198,7 @@ TandemRunBatch TandemRunDialog::getTandemRunBatch() const { tandem_run_batch._mz_file_list = _p_mz_file_list->stringList(); tandem_run_batch._fasta_file_list = _p_fasta_file_list->stringList(); //tandem_run_batch._preset_file = ui->preset_combobox->itemData(ui->preset_combobox->currentIndex()).value<QFileInfo>().absoluteFilePath(); - tandem_run_batch._preset_file = ui->preset_combobox->itemData(ui->preset_combobox->currentIndex()).value<QFileInfo>().absoluteFilePath(); + tandem_run_batch._preset_file = ui->preset_combobox->itemData(ui->preset_combobox->currentIndex()).value<QString>(); tandem_run_batch._output_directory = ui->output_directory_label->text(); return tandem_run_batch; } diff --git a/src/gui/workerthread.cpp b/src/gui/workerthread.cpp index 39889c4c..4958d4c2 100644 --- a/src/gui/workerthread.cpp +++ b/src/gui/workerthread.cpp @@ -295,9 +295,10 @@ void WorkerThread::doRunningXtandem(TandemRunBatch tandem_run_batch) { try { emit loadingMessage(tr("Running X!Tandem, please wait")); qDebug() << "WorkerThread::doRunningXtandem tandem_run_batch " << tandem_run_batch._tandem_bin_path; - + TandemBatchProcess xt_process (_p_work_monitor, tandem_run_batch); - + xt_process.run(); + emit operationFinished(); } catch (pappso::PappsoException & error) { -- GitLab