#!/bin/bash

#Needs fastq-dump from the SRA toolkit to directly get the 100 raw fastq reads

fastq-dump -X 100 -Z SRR14953521 | head -n100 > data.fastq

mkdir -p data

if [ -f data/data.fastq.gz ]
then
gunzip data/data.fastq.gz
diff -u data.fastq data/data.fastq

if [ `echo $?` -ne 0 ]
then
	echo "The data has changed, injecting new data, please check manually before upload"
else
	echo "The data is same, no changes needed"
fi
fi

gzip data.fastq
rm data/data.fastq
mv data.fastq.gz data/data.fastq.gz

echo "Done"
