Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
metaclade2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Riccardo Vicedomini
metaclade2
Commits
aa4b9770
Commit
aa4b9770
authored
Feb 15, 2020
by
Riccardo Vicedomini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the possibility to use SGE for search/filter, needs testing
parent
1f1aeaf5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
9 deletions
+69
-9
metaclade2
metaclade2
+69
-9
No files found.
metaclade2
View file @
aa4b9770
...
@@ -34,12 +34,6 @@ MCLADE_WORKDIR=${PWD}
...
@@ -34,12 +34,6 @@ MCLADE_WORKDIR=${PWD}
NTHREADS
=
1
NTHREADS
=
1
NJOBS
=
16
NJOBS
=
16
PEXEC_CMD
=
"parallel --halt now,fail=1 -j
${
NJOBS
}
"
if
!
command
-v
parallel
>
/dev/null 2>&1
;
then
print_warning
"cannot find GNU parallel, all jobs will be run sequentially"
PEXEC_CMD
=
"/usr/bin/env bash --"
fi
function
print_usage
()
{
function
print_usage
()
{
echo
-en
"
\n
USAGE:
${
CMD_NAME
}
-i <input_fasta> [options]
\n
"
echo
-en
"
\n
USAGE:
${
CMD_NAME
}
-i <input_fasta> [options]
\n
"
echo
-en
"
\n
"
echo
-en
"
\n
"
...
@@ -143,6 +137,13 @@ done
...
@@ -143,6 +137,13 @@ done
# Input parameters validation
# Input parameters validation
PEXEC_CMD
=
"parallel --halt now,fail=1 -j
${
NTHREADS
}
::::"
if
!
command
-v
parallel
>
/dev/null 2>&1
;
then
print_warning
"cannot find GNU parallel, all jobs will be run sequentially"
NTHREADS
=
1
PEXEC_CMD
=
"/usr/bin/env bash --"
fi
if
[
-z
"
${
INPUT_FASTA
}
"
]
||
[
!
-f
${
INPUT_FASTA
}
]
;
then
if
[
-z
"
${
INPUT_FASTA
}
"
]
||
[
!
-f
${
INPUT_FASTA
}
]
;
then
print_error
"-i|--input file is missing or does not exist:
${
INPUT_FASTA
}
"
print_error
"-i|--input file is missing or does not exist:
${
INPUT_FASTA
}
"
exit
1
exit
1
...
@@ -181,24 +182,83 @@ fi
...
@@ -181,24 +182,83 @@ fi
check_cmds
"python3"
check_cmds
"python3"
# Validate SGE parameters
if
[
"
${
MCLADE_USESGE
}
"
=
true
]
;
then
if
[
-z
${
SGE_PENAME
}
]
;
then
print_error
"you must set a parallel environment name with -P|--parallel-env option along with the --SGE option"
exit
1
fi
if
[
!
-z
${
SGE_QUEUE
}
]
;
then
SGE_QUEUEARG
=
"-q
${
SGE_QUEUE
}
"
fi
if
[
!
-z
${
SGE_TIMELIM
}
]
;
then
SGE_TIMELIMARG
=
"-l h_rt=
${
SGE_TIMELIM
}
"
fi
fi
# Create Working directory
# Create Working directory
MCLADE_WORKDIR
=
${
MCLADE_WORKDIR
}
"/"
${
MCLADE_JOBNAME
}
MCLADE_WORKDIR
=
${
MCLADE_WORKDIR
}
"/"
${
MCLADE_JOBNAME
}
mkdir
-p
${
MCLADE_WORKDIR
}
mkdir
-p
"
${
MCLADE_WORKDIR
}
"
"
${
MCLADE_WORKDIR
}
/log"
if
[
$?
-ne
0
]
;
then
if
[
$?
-ne
0
]
;
then
print_error
"cannot create/access MetaCLADE working directory:
${
MCLADE_WORKDIR
}
"
print_error
"cannot create/access MetaCLADE working directory:
${
MCLADE_WORKDIR
}
"
exit
1
exit
1
fi
fi
print_status
"MetaCLADE working directory:
${
MCLADE_WORKDIR
}
"
print_status
"MetaCLADE working directory:
${
MCLADE_WORKDIR
}
"
# Create MetaCLADE scripts
print_status
"creating MetaCLADE script/job files"
print_status
"creating MetaCLADE script/job files"
python3
"
${
SCRIPTS_DIR
}
/mclade_create_jobs.py"
-i
"
${
INPUT_FASTA
}
"
-N
"
${
MCLADE_JOBNAME
}
"
${
MCLADE_DOMARG
}
-W
"
${
MCLADE_WORKDIR
}
"
-e
"
${
MCLADE_EVALUECUTOFF
}
"
-E
"
${
MCLADE_EVALUECUTCONF
}
"
-j
"
${
NJOBS
}
"
python3
"
${
SCRIPTS_DIR
}
/mclade_create_jobs.py"
-i
"
${
INPUT_FASTA
}
"
-N
"
${
MCLADE_JOBNAME
}
"
${
MCLADE_DOMARG
}
-W
"
${
MCLADE_WORKDIR
}
"
-e
"
${
MCLADE_EVALUECUTOFF
}
"
-E
"
${
MCLADE_EVALUECUTCONF
}
"
-j
"
${
NJOBS
}
"
# Possibly run MetaCLADE scripts in a SGE environment
if
[
"
${
MCLADE_USESGE
}
"
=
true
]
;
then
if
[
"
${
MCLADE_USESGE
}
"
=
true
]
;
then
# run search jobs
# submit search jobs
print_status
"submitting search jobs"
pidarr
=()
for
i
in
$(
seq 1
${
NJOBS
})
;
do
for
i
in
$(
seq 1
${
NJOBS
})
;
do
f
=
"
${
MCLADE_WORKDIR
}
/jobs/1_search/
${
MCLADE_JOBNAME
}
_
${
i
}
.sh"
f
=
"
${
MCLADE_WORKDIR
}
/jobs/1_search/
${
MCLADE_JOBNAME
}
_
${
i
}
.sh"
# run a qsub job for each non-empty script
if
[
-f
"
${
f
}
"
]
&&
[
-s
"
${
f
}
"
]
;
then
qsub
$SGE_QUEUEARG
$SGE_TIMELIMARG
-e
"
${
MCLADE_WORKDIR
}
/log/search_
${
i
}
.err"
-o
"
${
MCLADE_WORKDIR
}
/log/search_
${
i
}
.out"
-cwd
-sync
yes
-N
${
MCLADE_JOBNAME
}
-pe
${
SGE_PENAME
}
${
NTHREADS
}
-b
y
${
PEXEC_CMD
}
${
f
}
&
pid
=
$!
pidarr[
$i
]=
$pid
((
i++
))
fi
done
# wait search jobs to finish
print_status
"waiting the search jobs to finish"
for
i
in
${
!pidtab[@]
}
;
do
wait
${
pidtab
[
${
i
}
]
}
ret
=
$?
if
((
ret
!=
0
))
;
then
echo
"MetaCLADE search job
${
i
}
failed (exit status:
${
ret
}
)"
exit
1
fi
done
echo
"search jobs finished successfully"
# submit filter jobs
print_status
"submitting filter ijobs"
unset
pidarr
pidarr
=()
for
i
in
$(
seq 1
${
NJOBS
})
;
do
f
=
"
${
MCLADE_WORKDIR
}
/jobs/1_filter/
${
MCLADE_JOBNAME
}
_
${
i
}
.sh"
# run a qsub job for each non-empty script
if
[
-f
"
${
f
}
"
]
&&
[
-s
"
${
f
}
"
]
;
then
if
[
-f
"
${
f
}
"
]
&&
[
-s
"
${
f
}
"
]
;
then
echo
"qsub -sync yes -b y
${
f
}
"
qsub
$SGE_QUEUEARG
$SGE_TIMELIMARG
-e
"
${
MCLADE_WORKDIR
}
/log/filter_
${
i
}
.err"
-o
"
${
MCLADE_WORKDIR
}
/log/filter_
${
i
}
.out"
-cwd
-sync
yes
-N
${
MCLADE_JOBNAME
}
-pe
${
SGE_PENAME
}
${
NTHREADS
}
-b
y
${
PEXEC_CMD
}
${
f
}
&
pid
=
$!
pidarr[
$i
]=
$pid
((
i++
))
fi
done
# wait search jobs to finish
print_status
"waiting the filter jobs to finish"
for
i
in
${
!pidtab[@]
}
;
do
wait
${
pidtab
[
${
i
}
]
}
ret
=
$?
if
((
ret
!=
0
))
;
then
echo
"MetaCLADE filter job
${
i
}
failed (exit status:
${
ret
}
)"
exit
1
fi
fi
done
done
echo
"search jobs finished successfully"
fi
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment