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

new condor process class

parent 83d97262
No related branches found
No related tags found
No related merge requests found
......@@ -58,6 +58,7 @@ SET(CPP_FILES
core/labeling/label.cpp
core/labeling/labelingmethod.cpp
core/tandem_run/tandembatchprocess.cpp
core/tandem_run/tandemcondorprocess.cpp
core/msrun.cpp
core/peptidematch.cpp
core/peptidextp.cpp
......
/**
* \file /core/tandem_run/tandemcondorprocess.cpp
* \date 5/9/2017
* \author Olivier Langella
* \brief handles execution of a bunch of X!Tandem process throught condor job
*/
/*******************************************************************************
* 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 "tandecondorprocess.h"
TandeCondorProcess(WorkMonitorInterface * p_monitor, const TandemRunBatch & tandem_run_batch) : TandemBatchProcess(p_monitor, tandem_run_batch) {
/*
Universe = vanilla
notification = Error
Rank = Mips
request_memory= 50000
request_cpus = 1
Executable = /usr/bin/tandem
Log = /gorgone/pappso/tmp/temp_condor_job93294001891239208719639434471283743/submit_condor.log
Output = /gorgone/pappso/tmp/temp_condor_job93294001891239208719639434471283743/tandem.$(Process).out
Error = /gorgone/pappso/tmp/temp_condor_job93294001891239208719639434471283743/tandem.$(Process).error
Arguments = /gorgone/pappso/tmp/temp_condor_job93294001891239208719639434471283743/xtandem_param2054956555872858570.xml
Queue
*/
}
void TandeCondorProcess::run() {
qDebug() << "TandeCondorProcess::run begin " << _tandem_run_batch._preset_file;
_preset_file = _tandem_run_batch._preset_file;
prepareXmlDatabaseFile();
std::vector<QTemporaryFile *> input_file_list;
int i=0;
_p_monitor->setProgressMaximumValue(_tandem_run_batch._mz_file_list.size());
for (QString mz_file : _tandem_run_batch._mz_file_list) {
QTemporaryFile * p_xml_input_file = new QTemporaryFile();
input_file_list.push_back(p_xml_input_file);
p_xml_input_file->setAutoRemove(false);
if (p_xml_input_file->open())
{
QXmlStreamWriter * p_out = new QXmlStreamWriter();
p_out->setDevice(p_xml_input_file);
writeXmlInputFile(p_out, mz_file);
p_xml_input_file->close();
delete p_out;
} else
{
throw pappso::PappsoException(QObject::tr("error : cannot open the XML X!Tandem input file : %1\n").arg(p_xml_input_file->fileName()));
}
i++;
}
for (QTemporaryFile * p_xml_input_file: input_file_list) {
delete p_xml_input_file;
}
qDebug() << "TandeCondorProcess::run end" ;
}
/**
* \file /core/tandem_run/tandemcondorprocess.h
* \date 5/9/2017
* \author Olivier Langella
* \brief handles execution of a bunch of X!Tandem process throught condor job
*/
/*******************************************************************************
* 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 TANDECONDORPROCESS_H
#define TANDECONDORPROCESS_H
#include "tandembatchprocess.h"
class TandeCondorProcess: public TandemBatchProcess
{
public:
TandeCondorProcess(WorkMonitorInterface * p_monitor, const TandemRunBatch & tandem_run_batch);
virtual void run();
};
#endif // TANDECONDORPROCESS_H
......@@ -38,6 +38,32 @@ TandemBatchProcess::TandemBatchProcess(WorkMonitorInterface * p_monitor, const T
_p_monitor = p_monitor;
}
void TandemBatchProcess::writeXmlDatabaseFile (QXmlStreamWriter * p_out) {
p_out->setAutoFormatting(true);
p_out->writeStartDocument("1.0");
//<?xml version="1.0" encoding="UTF-8"?>
//<bioml label="x! taxon-to-file matching list">
p_out->writeStartElement("bioml");
p_out->writeAttribute("label","x! taxon-to-file matching list");
//<taxon label="usedefined">
p_out->writeStartElement("taxon");
p_out->writeAttribute("label","usedefined");
//<file format="peptide" URL="/gorgone/pappso/jouy/users/Didier/fasta/20170608_Delastours/contaminants_standards.fasta"></file>
//<file format="peptide" URL="/gorgone/pappso/jouy/users/Didier/fasta/20170608_Delastours/Escherichia coli 27J42_WGS_ECOLI_1.fasta"></file>
for (QString fasta_file:_tandem_run_batch._fasta_file_list) {
p_out->writeStartElement("file");
p_out->writeAttribute("format","peptide");
p_out->writeAttribute("URL",fasta_file);
p_out->writeEndElement();
}
//</taxon>
p_out->writeEndElement();
//</bioml>
p_out->writeEndElement();
p_out->writeEndDocument();
}
void TandemBatchProcess::prepareXmlDatabaseFile() {
_xml_database_file.setAutoRemove(false);
......@@ -45,30 +71,7 @@ void TandemBatchProcess::prepareXmlDatabaseFile() {
{
QXmlStreamWriter * p_out = new QXmlStreamWriter();
p_out->setDevice(&_xml_database_file);
p_out->setAutoFormatting(true);
p_out->writeStartDocument("1.0");
//<?xml version="1.0" encoding="UTF-8"?>
//<bioml label="x! taxon-to-file matching list">
p_out->writeStartElement("bioml");
p_out->writeAttribute("label","x! taxon-to-file matching list");
//<taxon label="usedefined">
p_out->writeStartElement("taxon");
p_out->writeAttribute("label","usedefined");
//<file format="peptide" URL="/gorgone/pappso/jouy/users/Didier/fasta/20170608_Delastours/contaminants_standards.fasta"></file>
//<file format="peptide" URL="/gorgone/pappso/jouy/users/Didier/fasta/20170608_Delastours/Escherichia coli 27J42_WGS_ECOLI_1.fasta"></file>
for (QString fasta_file:_tandem_run_batch._fasta_file_list) {
p_out->writeStartElement("file");
p_out->writeAttribute("format","peptide");
p_out->writeAttribute("URL",fasta_file);
p_out->writeEndElement();
}
//</taxon>
p_out->writeEndElement();
//</bioml>
p_out->writeEndElement();
p_out->writeEndDocument();
writeXmlDatabaseFile(p_out);
_xml_database_file.close();
delete p_out;
} else
......
......@@ -39,19 +39,22 @@ class TandemBatchProcess
public:
TandemBatchProcess(WorkMonitorInterface * p_monitor, const TandemRunBatch & tandem_run_batch);
void run();
virtual void run();
protected:
void writeXmlDatabaseFile (QXmlStreamWriter * p_out);
void writeXmlInputFile (QXmlStreamWriter * p_out, const QString & mz_file);
void prepareXmlDatabaseFile();
private:
void runOne(const QString & mz_file);
void prepareXmlDatabaseFile();
void writeXmlInputFile (QXmlStreamWriter * p_out, const QString & mz_file);
private:
protected:
QString _preset_file;
TandemRunBatch _tandem_run_batch;
WorkMonitorInterface * _p_monitor;
QString _preset_file;
int _max_xt_time_ms = (60000 * 60 * 24); //1 day
QTemporaryFile _xml_database_file;
private:
int _max_xt_time_ms = (60000 * 60 * 24); //1 day
};
#endif // TANDEMBATCHPROCESS_H
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