Commit cf450ee5 by Riccardo Vicedomini

given the possibility to remove temporary files and specify output file

parent d3d1fb93
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
trap ctrl_c INT TERM ERR; function ctrl_c() { exit 5; } trap ctrl_c INT TERM ERR; function ctrl_c() { exit 5; }
trap 'kill 0' EXIT trap 'kill 0' EXIT
CMD_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd) CMD_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)
CMD_NAME=$(basename "${BASH_SOURCE[0]}") CMD_NAME=$(basename "${BASH_SOURCE[0]}")
SCRIPTS_DIR="${CMD_DIR}"/scripts SCRIPTS_DIR="${CMD_DIR}"/scripts
...@@ -34,6 +33,8 @@ DAMA_OLPMAXDOM=50 ...@@ -34,6 +33,8 @@ DAMA_OLPMAXDOM=50
MCLADE_USEDAMA=false MCLADE_USEDAMA=false
MCLADE_USESGE=false MCLADE_USESGE=false
MCLADE_WORKDIR=${PWD} MCLADE_WORKDIR=${PWD}
MCLADE_OUTFILE=""
MCLADE_RMTMP=false
NTHREADS=1 NTHREADS=1
NJOBS=16 NJOBS=16
...@@ -41,11 +42,13 @@ function print_usage() { ...@@ -41,11 +42,13 @@ function print_usage() {
echo -en "\n USAGE: ${CMD_NAME} -i <input_fasta> -N <name> [options]\n" echo -en "\n USAGE: ${CMD_NAME} -i <input_fasta> -N <name> [options]\n"
echo -en "\n" echo -en "\n"
echo -en " MANDATORY OPTIONS:\n echo -en " MANDATORY OPTIONS:\n
-N, --name <str>\tDataset/job name and name of the directory used to
\tstore intermediate results\n
-i, --input <path>\tInput file of AA sequences in FASTA format\n -i, --input <path>\tInput file of AA sequences in FASTA format\n
-N, --name <str>\tDataset/job name\n
" | column -t -s $'\t' " | column -t -s $'\t'
echo -en "\n" echo -en "\n"
echo -en " MetaCLADE OPTIONS:\n echo -en " MetaCLADE2 OPTIONS:\n
-o, --output <path>\tOutput file of domain architecture\n
-a, --arch\tUse DAMA to properly compute domain architectures\n -a, --arch\tUse DAMA to properly compute domain architectures\n
\t(useful only for long protein sequences)\n \t(useful only for long protein sequences)\n
-d, --domain-list <str>\tComma-spearated list of Pfam accession numbers of\n -d, --domain-list <str>\tComma-spearated list of Pfam accession numbers of\n
...@@ -53,7 +56,8 @@ function print_usage() { ...@@ -53,7 +56,8 @@ function print_usage() {
\t(e.g., \"PF00875,PF03441\")\n \t(e.g., \"PF00875,PF03441\")\n
-D, --domain-file <path>\tFile that contains the Pfam accession numbers\n -D, --domain-file <path>\tFile that contains the Pfam accession numbers\n
\tof the domains to be considered (one per line)\n \tof the domains to be considered (one per line)\n
-W, --work-dir <path>\tWorking directory, where jobs and results are saved\n -W, --work-dir <path>\tWorking directory (default:current directory)\n
--remove-temp\tRemove temporary intermediate files, keeping only results and logs\n
" | column -t -s $'\t' " | column -t -s $'\t'
echo -en "\n" echo -en "\n"
echo -en " DAMA OPTIONS:\n echo -en " DAMA OPTIONS:\n
...@@ -85,8 +89,8 @@ function print_usage() { ...@@ -85,8 +89,8 @@ function print_usage() {
# retrieve provided arguments # retrieve provided arguments
opts="i:N:ad:D:e:E:W:t:j:hV" opts="N:i:o:ad:D:e:E:W:t:j:hV"
longopts="input:,name:,arch,domain-list:,domain-file:,evalue-cutoff:,evalue-cutconf:,overlappingAA:,overlappingMaxDomain:,work-dir,threads:,jobs:,help,version,sge,pe:,queue:,time-limit:" longopts="name:,input:,output:,arch,domain-list:,domain-file:,evalue-cutoff:,evalue-cutconf:,overlappingAA:,overlappingMaxDomain:,work-dir,remove-temp,threads:,jobs:,help,version,sge,pe:,queue:,time-limit:"
ARGS=$(getopt -o "${opts}" -l "${longopts}" -n "${CMD_NAME}" -- "${@}") ARGS=$(getopt -o "${opts}" -l "${longopts}" -n "${CMD_NAME}" -- "${@}")
if [ $? -ne 0 ] || [ $# -eq 0 ]; then # do not change the order of this test! if [ $? -ne 0 ] || [ $# -eq 0 ]; then # do not change the order of this test!
print_usage print_usage
...@@ -96,13 +100,17 @@ eval set -- "${ARGS}" ...@@ -96,13 +100,17 @@ eval set -- "${ARGS}"
while [ -n "${1}" ]; do while [ -n "${1}" ]; do
case ${1} in case ${1} in
-N|--name)
shift
MCLADE_JOBNAME=${1}
;;
-i|--input) -i|--input)
shift shift
INPUT_FASTA=${1} INPUT_FASTA=${1}
;; ;;
-N|--name) -o|--output)
shift shift
MCLADE_JOBNAME=${1} MCLADE_OUTFILE=${1}
;; ;;
-a|--arch) -a|--arch)
MCLADE_USEDAMA=true MCLADE_USEDAMA=true
...@@ -135,6 +143,9 @@ while [ -n "${1}" ]; do ...@@ -135,6 +143,9 @@ while [ -n "${1}" ]; do
shift shift
MCLADE_WORKDIR=${1} MCLADE_WORKDIR=${1}
;; ;;
--remove-temp)
MCLADE_RMTMP=true
;;
-t|--threads) -t|--threads)
shift shift
NTHREADS=${1} NTHREADS=${1}
...@@ -249,12 +260,15 @@ if [ $? -ne 0 ]; then ...@@ -249,12 +260,15 @@ if [ $? -ne 0 ]; then
fi fi
print_status "MetaCLADE working directory: ${MCLADE_WORKDIR}" print_status "MetaCLADE working directory: ${MCLADE_WORKDIR}"
if [ -z "${MCLADE_OUTFILE}" ]; then MCLADE_OUTFILE="${MCLADE_WORKDIR}"/"${MCLADE_JOBNAME}".arch.txt; fi
print_status "output will be saved to: ${MCLADE_OUTFILE}"
# Create MetaCLADE scripts # Create MetaCLADE scripts
print_status "creating MetaCLADE script/job files" print_status "creating MetaCLADE script/job files"
python3 "${SCRIPTS_DIR}/mclade_create_jobs.py" \ python3 "${SCRIPTS_DIR}/mclade_create_jobs.py" \
-i "${INPUT_FASTA}" -N "${MCLADE_JOBNAME}" ${MCLADE_DOMARG} -W "${MCLADE_WORKDIR}" \ -i "${INPUT_FASTA}" -N "${MCLADE_JOBNAME}" ${MCLADE_DOMARG} -W "${MCLADE_WORKDIR}" \
-e "${MCLADE_EVALUECUTOFF}" -E "${MCLADE_EVALUECUTCONF}" --overlappingAA ${DAMA_OLPAA} --overlappingMaxDomain ${DAMA_OLPMAXDOM} ${MCLADE_DAMAARG} \ -e "${MCLADE_EVALUECUTOFF}" -E "${MCLADE_EVALUECUTCONF}" --overlappingAA ${DAMA_OLPAA} --overlappingMaxDomain ${DAMA_OLPMAXDOM} ${MCLADE_DAMAARG} \
-j "${NJOBS}" -j "${NJOBS}" >"${MCLADE_WORKDIR}/log/mclade_create_jobs.out" 2>"${MCLADE_WORKDIR}/log/mclade_create_jobs.err"
# Run MetaCLADE scripts (possibly using SGE) # Run MetaCLADE scripts (possibly using SGE)
...@@ -328,6 +342,8 @@ else ...@@ -328,6 +342,8 @@ else
${PEXEC_CMD} ${f} 2>"${MCLADE_WORKDIR}/log/arch.out" >"${MCLADE_WORKDIR}/log/arch.err" ${PEXEC_CMD} ${f} 2>"${MCLADE_WORKDIR}/log/arch.out" >"${MCLADE_WORKDIR}/log/arch.err"
cmdret=$?; if (( cmdret != 0 )); then print_error "architecture job failed (exit status: ${cmdret})"; exit 1; fi cmdret=$?; if (( cmdret != 0 )); then print_error "architecture job failed (exit status: ${cmdret})"; exit 1; fi
fi fi
cp "${MCLADE_WORKDIR}/results/3_arch/${MCLADE_JOBNAME}.arch.txt" "${MCLADE_OUTFILE}"
print_status "architecture job finished successfully" print_status "architecture job finished successfully"
if [ "${MCLADE_RMTMP}" = true ]; then print_status "removing temporary files"; rm -r "${MCLADE_WORKDIR}"/{results,jobs,temp}; fi
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