set -e

dir="$(cd "$(dirname "$0")" && pwd)"

input=$1
species=$2
locus=$3
output=$4


echo "$input $species $locus $output"

java -Xmx64G -jar $IGBLASTWRP/igblastwrp.jar -S $species -R $locus ${input} $PWD/blasted_output 2>&1

Rscript --verbose $dir/igblast.r "$PWD/blasted_output.L2.txt" "$output" 2>&1
