-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathinstall_dependencies.sh
executable file
·128 lines (105 loc) · 3.18 KB
/
install_dependencies.sh
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
set -x
set -eu
start_dir=$(pwd)
PARALLEL_VERSION="20150522"
PARALLEL_DOWNLOAD_FILENAME="parallel-${PARALLEL_VERSION}.tar.bz2"
PARALLEL_URL="http://ftp.gnu.org/gnu/parallel/${PARALLEL_DOWNLOAD_FILENAME}"
PRODIGAL_VERSION="2.6.2"
PRODIGAL_DOWNLOAD_FILENAME="prodigal-${PRODIGAL_VERSION}.linux"
PRODIGAL_URL="https://github.com/hyattpd/Prodigal/releases/download/v${PRODIGAL_VERSION}/prodigal.linux"
HMMER_VERSION="3.1b2"
HMMER_DOWNLOAD_FILENAME="hmmer-${HMMER_VERSION}.tar.gz"
HMMER_URL="http://eddylab.org/software/hmmer3/${HMMER_VERSION}/hmmer-${HMMER_VERSION}-linux-intel-x86_64.tar.gz"
# Make an install location
if [ ! -d 'build' ]; then
mkdir build
fi
cd build
build_dir=$(pwd)
download () {
download_url=$1
download_path=$2
if [ -e "$download_path" ]; then
echo "Skipping download of $download_url, $download_path already exists"
else
echo "Downloading $download_url to $download_path"
wget $download_url -O $download_path
fi
}
# Download parallel
PARALLEL_DOWNLOAD_PATH="$(pwd)/${PARALLEL_DOWNLOAD_FILENAME}"
download $PARALLEL_URL $PARALLEL_DOWNLOAD_PATH
# Download prodigal
PRODIGAL_DOWNLOAD_PATH="$(pwd)/${PRODIGAL_DOWNLOAD_FILENAME}"
download $PRODIGAL_URL $PRODIGAL_DOWNLOAD_PATH
# Download hmmer
HMMER_DOWNLOAD_PATH="$(pwd)/${HMMER_DOWNLOAD_FILENAME}"
download $HMMER_URL $HMMER_DOWNLOAD_PATH
untar () {
to_untar=$1
expected_directory=$2
if [ -d "$expected_directory" ]; then
echo "Already untarred $to_untar to $expected_directory, skipping"
else
echo "Untarring $to_untar to $expected_directory"
tar xzvf $to_untar
fi
}
# Untar parallel
PARALLEL_BUILD_DIR="$(pwd)/parallel-${PARALLEL_VERSION}"
if [ -d "$PARALLEL_BUILD_DIR" ]; then
echo "Parallel already untarred to $PARALLEL_BUILD_DIR, skipping"
else
echo "Untarring parallel to $PARALLEL_BUILD_DIR"
tar xjvf $PARALLEL_DOWNLOAD_PATH
fi
# Make prodigal directory
PRODIGAL_DIR="$(pwd)/prodigal-${PRODIGAL_VERSION}"
if [ -d "$PRODIGAL_DIR" ]; then
echo "$PRODIGAL_DIR already exists, skipping"
else
echo "Creating $PRODIGAL_DIR"
mkdir -p $PRODIGAL_DIR
fi
# Untar hmmer
HMMER_BUILD_DIR="$(pwd)/hmmer-${HMMER_VERSION}-linux-intel-x86_64"
untar $HMMER_DOWNLOAD_PATH $HMMER_BUILD_DIR
# Build parallel
cd $PARALLEL_BUILD_DIR
if [ -e "$PARALLEL_BUILD_DIR/src/parallel" ]; then
echo "Parallel already built, skipping"
else
echo "Building parallel"
./configure
make
fi
# Create prodigal symlink
cd $PRODIGAL_DIR
if [ -e "$PRODIGAL_DIR/prodigal" ]; then
echo "Prodiagl already exists in $PRODIGAL_DIR"
else
echo "Creating prodigal symlink"
cp $PRODIGAL_DOWNLOAD_PATH $PRODIGAL_DIR
chmod u+x "${PRODIGAL_DIR}/${PRODIGAL_DOWNLOAD_FILENAME}"
ln -s "${PRODIGAL_DIR}/${PRODIGAL_DOWNLOAD_FILENAME}" ${PRODIGAL_DIR}/prodigal
fi
# Add things to PATH
update_path () {
new_dir=$1
if [[ ! "$PATH" =~ (^|:)"${new_dir}"(:|$) ]]; then
export PATH=${new_dir}:${PATH}
fi
}
export PATH
PARALLEL_BIN_DIR="$PARALLEL_BUILD_DIR/src"
update_path $PARALLEL_BIN_DIR
update_path $PRODIGAL_DIR
HMMER_BIN_DIR="${HMMER_BUILD_DIR}/binaries"
update_path ${HMMER_BIN_DIR}
echo Checking hmmer in path: $(which hmmer)
echo Checking hmmer bin dir: ${HMMER_BIN_DIR}
ls ${HMMER_BIN_DIR}
cd $start_dir
set +eu
set +x