| 1 | #!/bin/bash |
| 2 | |
| 3 | pkg=cat-bat |
| 4 | |
| 5 | if [ "$AUTOPKGTEST_TMP" = "" ]; then |
| 6 | |
| 7 | AUTOPKGTEST_TMP=`mktemp -d /tmp/${pkg}-test.XXXX` |
| 8 | trap "rm -rf $AUTOPKG_TMP" 0 INT QUIT ABRT PIPE TERM |
| 9 | |
| 10 | fi |
| 11 | |
| 12 | # Copy tests data |
| 13 | cp -a /usr/share/doc/"${pkg}"/examples/data "$AUTOPKGTEST_TMP" |
| 14 | |
| 15 | # Change directory into data |
| 16 | cd "$AUTOPKGTEST_TMP"/data/ |
| 17 | |
| 18 | # Extract fasta |
| 19 | gunzip prepare/small.fa.gz |
| 20 | |
| 21 | # Prepare CAT database |
| 22 | CAT prepare \ |
| 23 | --db_fasta ./prepare/small.fa \ |
| 24 | --names ./prepare/names.dmp \ |
| 25 | --nodes ./prepare/nodes.dmp \ |
| 26 | --acc2tax ./prepare/prot2acc.txt \ |
| 27 | --db_dir ./output_db |
| 28 | |
| 29 | # Annotate contig set |
| 30 | CAT contigs \ |
| 31 | -c ./prepare/small.fa \ |
| 32 | -d ./output_db/db \ |
| 33 | -t ./output_db/tax |
| 34 | |
| 35 | # Check final classification files (output files) |
| 36 | if [ -f "out.CAT.ORF2LCA.txt" ] && [ -f "out.CAT.contig2classification.txt" ]; then |
| 37 | echo "Final Classification Files Generated" |
| 38 | rm -rf out.* |
| 39 | else |
| 40 | echo "One or both classification files not generated" |
| 41 | rm -rf out.* |
| 42 | exit 1 |
| 43 | fi |
| 44 | |
| 45 | # Run BAT on single MAG |
| 46 | CAT bins -b prepare/small.fa \ |
| 47 | -d output_db/db \ |
| 48 | -t output_db/tax |
| 49 | |
| 50 | # Check final classification files (output files) |
| 51 | if [ -f "out.BAT.ORF2LCA.txt" ] && [ -f "out.BAT.bin2classification.txt" ]; then |
| 52 | echo "Final Classification Files Generated" |
| 53 | rm -rf out.* |
| 54 | else |
| 55 | echo "One or both classification files not generated" |
| 56 | rm -rf out.* |
| 57 | exit 1 |
| 58 | fi |