#!/bin/sh -e
# http://dep.debian.net/deps/dep8/
# Autopkgtest: Test if beagle run analysis correctly
# Author: Dylan Aïssi <daissi@debian.org>

pkg=beagle
if [ "$AUTOPKGTEST_TMP" = "" ] ; then
  AUTOPKGTEST_TMP=`mktemp -d /tmp/${pkg}-test.XXXXXX`
fi
cd $AUTOPKGTEST_TMP
cp -a /usr/share/doc/${pkg}/examples/* $AUTOPKGTEST_TMP

# Generate necessary files
gzip test.vcf
zcat test.vcf.gz | cut -f1-190 | tr '/' '|' | gzip > ref.vcf.gz
zcat test.vcf.gz | cut -f1-9,191-200 | gzip > target.vcf.gz
bref3 ref.vcf.gz > ref.bref3

# Beagle with gt argument
beagle gt=test.vcf.gz out=out.gt

# Beagle with ref and gt argument
beagle ref=ref.vcf.gz gt=target.vcf.gz out=out.ref

# Beagle with bref3 file
beagle ref=ref.bref3 gt=target.vcf.gz out=out.bref3

rm -f $AUTOPKGTEST_TMP/*
