#
# Downloads a reference genome and indexes it with bwa.
#
# Initialize the "real" genome to match the reference.
#

# Stop on any error.
set -uex

# Reference genome accession number.
ACC=AF086833

# Directory for the reference files.
REF=refs

# Make the reference directory.
mkdir -p $REF

# Reference genome file name.
REFERENCE=$REF/${ACC}.fa

# The "real" genome that will be modified.
GENOME=genome.fa

# Fetch the genome from the accession. 
efetch -db nucleotide -id $ACC -format fasta > $REFERENCE

# Index the genome with bwa. You may comment this out on second runs.
bwa index $REFERENCE

# Initially the real genome is the same as the reference.
cp $REFERENCE $GENOME