Skip to content
Snippets Groups Projects
Commit 057f78d8 authored by Langella Olivier's avatar Langella Olivier
Browse files

WIP: check tandem.exe binary and version

parent 53bfac98
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,45 @@
<property name="checked">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="tandem_bin_label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>528</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="text">
<string>change</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="tandem_version_label">
<property name="text">
<string>X!Tandem not found</string>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="exe_group_widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
......@@ -47,37 +85,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="tandem_bin_label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>528</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="text">
<string>change</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="use_htcondor_groupbox">
<property name="title">
......
......@@ -37,6 +37,7 @@
#include <QStandardPaths>
#include <pappsomspp/pappsoexception.h>
#include "../../files/tandemparametersfile.h"
#include "../../utils/utils.h"
// Q_DECLARE_METATYPE(QFileInfo)
......@@ -182,6 +183,11 @@ TandemRunDialog::reset()
QString tandem_bin_path =
settings.value("path/tandem_bin", "/usr/bin/tandem").toString();
ui->tandem_version_label->setText(
Utils::checkXtandemVersion(tandem_bin_path));
ui->output_directory_label->setText(default_output_location);
ui->tandem_bin_label->setText(tandem_bin_path);
......
......@@ -2,6 +2,8 @@
#include <pappsomspp/exception/exceptionnotfound.h>
#include <pappsomspp/mass_range.h>
#include <cmath>
#include <QProcess>
#include <QDebug>
const QUrl
Utils::getOlsUrl(QString psimod_accession)
......@@ -239,3 +241,61 @@ Utils::translateAaModificationFromUnimod(const QString &unimod_accession)
<< unimod_accession << " not found";
return nullptr;
}
const QString
Utils::checkXtandemVersion(const QString &tandem_bin_path)
{
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
QString version_return;
QStringList arguments;
arguments << "-v";
QProcess *xt_process = new QProcess();
// hk_process->setWorkingDirectory(QFileInfo(_hardklor_exe).absolutePath());
xt_process->start(tandem_bin_path, arguments);
if(!xt_process->waitForStarted())
{
throw pappso::PappsoException(
QObject::tr("X!Tandem process failed to start"));
}
while(xt_process->waitForReadyRead(1000))
{
}
/*
if (!xt_process->waitForFinished(_max_xt_time_ms)) {
throw pappso::PappsoException(QObject::tr("can't wait for X!Tandem process
to finish : timeout at %1").arg(_max_xt_time_ms));
}
*/
QByteArray result = xt_process->readAll();
qDebug() << result.constData();
QRegExp parse_version("X! TANDEM ([A-Z]+) \\((.*)\\)");
// Pattern patt = Pattern.compile("X! TANDEM [A-Z]+ \\((.*)\\)",
// Pattern.CASE_INSENSITIVE);
if(parse_version.exactMatch(result.constData()))
{
version_return = parse_version.capturedTexts().join(" ");
}
QProcess::ExitStatus Status = xt_process->exitStatus();
delete xt_process;
if(Status != 0)
{
// != QProcess::NormalExit
throw pappso::PappsoException(
QObject::tr("error executing X!Tandem Status != 0 : %1 %2\n%3")
.arg(tandem_bin_path)
.arg(arguments.join(" ").arg(result.data())));
}
return version_return;
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
......@@ -36,6 +36,7 @@ class Utils
static const QString getIdentificationEngineName(IdentificationEngine engine);
static const QString getDatabaseName(ExternalDatabase database);
static const QString getXmlDouble(pappso::pappso_double number);
static const QString checkXtandemVersion(const QString &tandem_bin_path);
static pappso::AaModificationP
guessAaModificationPbyMonoisotopicMassDelta(pappso::mz mass);
static pappso::AaModificationP
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment