#!/bin/bash
if [ ! -f b4.r1274.jar ]; then
  echo
  echo "Downloading b4.r1274.jar"
  wget http://faculty.washington.edu/browning/beagle/b4.r1274.jar
fi

echo
echo "*** Downloading some 1000 Genomes Project data to file: test.r1274.vcf.gz ***"
echo
wget http://faculty.washington.edu/browning/beagle/test.r1274.vcf.gz

echo
echo "*** Creating test files: ref.r1274.vcf.gz target.r1274.vcf.gz ***"
echo
zcat test.r1274.vcf.gz | cut -f1-190 | tr '/' '|' | gzip > ref.r1274.vcf.gz
zcat test.r1274.vcf.gz | cut -f1-9,191-200 | gzip > target.r1274.vcf.gz


echo
echo "*** Running test analysis with \"gt=\" argument ***"
echo
java -jar b4.r1274.jar gt=test.r1274.vcf.gz out=out.gt

echo
echo "*** Running test analysis with \"gl=\" argument ***"
echo
java -jar b4.r1274.jar gl=test.r1274.vcf.gz out=out.gl

echo
echo "*** Running test analysis with \"ref=\" argument ***"
echo
java -jar b4.r1274.jar ref=ref.r1274.vcf.gz gt=target.r1274.vcf.gz out=out.ref

