Commit 78ff24ea authored by Christian Meesters's avatar Christian Meesters

various hot fixes for sanity checks

parent 1bf25c1b
......@@ -18,7 +18,7 @@ module load tools/parallel
module load bio/BLAST+
# inherently loaded is python
SCRIPT_VERSION="0.3"
SCRIPT_VERSION="0.3.1"
# TODO: delete the following 3 functions, once sbcast is working
function queue {
......@@ -92,7 +92,7 @@ _arg_compress=off
print_help ()
{
echo "This script's help msg"
printf 'Usage: %s [-l|--runlimit <arg>] [-p|--partition <arg>] [-s|--stopbefore <arg>] [-N|--nodes <arg>] [--executable <arg>] [-m|--mem <arg>] [--blastparams <string>] [-r|--ramdisk <arg>] [--blastdir <arg>] [--(no-)test] [-h|--help] <FASTA> <DATABASE>\n' "$(basename $0)"
printf 'Usage: %s [-l|--runlimit <arg>] [-p|--partition <arg>] [-s|--splitup <arg>] [-N|--nodes <arg>] [--executable <arg>] [-m|--mem <arg>] [--blastparams <string>] [-r|--ramdisk <arg>] [--blastdir <arg>] [--(no-)test] [-h|--help] <FASTA> <DATABASE>\n' "$(basename $0)"
printf 'HINT: The FASTA and DATABASE items need to be full paths to files.'
printf "\t%s\n" "<FASTA>: path to the query FASTA file"
printf "\t%s\n" "<DATABASE>: path to the database file"
......@@ -161,6 +161,7 @@ credits()
echo " - introduced missing --time option"
echo " - changed the blast parameter interface"
echo "- v0.3 -- 21. Feb. 2018 -- faster merging of output files, parallel zipping"
echo "- v0.3.1 -- 15. May 2018 -- bugfixes in handling the blast executables"
echo
echo "Current version is: $SCRIPT_VERSION"
echo
......@@ -629,18 +630,29 @@ fi
# NOTE: This check is kind of redundant, better check whether we can get rid of it.
# get *nal file from database to obtain a database prefix for blast
if [[ $BLASTEXE =~ .*blastn.* ]]; then
tmp=$(find $DATABASE -name '*.nal')
# this will not be there, if makeblastdb did not split the reference up
if [[ -z "${tmp// }" ]]; then
tmp=$(find $DATABASE -name '*.nhr'| head -n1)
DATABASE=${tmp%.00.nhr}
else
# define database for blast as the full directory + prefix (without *nal* suffix)
tmp=$(find $DATABASE -name '*.nhr' | head -n1)
# is there more than 1 suffix (or more than 2 splittable items)
suffixes="${tmp//[^\.]} "
if [ $suffixes -gt 2 ]; then
DATABASE=${tmp%.*}
else
DATABASE=$tmp
fi
# this will not be there, if makeblastdb did not split the reference up
#if [[ -z "${tmp// }" ]]; then
# tmp=$(find $DATABASE -name '*.nhr'| head -n1)
# DATABASE=${tmp%.00.nhr}
#else
# # define database for blast as the full directory + prefix (without *nal* suffix)
# DATABASE=${tmp%.*}
#fi
elif [[ $BLASTEXE =~ .*blastp.* ]]; then
tmp=$(find $DATABASE -name '*.paa' | sort | head -n1)
DATABASE=${tmp%.paa}
tmp=$(find $DATABASE -name '*.phr' | sort | head -n1)
DATABASE=${tmp%.phr}
elif [[ $BLASTEXE =~ .*blast.* ]]; then
tmp=$(find $DATABASE -name '*.phr' | sort | head -n1)
DATABASE=${tmp%.phr}
# this will not be there, if makeblastdb did not split the reference up
#if [[ -z "${tmp// }" ]]; then
......@@ -668,7 +680,7 @@ cmd=$PWD/cmd_file.sh
rm -f $cmd
echo '#!/bin/bash' > $cmd
echo 'set -x' >> $cmd
#echo 'set -x' >> $cmd
echo 'module load bio/BLAST+' >> $cmd
#echo 'echo $(pwd)' >> $cmd
echo 'cd $(dirname $(realpath $0))' >> $cmd
......
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