4 # Downloads sequence for the hg18 version of H. spiens (human) from
7 # Note that UCSC's hg18 build has three categories of compressed fasta
10 # 1. The base files, named chr??.fa.gz
11 # 2. The unplaced-sequence files, named chr??_random.fa.gz
12 # 3. The alternative-haplotype files, named chr??_???_hap?.fa.gz
14 # By default, this script builds and index for just the base files,
15 # since alignments to those sequences are the most useful. To change
16 # which categories are built by this script, edit the CHRS_TO_INDEX
75 CHRS_TO_INDEX=$BASE_CHRS
77 UCSC_HG18_BASE=ftp://hgdownload.cse.ucsc.edu/goldenPath/hg18/chromosomes
81 if ! wget --version >/dev/null 2>/dev/null ; then
82 if ! curl --version >/dev/null 2>/dev/null ; then
83 echo "Please install wget or curl somewhere in your PATH"
86 curl -o `basename $1` $1
94 BOWTIE_BUILD_EXE=./bowtie-build
95 if [ ! -x "$BOWTIE_BUILD_EXE" ] ; then
96 if ! which bowtie-build ; then
97 echo "Could not find bowtie-build in current directory or in PATH"
100 BOWTIE_BUILD_EXE=`which bowtie-build`
105 for c in $CHRS_TO_INDEX ; do
106 if [ ! -f ${c}.fa ] ; then
108 get ${UCSC_HG18_BASE}/$F || (echo "Error getting $F" && exit 1)
109 gunzip $F || (echo "Error unzipping $F" && exit 1)
111 [ -n "$INPUTS" ] && INPUTS=$INPUTS,${c}.fa
112 [ -z "$INPUTS" ] && INPUTS=${c}.fa
115 CMD="${BOWTIE_BUILD_EXE} $* ${INPUTS} hg18"
118 echo "hg18 index built; you may remove fasta files"
120 echo "Index building failed; see error message"