blast_wrap.sh 1017 Bytes
Newer Older
1 2 3 4 5

function cmdfilewriter() 
{
cat <<EOF > $cmdfile
#!/bin/bash
6
  module purge
7
  #TODO: find a solution for the bug in BLAST+ AND to select the version by hand
8
  module load bio/BLAST+/2.9.0-gompi-2019a
9 10
  #module load bio/BLAST+/2.7.1-foss-2018a

11 12 13 14 15 16 17 18 19 20 21
  # are we done?
  source ${SCRIPT_PATH}/cleanup.sh
  if [ \$1 = "done" ]; then
      shrink_job
      exit
  fi

  outfname=\$(basename \${1%.fasta})
  tmp_out=${JOBDIR}/\$outfname
  trap "rm -f \$tmp_out" EXIT
  START_BLAST=\$(date +%s)
22 23
  $_arg_executable -num_threads $SLURM_CPUS_PER_TASK -db $DATABASE $BLASTPARAMS -query \$1 -out \$tmp_out
  success=\$?
24 25
  END_BLAST=\$(date +%s)
  elapsed=\$(bc <<< "scale=1; \$((\$END_BLAST - \$START_BLAST))/60")
26
  #echo "Elapsed for '\$1': \$elapsed"
27
  
28 29 30 31 32 33 34 35 36
  # only proceed, when ready
  if [ \$success -eq 0 ]; then
     # compress, when done
     gzip \$tmp_out
     # copy back, when ready
     mv \${tmp_out}.gz ./output/\${outfname}.gz
  fi
  # we only consider the blast exit code for the total exit code
  exit \$success
37 38
EOF
}