Commit 1cb9cc4b authored by Christian Meesters's avatar Christian Meesters

command line options to submit call

parent 0535ab3f
......@@ -20,10 +20,6 @@ module load bio/BLAST+
SCRIPT_VERSION="0.2"
# saving the BLAST+ version for documentation purposes
#TODO: move to self-doc function part
blastx -version
# TODO: delete the following 3 functions, once sbcast is working
function queue {
QUEUE="$QUEUE $1"
......@@ -100,6 +96,7 @@ print_help ()
printf "\t%s\n" "-p,--partition: queue (default is nodeshort)"
printf "\t%s\n" "-A,--account: queue (default is the last submit account; an error is triggered if none specified nor can be deduced)"
printf "\t%s\n" "-N,--nodes: number of nodes (1 is the default)"
printf "\t%s\n" "--time: time in minutes (300 is the default)"
printf "\t%s\n" "-m,--blastmem: memory which is required for blast per instance (1G per default)"
printf "\t%s\n" "-r,--ramdisk: ramdisk size (default is 40 G)"
printf "\t%s\n" "-t,--threads: blast threads (default is 1)"
......@@ -107,7 +104,7 @@ print_help ()
printf "\t%s\n" "--blastdir: output directory (default is composition of input names)"
printf "\t%s\n" "--executable: choose executable (currently only from NCBI-BLAST, default: blastx)"
printf "\t%s\n" "--test,--no-test: dry run, testing only (off by default)"
printf "\t%s\n" "--credits,--version: Prints credits and a brief version history"
printf "\t%s\n" "--credits,--version: Prints credits and a brief version history and exits"
printf "\t%s\n" "-h,--help: Prints help"
echo
echo "WARNING: BLAST parameters:"
......@@ -151,6 +148,8 @@ credits()
echo " changes:"
echo " - deleted default evalue and max_target_seqs settings"
echo " - XML output is mandatory"
echo " fix:"
echo " - introduced missing --time option"
echo
echo "Current version is: $SCRIPT_VERSION"
echo
......@@ -158,6 +157,7 @@ credits()
echo "written and is maintained by Christian Meesters (ZDV, HPC group)."
echo "A (personal) acknowledgement is welcomed. Please refer to:"
echo "https://hpc.uni-mainz.de/high-performance-computing/publikationen/"
exit
}
# command line parsing
......@@ -229,6 +229,22 @@ do
fi
_arg_nodes="$_val"
;;
--time|--time=*)
_val_from_long="${_key##--time=}"
_val_from_short="${_key##-N}"
if test "$_val_from_long" != "$_key"
then
_val="$_val_from_long"
elif test "$_val_from_short" != "$_key" -a -n "$_val_from_short"
then
_val="$_val_from_short"
else
test $# -lt 2 && die "Missing value for the optional argument '$_key'." 1
_val="$2"
shift
fi
_arg_runlimit="$_val"
;;
-m*|--blastmem|--blastmem=*)
_val_from_long="${_key##--blastmem=}"
if test "$_val_from_long" != "$_key"
......@@ -349,7 +365,7 @@ DATABASE=$_arg_database
### check if query & database exist
if [ ! -e "$FASTA" ]; then
echo "$FASTA : no such file!"
error "FASTA input was: '$FASTA' - no such file!"
exit 1
fi
......@@ -486,17 +502,28 @@ handle.close()
EOF
)
if [[ $_arg_test == "on" ]]; then
echo "TEST - sending job:"
echo "sbatch -J $JOBTAG -p $_arg_queue -A $_arg_assoc -t $_arg_runlimit -N $_arg_nodes --gres=ramdisk:$_arg_ramdisk -c $_arg_blast_threads $SCRIPT $FASTA $DATABASE $BLASTPARAMS"
exit
fi
#### Self-Documentation
echo "You are using $0, version $SCRIPT_VERSION"
echo
echo "Self-Documentation:"
[[ $_arg_test == "on" ]] && echo " - This is a test-run, only"
echo " - The query input is '$FASTA'"
echo " - The database is '$DATABASE'"
BLASTVERSION=$($BLASTEXE -versioni | head -n1 | cut -f2 -d' ')
echo " - The executable is '$BLASTEXE', version: $BLASTVERSION"
### check if this script is on node by checking env-variable $SLURM_JOB_ID, else send it to SLURM with given parameters and exit
if [ -z "$SLURM_JOB_ID" ]; then
submit_call="sbatch --no-requeue -o ${JOBTAG}_%j.out -J $JOBTAG -p $_arg_queue -A $_arg_assoc -t $_arg_runlimit -N $_arg_nodes -n $((64 * $_arg_nodes)) --gres=ramdisk:$_arg_ramdisk -c $_arg_blast_threads $SCRIPT --partition $_arg_queue --account $_arg_assoc --nodes $_arg_nodes --time $_arg_runlimit --blastmem $_arg_blastmem --ramdisk $_arg_ramdisk --threads $_arg_blast_threads --splitup $_arg_splitup_per_queryfile --executable=$BLASTEXE $FASTA $DATABASE $BLASTPARAMS"
if [[ $_arg_test == "on" ]]; then
echo "Just testing - this command would be submitted:"
echo $submit_call
exit
fi
echo "sending job:"
echo "sbatch --no-requeue -o ${JOBTAG}_%j.out -J $JOBTAG -p $_arg_queue -A $_arg_assoc -t $_arg_runlimit -N $_arg_nodes --gres=ramdisk:$_arg_ramdisk -c $_arg_blast_threads $SCRIPT $FASTA $DATABASE $BLASTPARAMS"
sbatch --no-requeue -o ${JOBTAG}_%j.out -J $JOBTAG -p $_arg_queue -A $_arg_assoc -t $_arg_runlimit -N $_arg_nodes -n $((64 * $_arg_nodes)) --gres=ramdisk:$_arg_ramdisk -c $_arg_blast_threads $SCRIPT $FASTA $DATABASE $BLASTPARAMS
set -x
eval $submit_call
set +x
exit
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