Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* \file /gui/tandem_run_dialog/tandem_run_dialog.cpp
* \date 31/8/2017
* \author Olivier Langella
* \brief dialog window to launch tandem process
*/
/*******************************************************************************
* 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 "tandemrundialog.h"
#include "ui_tandem_run_dialog.h"
#include <QDebug>
#include <QSettings>
#include <QFileDialog>
#include <QMessageBox>
#include <pappsomspp/pappsoexception.h>
TandemRunDialog::TandemRunDialog(QWidget * parent):
QDialog(parent),
ui(new Ui::TandemRunDialog)
{
qDebug() << "TandemRunDialog::TandemRunDialog begin";
ui->setupUi(this);
this->setModal(true);
_p_mz_file_list = new QStringListModel();
ui->fasta_file_listview->setModel(_p_fasta_file_list);
ui->mz_file_listview->setModel(_p_mz_file_list);
#if QT_VERSION >= 0x050000
// Qt5 code
/*
connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater);
connect(this, &PtSpectrumViewer::operateMsDataFile, worker, &PwizLoaderThread::doMsDataFileLoad);
connect(worker, &PwizLoaderThread::msDataReady, this, &PtSpectrumViewer::handleMsDataFile);
*/
#else
// Qt4 code
#endif
qDebug() << "TandemRunDialog::TandemRunDialog end";
}
TandemRunDialog::~TandemRunDialog()
{
delete ui;
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
delete _p_fasta_file_list;
delete _p_mz_file_list;
}
void TandemRunDialog::setPresetName(QString preset_name) {
QSettings settings;
settings.setValue("tandem/preset_name", preset_name);
}
void TandemRunDialog::fillPresetComboBox() {
ui->preset_combobox->clear();
QSettings settings;
QString default_preset_location = settings.value("path/tandemrun_preset_directory", "").toString();
QString default_preset_name = settings.value("tandem/preset_name", "").toString();
QDir preset_dir(default_preset_location);
QStringList filters;
filters << "*.xml";
preset_dir.setNameFilters(filters);
for (QFileInfo file_info: preset_dir.entryInfoList() ) {
ui->preset_combobox->addItem(file_info.baseName(), QVariant(file_info.absoluteFilePath()));
}
int index = ui->preset_combobox->findText(default_preset_name);
if ( index != -1 ) { // -1 for not found
ui->preset_combobox->setCurrentIndex(index);
}
}
void TandemRunDialog::reset() {
QSettings settings;
QString default_output_location = settings.value("path/identificationfiles", "").toString();
QString tandem_bin_path = settings.value("path/tandem_bin", "/usr/bin/tandem").toString();
ui->output_directory_label->setText(default_output_location);
ui->tandem_bin_label->setText(tandem_bin_path);
_p_fasta_file_list->stringList().clear();
_p_mz_file_list->stringList().clear();
/*
if (filenames.size() > 0) {
settings.setValue("path/identificationfiles", QFileInfo(filenames[0]).absolutePath());
}*/
}
void TandemRunDialog::selectOutputDirectory() {
try {
QSettings settings;
QString default_output_location = settings.value("path/identificationfiles", "").toString();
QString directory = QFileDialog::getExistingDirectory(this,tr("Choose output directory"),default_output_location );
if (!directory.isEmpty()) {
settings.setValue("path/identificationfiles", directory);
ui->output_directory_label->setText(directory);
}
}
catch (pappso::PappsoException & error) {
//QMessageBox::warning(this,
// tr("Error choosing identification result files : %1").arg(error.qwhat()), error);
}
void TandemRunDialog::selectFastaFiles() {
try {
QSettings settings;
QString default_fasta_location = settings.value("path/tandemrun_fastafiles_directory", "").toString();
QStringList filenames = QFileDialog::getOpenFileNames(this,tr("FASTA files"),default_fasta_location,
tr("FASTA files (*.fasta);;all files (*)") );
if (filenames.size() > 0) {
settings.setValue("path/tandemrun_fastafiles_directory", QFileInfo(filenames[0]).absolutePath());
}
QStringList file_list = _p_fasta_file_list->stringList();
file_list.append(filenames);
_p_fasta_file_list->setStringList(file_list);
}
catch (pappso::PappsoException & error) {
//QMessageBox::warning(this,
// tr("Error choosing identification result files : %1").arg(error.qwhat()), error);
}
}
void TandemRunDialog::selectMzFiles() {
try {
QSettings settings;
QString default_mz_location = settings.value("path/tandemrun_mzfiles_directory", "").toString();
QStringList filenames = QFileDialog::getOpenFileNames(this,tr("select peak list files"),default_mz_location,
tr("mz files (*.mzXML *.mzML *.mgf);;all files (*)") );
if (filenames.size() > 0) {
settings.setValue("path/tandemrun_mzfiles_directory", QFileInfo(filenames[0]).absolutePath());
}
QStringList file_list = _p_mz_file_list->stringList();
file_list.append(filenames);
_p_mz_file_list->setStringList(file_list);
}
catch (pappso::PappsoException & error) {
//QMessageBox::warning(this,
// tr("Error choosing identification result files : %1").arg(error.qwhat()), error);
}
}