4 # Downloads sequence for the rn4 version of R. norvegicus (rat) from
7 # Note that UCSC's rn4 build has two categories of compressed fasta
10 # 1. The base files, named chr??.fa.gz
11 # 2. The unplaced-sequence files, named chr??_random.fa.gz
13 # By default, this script builds and index for just the base files,
14 # since alignments to those sequences are the most useful. To change
15 # which categories are built by this script, edit the CHRS_TO_INDEX
21 while [ $i -lt 21 ] ; do
22 BASE_CHRS="$BASE_CHRS chr$i"
25 BASE_CHRS="$BASE_CHRS chrX chrM chrUn"
51 CHRS_TO_INDEX=$BASE_CHRS
53 RN4_BASE=ftp://hgdownload.cse.ucsc.edu/goldenPath/rn4/chromosomes
57 if ! wget --version >/dev/null 2>/dev/null ; then
58 if ! curl --version >/dev/null 2>/dev/null ; then
59 echo "Please install wget or curl somewhere in your PATH"
62 curl -o `basename $1` $1
70 BOWTIE_BUILD_EXE=./bowtie-build
71 if [ ! -x "$BOWTIE_BUILD_EXE" ] ; then
72 if ! which bowtie-build ; then
73 echo "Could not find bowtie-build in current directory or in PATH"
76 BOWTIE_BUILD_EXE=`which bowtie-build`
81 for c in $CHRS_TO_INDEX ; do
82 if [ ! -f ${c}.fa ] ; then
84 get ${RN4_BASE}/$F || (echo "Error getting $F" && exit 1)
85 gunzip $F || (echo "Error unzipping $F" && exit 1)
87 [ -n "$INPUTS" ] && INPUTS=$INPUTS,${c}.fa
88 [ -z "$INPUTS" ] && INPUTS=${c}.fa
91 CMD="${BOWTIE_BUILD_EXE} $* ${INPUTS} rn4"
94 echo "rn4 index built; you may remove fasta files"
96 echo "Index building failed; see error message"