From 64644804d99a36400ad1490cd84da9d32d5837f8 Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Sat, 2 Sep 2017 16:29:29 +0200 Subject: [PATCH] new object TandemRunBatch to handle all informations needed to run X\!Tandem --- src/core/tandem_run/tandemrunbatch.cpp | 30 +++++++++++++ src/core/tandem_run/tandemrunbatch.h | 43 +++++++++++++++++++ .../ptmsequencedelegate.cpp | 2 +- src/gui/tandem_run_dialog/tandemrundialog.cpp | 12 ++++++ src/gui/tandem_run_dialog/tandemrundialog.h | 3 ++ 5 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 src/core/tandem_run/tandemrunbatch.cpp create mode 100644 src/core/tandem_run/tandemrunbatch.h diff --git a/src/core/tandem_run/tandemrunbatch.cpp b/src/core/tandem_run/tandemrunbatch.cpp new file mode 100644 index 00000000..c617687b --- /dev/null +++ b/src/core/tandem_run/tandemrunbatch.cpp @@ -0,0 +1,30 @@ +/** + * \file /core/tandem_run/tandem_run_batch.cpp + * \date 2/9/2017 + * \author Olivier Langella + * \brief all data needed to run a Tandem batch + */ + +/******************************************************************************* +* 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 "tandemrunbatch.h" diff --git a/src/core/tandem_run/tandemrunbatch.h b/src/core/tandem_run/tandemrunbatch.h new file mode 100644 index 00000000..dc80f51a --- /dev/null +++ b/src/core/tandem_run/tandemrunbatch.h @@ -0,0 +1,43 @@ +/** + * \file /core/tandem_run/tandem_run_batch.h + * \date 2/9/2017 + * \author Olivier Langella + * \brief all data needed to run a Tandem batch + */ + +/******************************************************************************* +* 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 +******************************************************************************/ + +#ifndef TANDEMRUNBATCH_H +#define TANDEMRUNBATCH_H + +#include <QStringList> +struct TandemRunBatch +{ + QString _tandem_bin_path; + QStringList _mz_file_list; + QString _preset_file; + QStringList _fasta_file_list; + QString _output_directory; +}; + +#endif // TANDEMRUNBATCH_H diff --git a/src/gui/ptm_peptide_list_view/ptmsequencedelegate.cpp b/src/gui/ptm_peptide_list_view/ptmsequencedelegate.cpp index d3832ff9..57a2c504 100644 --- a/src/gui/ptm_peptide_list_view/ptmsequencedelegate.cpp +++ b/src/gui/ptm_peptide_list_view/ptmsequencedelegate.cpp @@ -40,7 +40,7 @@ void PtmSequenceDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o const QModelIndex &index) const { if (index.data().canConvert<PtmSampleScan *>()) { - PtmSampleScan * p_ptm_sample_scan = qvariant_cast<PtmSampleScan *>(index.data()); + PtmSampleScan * p_ptm_sample_scan = index.data().value<PtmSampleScan *>(); // if (option.state & QStyle::State_Selected) // painter->fillRect(option.rect, option.palette.highlight()); diff --git a/src/gui/tandem_run_dialog/tandemrundialog.cpp b/src/gui/tandem_run_dialog/tandemrundialog.cpp index c00b0d52..664686ed 100644 --- a/src/gui/tandem_run_dialog/tandemrundialog.cpp +++ b/src/gui/tandem_run_dialog/tandemrundialog.cpp @@ -35,6 +35,7 @@ #include <QMessageBox> #include <pappsomspp/pappsoexception.h> +Q_DECLARE_METATYPE(QFileInfo) TandemRunDialog::TandemRunDialog(QWidget * parent): QDialog(parent), @@ -172,3 +173,14 @@ void TandemRunDialog::selectMzFiles() { // tr("Error choosing identification result files : %1").arg(error.qwhat()), error); } } + +TandemRunBatch TandemRunDialog::getTandemRunBatch() const { + TandemRunBatch tandem_run_batch; + tandem_run_batch._tandem_bin_path = ui->tandem_bin_label->text(); + 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._output_directory = ui->output_directory_label->text(); + return tandem_run_batch; +} diff --git a/src/gui/tandem_run_dialog/tandemrundialog.h b/src/gui/tandem_run_dialog/tandemrundialog.h index 199854b2..a45df02a 100644 --- a/src/gui/tandem_run_dialog/tandemrundialog.h +++ b/src/gui/tandem_run_dialog/tandemrundialog.h @@ -32,6 +32,8 @@ #include <QDialog> #include <QStringListModel> +#include "../../core/tandem_run/tandemrunbatch.h" + namespace Ui { class TandemRunDialog; } @@ -45,6 +47,7 @@ public: explicit TandemRunDialog(QWidget * parent); ~TandemRunDialog(); + TandemRunBatch getTandemRunBatch() const; void reset(); public slots: void selectFastaFiles(); -- GitLab