diff --git a/blast/parallel_BLAST/LA_Wrapper b/blast/parallel_BLAST/LA_Wrapper index eb8fb5cf91655ffbb67fe787093cd7463e3248c4..a327cb89b3f6f77e654cdff61967711dc11361c7 100755 --- a/blast/parallel_BLAST/LA_Wrapper +++ b/blast/parallel_BLAST/LA_Wrapper @@ -139,7 +139,7 @@ _arg_compress=on print_help () { echo "This script's help msg" - printf 'Usage: %s [-l|--runlimit ] [-p|--partition ] [-s|--splitup ] [-N|--nodes ] [--executable ] [-m|--mem ] [--blastparams ] [-r|--ramdisk ] [--blastdir ] [--(no-)test] [-h|--help] \n' "$(basename $0)\n" + printf 'Usage: %s [-l|--runlimit ] [-p|--partition ] [-N|--nodes ] [--executable ] [--blastparams ] [-r|--ramdisk ] [--blastdir ] [--(no-)test] [-h|--help] \n' "$(basename $0)\n" printf 'HINT: The FASTA and DATABASE items need to be full paths to files.\n' printf "\\t\\033[1m%s\\033[0m\\t\\t%s\\n" "" "path to the query FASTA file" printf "\\t\\033[1m%s\\033[0m\\t%s\\n" "" "path to the database file" @@ -149,11 +149,8 @@ print_help () printf "\\t\\033[1m%s\\033[0m\\t%s\\n" "-N,--nodes" "number of nodes (1 is the default)" printf "\\t\\033[1m%s\\033[0m\\t%s\\n" "--reservation" "reservation to use (none is the default)" printf "\\t\\033[1m%s\\033[0m\\t%s\\n" "--time" "time in minutes (300 is the default)" - printf "\\t\\033[1m%s\\033[0m\\t%s\\n" "-m,--mem" "memory which is required per node (defaults to 115500 M, but should be min. 242500 M for blastn, omit the unit for submitting)" - printf "\\t\\033[1m%s\\033[0m\\t%s\\n" "-r,--ramdisk" "ramdisk size in units of GiB (default is 40 GiB)" printf "\\t\\033[1m%s\\033[0m\\t%s\\n" "-t,--threads" "blast threads (default is 1)" printf "\\t\\033[1m%s\\033[0m\\t%s\\n" "--blastparams" "blast parameters (default is -outfmt 6 (for blank tabulated output))" - printf "\\t\\033[1m%s\\033[0m\\t%s\\n" "-s,--splitup" "No. of FASTA sequences per query file (default is to generate ~5000 files)" printf "\\t\\033[1m%s\\033[0m\\t%s\\n" "--blastdir" "output directory (default is composition of input names)" printf "\\t\\033[1m%s\\033[0m\\t%s\\n" "--executable" "choose executable (currently only from NCBI-BLAST, default: blastx)" printf "\\t\\033[1m%s\\033[0m\\t%s\\n" "--compress" "if set, the output files will be merged and compressed (time consuming!, defaultt: off)" @@ -224,7 +221,10 @@ credits() echo " - faster stage-in for reference data" echo " - automerge for -outfmt=6" echo " - -outfmt=6 is now the default" - echo "- v0.5.1 -- 29. Aug. 2019 -- numerous fixes" + echo "- v0.5.1 -- 29. Aug. 2019 -- numerous housekeeping fixes" + echo "- v0.5.2 -- 02. Sep. 2019 -- fix:" + echo " - consistent biopython inclusion" + echo " - auto-detection of database size and memory selection" echo echo "Current version is: $SCRIPT_VERSION" echo @@ -595,7 +595,7 @@ fi export _arg_executable ### which is the reference directory size? -_arg_ramdisk=$(du -shL --block-size=1M "$_arg_database" | cut -f1 )M +_arg_ramdisk=$(du -shL --block-size=1M "$_arg_database" | cut -f1 ) if [[ ! $SCRIPT == /* ]]; then SCRIPT="$PWD/$SCRIPT"; fi @@ -603,20 +603,37 @@ fi # which cluster are we on? cluster=$(sacctmgr show cluster -p| tail -n1| cut -f1 -d '|') # if the cluster is Mogon I, set the memory default accordingly: +allowed_mem_setting="" if [ "$cluster" == "mogon" ]; then - if [ $_arg_mem -ne 0 ]; then # user tries to select a non-default memory - allowed_mem_setting="115500 242500 497500" - if [[ ! $allowed_mem_settings =~ (^|[[:space:]])"_arg_mem"($|[[:space:]]) ]]; then - error "Memory selection out to be one of [$allowed_mem_settings]" + allowed_mem_settings="115500 242500 497500" + # add a savety measure (100 MB, each core) + for setting in $allowed_mem_settings; do + if [ $((_arg_ramdisk + 6400 )) -lt $setting ]; then + allowed_mem_setting="$allowed_mem_setting $setting" fi - else # set a default memory - if [ "$_arg_executable" == "blastn" ]; then - _memory_request="242500M" - else - _memory_request="115500M" + done + # test whether there is any valid setting left + if [ -z "$allowed_mem_setting" ]; then + error "database > available + necessary RAM" + exit 1 + fi + # remove first space, if any + allowed_mem_setting="${allowed_mem_setting/ /}" + if [ $_arg_mem -ne 0 ]; then # user tries to select a non-default memory + if [[ ! "$allowed_mem_setting" =~ (^|[[:space:]])"$_arg_mem"($|[[:space:]]) ]]; then + error "Memory selection out to be one of [$allowed_mem_setting]" + exit 1 fi + # select a default + else + _memory_request=$(echo $allowed_mem_setting | cut -d" " -f1)M + #if [ "$_arg_executable" == "blastn" ]; then + # _memory_request="242500M" + #else + # _memory_request="115500M" + #fi fi -else +else # to be implemented for MII if [ $_arg_mem -ne 0 ]; then # user tries to select a non-default memory allowed_mem_setting="115500 242500 497500" if [[ ! $allowed_mem_settings =~ (^|[[:space:]])"_arg_mem"($|[[:space:]]) ]]; then @@ -630,6 +647,8 @@ else fi fi fi +# finally add another MB to the ramdisk to be save and the unit +_arg_ramdisk=$((_arg_ramdisk + 1024 ))M ### how many entries are there in the FASTA file? nentries=$(grep '>' $FASTA | wc -l)