#!/bin/sh -e
# http://dep.debian.net/deps/dep8/
# Autopkgtest: Test if fastqtl run analysis correctly
# Author: Dylan Aïssi <bob.dybian@gmail.com>
# Last-Update: 2016-04-02

pkg=fastqtl
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

tar Jxvf $AUTOPKGTEST_TMP/examples.tar.xz

fastQTL \
     --vcf genotypes.vcf.gz \
     --bed phenotypes.bed.gz \
     --cov covariates.txt.gz \
     --interaction interaction.txt \
     --chunk 1 100 \
     --permute 100 \
     --seed 1 \
     --out fastqtl_output.txt \
     --log fastqtl_output.log

diff fastqtl_expected_output.txt fastqtl_output.txt

rm -f $AUTOPKGTEST_TMP/*

