#!/bin/bash

set -e

pkg='busco'
CUR_DIR=`pwd`


if [ "$AUTOPKGTEST_TMP" = "" ] ; then
  AUTOPKGTEST_TMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
  trap "rm -rf $AUTOPKGTEST_TMP" 0 INT QUIT ABRT PIPE TERM
fi


cd $AUTOPKGTEST_TMP

# Copy data
cp -a /usr/share/doc/${pkg}/examples/genome.fna .

# This test requires Prodigal and HMMER
# Busco will automatically download and version the dataset for the specified lineage
$pkg -m genome -i genome.fna -o test_bacteria -l bacteria_odb10

# Clear busco downloaded data after test
rm -rf busco_downloads

# Check output directory
if [ -d "./test_bacteria" ]; then

    echo "Output Directory Generated"
    echo "PASS"

else

    echo "Output Directory Not Generated"
    exit 1

fi


