#!/bin/sh

echo <<EOF
Downloading public data

- Stanford_S22 dataset from
  Boyd, S. D., et al. Individual variation in the germline Ig gene repertoire inferred
  from variable region gene rearrangements. J Immunol, 184(12), 6986–92.

- LIL-L4 dataset from
  Giraud, Salson, et al. Fast multiclonal clusterization of V(D)J recombinations
  from high-throughput sequencing. BMC Genomics 2014, 15:409.

- LIL-L3 vidjil fudes files. Analysis of files from
  Giraud, Salson, et al. Fast multiclonal clusterization of V(D)J recombinations
  from high-throughput sequencing. BMC Genomics 2014, 15:409.
EOF

wget --no-check-certificate -nc -q https://www.vidjil.org/seqs/Stanford_S22.tar.gz
tar xvzf Stanford_S22.tar.gz

if [ -z "$1" ] || [ "$1" != "--light" ]
then
  echo "Retrieving demo dataset, please be patient…"
  wget  --no-check-certificate -nc -q https://www.vidjil.org/seqs/LIL-L4.fastq.gz
fi


status=$?
# wget -nc -O exits with 1 when file already exists but thit is is not an
# error and should not fail the Makefile!
if [ $status -le 1 ]
then
    true
else
    exit $status
fi


if [ -z "$1" ] || [ "$1" != "--light" ]
then
  echo "Retrieving demo analysis file, please be patient…"
  wget  --no-check-certificate -nc -q https://www.vidjil.org/data/demo_lil_l3_tutorial.vidjil -O ../browser/test/data/demo_lil_l3_tutorial.vidjil
fi

status=$?
if [ $status -le 1 ]
then
    true
else
    exit $status
fi
