Commit e181dd50 authored by Olivier Langella's avatar Olivier Langella
Browse files

write tandem parameter file should be ok, overwriting number of threads

parent 668ea79a
......@@ -32,6 +32,8 @@
#include <pappsomspp/pappsoexception.h>
#include <QFileInfo>
#include <QDebug>
#include <QTemporaryDir>
#include "../../files/tandemparametersfile.h"
TandemBatchProcess::TandemBatchProcess(MainWindow * p_main_window, WorkMonitorInterface * p_monitor, const TandemRunBatch & tandem_run_batch) {
_p_main_window = p_main_window;
......@@ -95,7 +97,20 @@ void TandemBatchProcess::prepareXmlDatabaseFile() {
void TandemBatchProcess::run() {
qDebug() << "TandemBatchProcess::run begin " << _tandem_run_batch._preset_file;
_preset_file = _tandem_run_batch._preset_file;
QTemporaryDir tmp_dir;
if (!tmp_dir.isValid()) {
// dir.path() returns the unique directory path
throw pappso::PappsoException(QObject::tr("problem creating temporary directory in %1\n").arg(tmp_dir.path()));
}
TandemParametersFile orig_parameter_file(_tandem_run_batch._preset_file);
_preset_file = QString("%1/%2").arg(tmp_dir.path()).arg(orig_parameter_file.getFilename());
TandemParametersFile new_parameter_file(_preset_file);
TandemParameters new_param = orig_parameter_file.getTandemParameters();
// <note type="input" label="spectrum, threads">1</note>
new_param.setParamLabelValue("spectrum, threads",QString("%1").arg(_tandem_run_batch._number_of_threads));
new_parameter_file.setTandemParameters(new_param);
prepareXmlDatabaseFile();
......
......@@ -105,7 +105,7 @@ void TandemCondorProcess::run() {
TandemParametersFile new_parameter_file(_preset_file);
TandemParameters new_param = orig_parameter_file.getTandemParameters();
// <note type="input" label="spectrum, threads">1</note>
new_param.setParamLabel("spectrum, threads",QString("%1").arg(_tandem_run_batch._number_of_threads));
new_param.setParamLabelValue("spectrum, threads",QString("%1").arg(_tandem_run_batch._number_of_threads));
new_parameter_file.setTandemParameters(new_param);
prepareXmlDatabaseFile();
......
......@@ -28,6 +28,7 @@
******************************************************************************/
#include "tandemparameters.h"
#include <QDebug>
TandemParameters::TandemParameters() {
}
......@@ -35,17 +36,33 @@ TandemParameters::~TandemParameters() {
}
TandemParameters::TandemParameters(const TandemParameters & other) {
qDebug() << "TandemParameters::TandemParameters copy begin";
//_map_label_value = other._map_label_value;
_method_name = other._method_name;
QMap<QString, QString>::const_iterator i = other._map_label_value.constBegin();
while (i != other._map_label_value.constEnd()) {
qDebug() << "TandemParameters::TandemParameters copy " << i.key() << " " << i.value();
_map_label_value.insert(i.key(), i.value());
i++; // added
}
qDebug() << "TandemParameters::TandemParameters copy end";
}
const QString TandemParameters::getLabelCategory(const QString & value) const {
return value.split(", ").at(0);
}
void TandemParameters::setParamLabelValue(const QString & label, const QString & value) {
//list path
//<note type="input" label="list path, default parameters">/gorgone/pappso/tmp/temp_condor_job24872841484824316495370334631825647/QExactive_analysis_FDR_nosemi.xml</note>
//<note type="input" label="list path, taxonomy information">/gorgone/pappso/tmp/temp_condor_job24872841484824316495370334631825647/database.xml</note>
if (getLabelCategory(label) == "list path") {
return;
}
if (label == "spectrum, path") {
return;
}
void TandemParameters::setParamLabel(const QString & label, const QString & value) {
_map_label_value.insert(label, value);
}
void TandemParameters::setMethodName(const QString & method) {
......
......@@ -41,8 +41,10 @@ public:
virtual ~TandemParameters();
void setMethodName(const QString & method);
void setParamLabel(const QString & label, const QString & value);
void setParamLabelValue(const QString & label, const QString & value);
const QMap<QString, QString> & getMapLabelValue() const;
private:
const QString getLabelCategory(const QString & value) const;
private:
QString _method_name;
QMap<QString, QString> _map_label_value;
......
......@@ -115,4 +115,7 @@ void WaitingMessageDialog::hideEvent( QHideEvent* event ) {
void WaitingMessageDialog::showEvent( QShowEvent* event ) {
QWidget::showEvent( event );
_p_movie->start();
ui->stop_push_button->setChecked(false);
ui->stop_push_button->setVisible(false);
_asked_to_stop = false;
}
......@@ -48,7 +48,7 @@ bool XtandemParamSaxHandler::startElement(const QString & namespaceURI, const QS
try {
//startElement_group
if (qName == "c") {
if (qName == "note") {
is_ok = startElement_note(attributes);
}
_current_text.clear();
......@@ -134,19 +134,22 @@ bool XtandemParamSaxHandler::characters(const QString &str) {
}
bool XtandemParamSaxHandler::startElement_note(QXmlAttributes attributes) {
// logger.debug("startElementgroup begin");
qDebug() << "XtandemParamSaxHandler::startElement_note begin " << attributes.value("type");
_current_label = "";
if (attributes.value("type") == "input") {
_current_label = attributes.value("label");
}
qDebug() << "XtandemParamSaxHandler::startElement_note _current_label " << _current_label;
return true;
}
bool XtandemParamSaxHandler::endElement_note() {
qDebug() << "XtandemParamSaxHandler::endElement_note begin " << _current_label << " " << _current_text.simplified();
if (!_current_label.isEmpty()) {
_p_tandem_parameters->setParamLabel( _current_label, _current_text.simplified());
_p_tandem_parameters->setParamLabelValue( _current_label, _current_text.simplified());
}
return true;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment