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

pkg=minimac4

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}/examples/* $AUTOPKGTEST_TMP

gzip refPanel.m3vcf
gzip targetStudy.vcf

minimac4 --noPhoneHome \
         --refHaps refPanel.m3vcf.gz \
         --haps targetStudy.vcf.gz \
         --prefix testRun

zcat testRun.dose.vcf.gz > testRun.dose.vcf

# Remove not reproducible headers
tail -n +15 testRun.dose.vcf > cleaned.testRun.dose.vcf
tail -n +15 expected.testRun.dose.vcf > cleaned.expected.testRun.dose.vcf

diff testRun.info expected.testRun.info
diff cleaned.testRun.dose.vcf cleaned.expected.testRun.dose.vcf
