File: make_b_taurus_UMD3.sh

package info (click to toggle)
bowtie 1.2.2%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 16,704 kB
  • sloc: cpp: 35,614; perl: 5,903; ansic: 1,247; sh: 1,128; python: 483; makefile: 426
file content (89 lines) | stat: -rwxr-xr-x 1,462 bytes parent folder | download | duplicates (7)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/sh

#
# Builds an index from UMD Freeze 3.0 of the Bos Taurus (cow) genome.
#

BASE_CHRS="\
Chr1 \
Chr2 \
Chr3 \
Chr4 \
Chr5 \
Chr6 \
Chr7 \
Chr8 \
Chr9 \
Chr10 \
Chr11 \
Chr12 \
Chr13 \
Chr14 \
Chr15 \
Chr16 \
Chr17 \
Chr18 \
Chr19 \
Chr20 \
Chr21 \
Chr22 \
Chr23 \
Chr24 \
Chr25 \
Chr26 \
Chr27 \
Chr28 \
Chr29 \
ChrX \
ChrU \
ChrY-contigs \
ChrY-contigs.SHOTGUN_ONLY"

CHRS_TO_INDEX=$BASE_CHRS

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

FTP_BASE=ftp://ftp.cbcb.umd.edu/pub/data/Bos_taurus/Bos_taurus_UMD_3.0
OUTPUT=b_taurus

INPUTS=
for c in $CHRS_TO_INDEX ; do
	if [ ! -f ${c}.fa ] ; then
		F=${c}.fa.gz
		get ${FTP_BASE}/$F || (echo "Error getting $F" && exit 1)
		gunzip $F || (echo "Error unzipping $F" && exit 1)
	fi
	[ -n "$INPUTS" ] && INPUTS=$INPUTS,${c}.fa
	[ -z "$INPUTS" ] && INPUTS=${c}.fa
done

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