#!/bin/sh -e

pkg=bamtools

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

cp -a /usr/share/doc/${pkg}/sam_spec_example.bam .
cp -a /usr/share/doc/${pkg}/filter_script .
gunzip -r *

bamtools convert -format fastq -in sam_spec_example.bam -out test.fastq

bamtools convert -format json -in sam_spec_example.bam -out test.json

bamtools count -in sam_spec_example.bam

bamtools coverage -in sam_spec_example.bam -out out

bamtools filter -script filter_script -in sam_spec_example.bam -out out.bam

bamtools header -in sam_spec_example.bam

bamtools index -in sam_spec_example.bam

bamtools random -n 100 -in sam_spec_example.bam -out out.bam

bamtools revert -in sam_spec_example.bam -out out.bam

bamtools sort -in sam_spec_example.bam -out out.bam

bamtools split -mapped -in sam_spec_example.bam

bamtools stats -in sam_spec_example.bam
