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

echo
echo "*** Downloading some 1000 Genomes Project data to file: test.r1219.vcf.gz ***"
echo
wget http://faculty.washington.edu/browning/beagle/test.r1219.vcf.gz
  
echo
echo "*** Creating test files: ref.r1219.vcf.gz target.r1219.vcf.gz ***"
echo  
zcat test.r1219.vcf.gz | cut -f1-190 | tr '/' '|' | gzip > ref.r1219.vcf.gz
zcat test.r1219.vcf.gz | cut -f1-9,191-200 | gzip > target.r1219.vcf.gz
  

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

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

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

