Commit patch to not break on spaces.
[bowtie.git] / scripts / make_c_elegans_ws200.sh
1 #!/bin/sh
2
3 #
4 # Downloads sequence and builds Bowtie index for for C. elegans
5 # versions WS200 from wormbase.
6 #
7
8 GENOMES_MIRROR=ftp://ftp.gramene.org/pub/wormbase/genomes/c_elegans/sequences/dna
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 get() {
21         file=$1
22         if ! wget --version >/dev/null 2>/dev/null ; then
23                 if ! curl --version >/dev/null 2>/dev/null ; then
24                         echo "Please install wget or curl somewhere in your PATH"
25                         exit 1
26                 fi
27                 curl -o `basename $1` $1
28                 return $?
29         else
30                 wget $1
31                 return $?
32         fi
33 }
34
35 F=c_elegans.WS200.dna.fa
36 if [ ! -f $F ] ; then
37         FGZ=c_elegans.WS200.dna.fa.gz
38         wget ${GENOMES_MIRROR}/$FGZ || (echo "Error getting $F" && exit 1)
39         gunzip $FGZ || (echo "Error unzipping $F" && exit 1)
40 fi
41
42 CMD="${BOWTIE_BUILD_EXE} $* $F c_elegans_ws200"
43 echo "Running $CMD"
44 if $CMD ; then
45         echo "c_elegans_ws200 index built; you may remove fasta files"
46 else
47         echo "Index building failed; see error message"
48 fi