#!/bin/sh -e
# https://dep-team.pages.debian.net/deps/dep8/
# Autopkgtest: Test if SHAPEIT4 run analysis correctly
# Author: Dylan Aïssi <daissi@debian.org>
# Based on https://odelaneau.github.io/shapeit4/#documentation

pkg=shapeit4

if [ "$AUTOPKGTEST_TMP" = "" ] ; then
  AUTOPKGTEST_TMP=`mktemp -d /tmp/${debname}-test.XXXXXX`
  trap "rm -rf $AUTOPKGTEST_TMP" 0 INT QUIT ABRT PIPE TERM
fi

cd $AUTOPKGTEST_TMP
cp -a /usr/share/doc/${pkg}/examples/test/* $AUTOPKGTEST_TMP

gunzip *.bcf.gz

set -x

# 2. Phasing a chunk of data
shapeit4 --input unphased.vcf.gz \
         --map chr20.b37.gmap.gz \
         --region 20:2000000-3000000 \
         --thread 4 \
         --output phased.vcf.gz

# 12. Complex run
shapeit4 --input unphased.bcf \
         --map chr20.b37.gmap.gz \
         --region 20 \
         --reference reference.bcf \
         --scaffold scaffold.bcf \
         --use-PS 0.0001 \
         --thread 4 \
         --log phased.log\
         --output phased.bcf
