diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3f2859b87a1bb24a6f1aedbe796f695306575a62..e2e6453e3d77e68bc5d41ecd5e74a5f31c8c7abe 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 diff --git a/src/core/tandem_run/tandecondorprocess.cpp b/src/core/tandem_run/tandecondorprocess.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2354a0617ed2a6da64759dfed1feaa59474687fb --- /dev/null +++ b/src/core/tandem_run/tandecondorprocess.cpp @@ -0,0 +1,85 @@ +/** + * \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" ; +} diff --git a/src/core/tandem_run/tandecondorprocess.h b/src/core/tandem_run/tandecondorprocess.h new file mode 100644 index 0000000000000000000000000000000000000000..57e85f6ae050dc606d7dc34ca70ba9e409c17ec3 --- /dev/null +++ b/src/core/tandem_run/tandecondorprocess.h @@ -0,0 +1,44 @@ +/** + * \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 diff --git a/src/core/tandem_run/tandembatchprocess.cpp b/src/core/tandem_run/tandembatchprocess.cpp index b8532fce4cb4467e598fe0c353261fa2cf66b6c4..b6ecc7ed630c101de894060f66757dfa950be11d 100644 --- a/src/core/tandem_run/tandembatchprocess.cpp +++ b/src/core/tandem_run/tandembatchprocess.cpp @@ -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 diff --git a/src/core/tandem_run/tandembatchprocess.h b/src/core/tandem_run/tandembatchprocess.h index cdc6397e75a01e8c856cc63ea0aa7c3f87169672..cda9bdc90ff0a47bccf3e4e6abca9d5d58d5e4d6 100644 --- a/src/core/tandem_run/tandembatchprocess.h +++ b/src/core/tandem_run/tandembatchprocess.h @@ -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