File: make_a_thaliana_tair.sh

package info (click to toggle)
bowtie 1.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,816 kB
  • sloc: cpp: 37,094; perl: 5,806; ansic: 1,474; sh: 1,197; python: 462; makefile: 419
file content (56 lines) | stat: -rwxr-xr-x 1,183 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh

#
# Downloads sequence for A. thaliana from TAIR and builds Bowtie index.
#

GENOMES_MIRROR=ftp://ftp.arabidopsis.org/home/tair

get() {
	file=$1
	if ! wget --version >/dev/null 2>/dev/null ; then
		if ! curl --version >/dev/null 2>/dev/null ; then
			echo "Please install wget or curl somewhere in your PATH"
			exit 1
		fi
		curl -o `basename $1` $1
		return $?
	else
		wget $1
		return $?
	fi
}

BOWTIE_BUILD_EXE=./bowtie-build
if [ ! -x "$BOWTIE_BUILD_EXE" ] ; then
	if ! which bowtie-build ; then
		echo "Could not find bowtie-build in current directory or in PATH"
		exit 1
	else
		BOWTIE_BUILD_EXE=`which bowtie-build`
	fi
fi

FC=
for c in 1 2 3 4 5 C M ; do
	if [ ! -f TAIR10_chr$c.fas ] ; then
		FN=TAIR10_chr$c.fas
		F=${GENOMES_MIRROR}/Sequences/whole_chromosomes/${FN}
		[ -n "$FC" ] && FC="$FC,$FN"
		[ -z "$FC" ] && FC=$FN
		get $F || (echo "Error getting $F" && exit 1)
	fi
	
	if [ ! -f TAIR10_chr$c.fas ] ; then
		echo "Could not find chr$c.fas file!"
		exit 2
	fi
done

CMD="${BOWTIE_BUILD_EXE} $* $FC a_thaliana"
echo $CMD
if $CMD ; then
	echo "a_thaliana index built; you may remove fasta files"
else
	echo "Index building failed; see error message"
fi