Commit patch to not break on spaces.
[bowtie.git] / scripts / make_e_coli.sh
1 #!/bin/sh
2
3 #
4 # Downloads the sequence for a strain of e. coli from NCBI and builds a
5 # Bowtie index for it
6 #
7
8 GENOMES_MIRROR=ftp://ftp.ncbi.nlm.nih.gov/genomes
9
10 BOWTIE_BUILD_EXE=./bowtie-build
11 if [ ! -x "$BOWTIE_BUILD_EXE" ] ; then
12         if ! which bowtie-build ; then
13                 echo "Could not find bowtie-build in current directory or in PATH"
14                 exit 1
15         else
16                 BOWTIE_BUILD_EXE=`which bowtie-build`
17         fi
18 fi
19
20 if [ ! -f NC_008253.fna ] ; then
21         if ! which wget > /dev/null ; then
22                 echo wget not found, looking for curl...
23                 if ! which curl > /dev/null ; then
24                         echo curl not found either, aborting...
25                 else
26                         # Use curl
27                         curl ${GENOMES_MIRROR}/Bacteria/Escherichia_coli_536/NC_008253.fna -o NC_008253.fna
28                 fi
29         else
30                 # Use wget
31                 wget ${GENOMES_MIRROR}/Bacteria/Escherichia_coli_536/NC_008253.fna
32         fi
33 fi
34
35 if [ ! -f NC_008253.fna ] ; then
36         echo "Could not find NC_008253.fna file!"
37         exit 2
38 fi
39
40 CMD="${BOWTIE_BUILD_EXE} $* -t 8 NC_008253.fna e_coli"
41 echo $CMD
42 if $CMD ; then
43         echo "e_coli index built; you may remove fasta files"
44 else
45         echo "Index building failed; see error message"
46 fi