forked from sanger-pathogens/Roary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_dependencies.sh
executable file
·248 lines (211 loc) · 6.93 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
#!/bin/bash
set -x
set -eu
start_dir=$(pwd)
ROARY_LIB_DIR="${start_dir}/lib"
ROARY_BIN_DIR="${start_dir}/bin"
PARALLEL_VERSION=${PARALLEL_VERSION:-"20160722"}
PARALLEL_DOWNLOAD_FILENAME="parallel-${PARALLEL_VERSION}.tar.bz2"
PARALLEL_URL="http://ftp.gnu.org/gnu/parallel/${PARALLEL_DOWNLOAD_FILENAME}"
BEDTOOLS_VERSION="2.27.1"
BEDTOOLS_DOWNLOAD_FILENAME="bedtools-${BEDTOOLS_VERSION}.tar.gz"
BEDTOOLS_URL="https://github.com/arq5x/bedtools2/releases/download/v${BEDTOOLS_VERSION}/${BEDTOOLS_DOWNLOAD_FILENAME}"
CDHIT_SHORT_VERSION="4.6.8"
CDHIT_LONG_VERSION="4.6.8-2017-0621"
CDHIT_DOWNLOAD_FILENAME="cd-hit-${CDHIT_SHORT_VERSION}.tar.gz"
CDHIT_URL="https://github.com/weizhongli/cdhit/releases/download/V${CDHIT_SHORT_VERSION}/cd-hit-v${CDHIT_LONG_VERSION}-source.tar.gz"
PRANK_VERSION="0.140603"
PRANK_DOWNLOAD_FILENAME="prank-msa-master.tar.gz"
PRANK_URL="https://github.com/ariloytynoja/prank-msa/archive/master.tar.gz"
BLAST_VERSION="2.6.0"
BLAST_DOWNLOAD_FILENAME="ncbi-blast-${BLAST_VERSION}+-x64-linux.tar.gz"
BLAST_URL="ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/${BLAST_VERSION}/${BLAST_DOWNLOAD_FILENAME}"
MCL_VERSION="14-137"
MCL_DOWNLOAD_FILENAME="mcl-${MCL_VERSION}.tar.gz"
MCL_URL="http://micans.org/mcl/src/mcl-${MCL_VERSION}.tar.gz"
FASTTREE_VERSION="2.1.10"
FASTTREE_DOWNLOAD_FILENAME="FastTree-${FASTTREE_VERSION}.c"
FASTTREE_URL="http://microbesonline.org/fasttree/FastTree-${FASTTREE_VERSION}.c"
MAFFT_VERSION="7.310"
MAFFT_DOWNLOAD_FILENAME="mafft-${MAFFT_VERSION}-without-extensions-src.tgz"
MAFFT_URL="http://mafft.cbrc.jp/alignment/software/${MAFFT_DOWNLOAD_FILENAME}"
# Make an install location
if [ ! -d 'build' ]; then
mkdir build
fi
cd build
build_dir=$(pwd)
PARALLEL_DOWNLOAD_PATH="$(pwd)/${PARALLEL_DOWNLOAD_FILENAME}"
BEDTOOLS_DOWNLOAD_PATH="$(pwd)/${BEDTOOLS_DOWNLOAD_FILENAME}"
CDHIT_DOWNLOAD_PATH="$(pwd)/${CDHIT_DOWNLOAD_FILENAME}"
PRANK_DOWNLOAD_PATH="$(pwd)/${PRANK_DOWNLOAD_FILENAME}"
BLAST_DOWNLOAD_PATH="$(pwd)/${BLAST_DOWNLOAD_FILENAME}"
MCL_DOWNLOAD_PATH="$(pwd)/${MCL_DOWNLOAD_FILENAME}"
FASTTREE_DOWNLOAD_PATH="$(pwd)/${FASTTREE_DOWNLOAD_FILENAME}"
MAFFT_DOWNLOAD_PATH="$(pwd)/${MAFFT_DOWNLOAD_FILENAME}"
PARALLEL_BUILD_DIR="$(pwd)/parallel-${PARALLEL_VERSION}"
BEDTOOLS_BUILD_DIR="$(pwd)/bedtools2"
CDHIT_BUILD_DIR="$(pwd)/cd-hit-v${CDHIT_LONG_VERSION}"
PRANK_BUILD_DIR="$(pwd)/prank-msa-master"
BLAST_BUILD_DIR="$(pwd)/ncbi-blast-${BLAST_VERSION}+"
MCL_BUILD_DIR="$(pwd)/mcl-${MCL_VERSION}"
FASTTREE_BUILD_DIR="$(pwd)/fasttree"
MAFFT_BUILD_DIR="$(pwd)/mafft-${MAFFT_VERSION}-without-extensions"
download () {
download_url=$1
download_path=$2
cd $build_dir
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
pwd
fi
}
untar () {
to_untar=$1
expected_directory=$2
if [ -d "$expected_directory" ]; then
rm -rf $expected_directory
fi
echo "Untarring $to_untar to $expected_directory"
cd $build_dir
tar xzvf $to_untar
rm $to_untar
pwd
}
if [ -e "$BLAST_BUILD_DIR/bin/blastp" ]; then
echo "blast already untarred to $BLAST_BUILD_DIR, skipping"
else
download $BLAST_URL $BLAST_DOWNLOAD_PATH
untar $BLAST_DOWNLOAD_PATH $BLAST_BUILD_DIR
fi
# Build parallel
if [ -e "$PARALLEL_BUILD_DIR/src/parallel" ]; then
echo "Parallel already built, skipping"
else
download $PARALLEL_URL $PARALLEL_DOWNLOAD_PATH
echo "Untarring parallel to $PARALLEL_BUILD_DIR"
tar xjvf $PARALLEL_DOWNLOAD_PATH
echo "Building parallel"
cd $PARALLEL_BUILD_DIR
./configure
make
fi
# Build bedtools
if [ -e "$BEDTOOLS_BUILD_DIR/bin/bedtools" ]; then
echo "Bedtools already built, skipping"
else
download $BEDTOOLS_URL $BEDTOOLS_DOWNLOAD_PATH
untar $BEDTOOLS_DOWNLOAD_PATH $BEDTOOLS_BUILD_DIR
cd $BEDTOOLS_BUILD_DIR
echo "Building bedtools"
ls -alrt
make
fi
# Build cd-hit
if [ -e "$CDHIT_BUILD_DIR/cd-hit" ]; then
echo "cd-hit already built, skipping"
else
download $CDHIT_URL $CDHIT_DOWNLOAD_PATH
untar $CDHIT_DOWNLOAD_PATH $CDHIT_BUILD_DIR
echo "Building cd-hit"
cd $CDHIT_BUILD_DIR
make
fi
# Build prank
if [ -e "$PRANK_BUILD_DIR/src/prank" ]; then
echo "prank already built, skipping"
else
download $PRANK_URL $PRANK_DOWNLOAD_PATH
untar $PRANK_DOWNLOAD_PATH $PRANK_BUILD_DIR
echo "Building prank"
cd $PRANK_BUILD_DIR
cd src
make
fi
# Build MCL
if [ -e "$MCL_BUILD_DIR/src/shmcl/mcl" ]; then
echo "MCL already built, skipping"
else
download $MCL_URL $MCL_DOWNLOAD_PATH
untar $MCL_DOWNLOAD_PATH $MCL_BUILD_DIR
echo "Building MCL"
cd $MCL_BUILD_DIR
./configure
make
fi
# Build FastTree
if [ -e "$FASTTREE_BUILD_DIR/FastTree" ]; then
echo "FastTree already built, skipping"
else
download $FASTTREE_URL $FASTTREE_DOWNLOAD_PATH
mkdir -p $FASTTREE_BUILD_DIR
mv $FASTTREE_DOWNLOAD_FILENAME $FASTTREE_BUILD_DIR
cd $FASTTREE_BUILD_DIR
echo "Building FastTree"
gcc -o FastTree FastTree-${FASTTREE_VERSION}.c -lm
fi
export MAFFT_INSTALL_DIR="${MAFFT_BUILD_DIR}/build"
# Build MAFFT
if [ -e "$MAFFT_BUILD_DIR/build/mafft" ]; then
echo "MAFFT already built, skipping"
else
download $MAFFT_URL $MAFFT_DOWNLOAD_PATH
untar $MAFFT_DOWNLOAD_PATH $MAFFT_BUILD_DIR
echo "Building MAFFT"
cd $MAFFT_BUILD_DIR
mkdir -p $MAFFT_INSTALL_DIR
cd core
sed -i '1s!.*!PREFIX = $(MAFFT_INSTALL_DIR)!' Makefile
make
make install
fi
# Add things to PATH
update_path () {
new_dir=$1
if [[ ! "$PATH" =~ (^|:)"${new_dir}"(:|$) ]]; then
echo "export PATH=${new_dir}:${PATH}"
export PATH=${new_dir}:${PATH}
fi
}
export PATH
PARALLEL_BIN_DIR="$PARALLEL_BUILD_DIR/src"
update_path $PARALLEL_BIN_DIR
BEDTOOLS_BIN_DIR="$BEDTOOLS_BUILD_DIR/bin"
update_path $BEDTOOLS_BIN_DIR
CDHIT_BIN_DIR="$CDHIT_BUILD_DIR"
update_path $CDHIT_BIN_DIR
PRANK_BIN_DIR="$PRANK_BUILD_DIR/src"
update_path $PRANK_BIN_DIR
BLAST_BIN_DIR="$BLAST_BUILD_DIR/bin"
update_path $BLAST_BIN_DIR
MCL_BIN_DIR="$MCL_BUILD_DIR/src/shmcl"
update_path $MCL_BIN_DIR
MCL_BIN_DIR_2="$MCL_BUILD_DIR/src/alien/oxygen/src"
update_path $MCL_BIN_DIR_2
FASTTREE_BIN_DIR=$FASTTREE_BUILD_DIR
update_path $FASTTREE_BIN_DIR
MAFFT_BIN_DIR="$MAFFT_INSTALL_DIR/bin"
update_path $MAFFT_BIN_DIR
update_perl_path () {
new_dir=$1
PERL5LIB=${PERL5LIB-$new_dir}
if [[ ! "$PERL5LIB" =~ (^|:)"${new_dir}"(:|$) ]]; then
echo "export PERL5LIB=${new_dir}:${PERL5LIB}"
export PERL5LIB=${new_dir}:${PERL5LIB}
fi
}
BEDTOOLS_LIB_DIR="$BEDTOOLS_BUILD_DIR/lib"
update_perl_path $BEDTOOLS_LIB_DIR
cd $start_dir
cpanm --notest Dist::Zilla
dzil authordeps --missing | cpanm --notest
dzil listdeps --missing | cpanm --notest
cd $start_dir
echo "Add the following lines to one of these files ~/.bashrc or ~/.bash_profile or ~/.profile"
echo "export PATH=${ROARY_BIN_DIR}:${PARALLEL_BIN_DIR}:${BEDTOOLS_BIN_DIR}:${CDHIT_BIN_DIR}:${PRANK_BIN_DIR}:${BLAST_BIN_DIR}:${MCL_BIN_DIR}:${MCL_BIN_DIR_2}:${FASTTREE_BIN_DIR}:${MAFFT_BIN_DIR}:${PATH}"
echo "export PERL5LIB=${ROARY_LIB_DIR}:${BEDTOOLS_LIB_DIR}:${PERL5LIB}"
set +eu
set +x