forked from hoelzer-lab/ribap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL.sh
executable file
·378 lines (321 loc) · 10 KB
/
INSTALL.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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
#!/usr/bin/env bash
trap "clean_up" SIGINT SIGTERM SIGHUP EXIT
#if [[ $OSTYPE =~ "darwin" ]]; then
# alias realpath='readlink -f'
#fi
function clean_up {
echo 'ERROR: I noticed an interruption signal.'
echo 'Before exiting, let me clean up the mess I did.'
#rm -r "$RIBAPDIR"
#mv "$LOG" "$backup"
echo 'Okay - everything I installed so far is removed.'
echo "You will find a .log file in $HOME."
echo 'Bye Bye!'
echo "$PATH" >> $LOG
}
function log_block {
echo '' >> "$LOG"
echo '##################################' >> "$LOG"
echo '' >> "$LOG"
}
function show_help {
echo 'Best help ever! yaaay'
}
function test_installation {
echo "Testing installed software -- stay tuned!"
log_block
echo 'TESTING SOFTWARE' >> "$LOG"
if ! "$RIBAPDIR"/bin/prokka --version >> "$LOG" 2>&1; then
echo 'Something went wrong with prokka.'
echo 'Please see if your system meets all requirements and Perl libraries'
echo 'https://github.com/tseemann/prokka'
echo ''
echo 'sudo apt-get install libdatetime-perl libxml-simple-perl libdigest-md5-perl git default-jre bioperl'
echo 'sudo cpan Bio::Perl'
echo ''
echo "For more information, have a look at $LOG"
#rm -r "$RIBAPDIR"
exit 1
fi
log_block
if ! "$RIBAPDIR"/bin/roary -h >> "$LOG" 2>&1; then
echo 'I had an issue with roary.'
echo 'Please see if your system meets all requirements and Perl libraries'
echo 'https://github.com/sanger-pathogens/Roary/blob/master/README.md#required-dependencies'
echo ''
echo 'and check whether required Perl libraries are installed.'
echo ''
echo 'sudo cpanm Array::Utils Bio::Perl Exception::Class File::Basename File::Copy File::Find::Rule File::Grep File::Path File::Slurper File::Spec File::Temp File::Which FindBin Getopt::Long Graph Graph::Writer::Dot List::Util Log::Log4perl Moose Moose::Role Text::CSV PerlIO::utf8_strict Devel::OverloadInfo Digest::MD5::File'
echo ''
echo "For more information, have a look at $LOG"
#rm -r "$RIBAPDIR"
exit 1
fi
log_block
if ! "$RIBAPDIR"/bin/glpsol --help >> "$LOG" 2>&1; then
echo ''
echo ''
echo 'Somehow the GLPK package is not working.'
echo 'Please check whether all system requirements are met.'
echo 'https://en.wikibooks.org/wiki/GLPK/Linux_OS#Installation_procedure'
echo ''
echo "For more information, have a look at $LOG"
#rm -r "$RIBAPDIR"
exit 1
fi
echo 'It seems like everything went well.'
echo 'Please copy the following lines to your .bashrc / .profile / .bash_profile:'
echo 'export PATH=$PATH:'"$RIBAPDIR"'/bin'
echo 'export PERL5LIB=$PERL5LIB:'"$RIBAPDIR"'/lib'
echo ''
echo 'Thank you for using RIBAP! Stay awesome.'
exit 0
}
RIBAPDIR="$HOME"/ribap
LOG="$HOME"/ribap_installation.log
SCRIPTDIR=$(dirname $(realpath $0))
while getopts "htp:" opts; do
case "$opts" in
h|\?)
show_help
exit 0
;;
p)
PREFIX="$OPTARG"
RIBAPDIR="$(cd $(dirname $PREFIX); pwd)"/"$(basename $PREFIX)"/ribap
;;
t)
test_installation
exit 0
;;
esac
done
shift $((OPTIND-1))
echo "Welcome to the RIBAP Installation Pipeline."
echo "Please make sure you have a stable internet connection"
echo "and the GNU wget program installed."
echo ""
echo "RIBAP will install all things (except Python3 packages) into: "
echo "$RIBAPDIR"
echo "You will further find a log file of all installation processes"
echo "in your home directory $HOME ."
if [ ! -d "$RIBAPDIR" ]; then
mkdir -p "$RIBAPDIR"
export PATH="$RIBAPDIR"/bin:"$RIBAPDIR"/binaries/linux:"$PATH"
fi
echo 'RIBAP Installation Log' > $LOG
log_block
echo 'Installing Python packages for RIBAP, if needed.'
echo 'Make sure that your pip3 binary is connected to your /usr/bin/env python3 variable!'
echo 'RIBAP will install networkx and docopt for you.'
sleep 1
if [ ! $(which pip3) ]; then
echo 'I was not able to find pip3! Please install pip3 yourself and link it to your python3 interpreter'
exit 1
fi
if ! python3 -c "import networkx" &>/dev/null; then
log_block
pip3 install networkx >> "$LOG"
fi
echo 'networkx is installed'
if ! python3 -c "import docopt" &>/dev/null; then
log_block
pip3 install docopt >> "$LOG"
fi
echo 'docopt is installed'
if ! python3 -c "import Bio" &>/dev/null; then
log_block
pip3 install BioPython >> "$LOG"
fi
echo 'BioPython is installed'
echo 'Python packages done.'
echo ''
echo 'Let me install Prokka, roary and GLPK for you.'
#################################################
RIBAPTMP="$RIBAPDIR"/tmp/
cd "$RIBAPDIR" && mkdir -p "$RIBAPTMP" && mkdir -p "$RIBAPDIR"/bin
cd "$RIBAPTMP"
#################################################
PATH="$RIBAPDIR"/bin:"$PATH"
#################################################
cd "$RIBAPTMP"
echo 'Downloading newick utilities'
sleep 1
echo ''
wget http://cegg.unige.ch/pub/newick-utils-1.6-Linux-x86_64-disabled-extra.tar.gz
tar -xf newick-utils-1.6-Linux-x86_64-disabled-extra.tar.gz
cp newick-utils-1.6/src/nw_* "$RIBAPDIR"/bin
echo ''
echo 'Done with newick utilities'
echo ''
sleep 1
#################################################
cd "$RIBAPTMP"
echo 'Downloading cd-hit'
sleep 1
echo ''
wget https://github.com/weizhongli/cdhit/releases/download/V4.8.1/cd-hit-v4.8.1-2019-0228.tar.gz
tar -xf cd-hit-v4.8.1-2019-0228.tar.gz
log_block
cd cd-hit-v4.8.1-2019-0228/ && make openmp=no >> $LOG
cd cd-hit-auxtools/ && make >> $LOG && cd ..
log_block
find . -executable -type f | xargs -I{} cp {} "$RIBAPDIR"/bin
echo ''
echo 'Done with cd-hit'
echo ''
sleep 1
#################################################
cd "$RIBAPTMP"
echo 'Downloading MCL'
sleep 1
echo ''
wget https://micans.org/mcl/src/mcl-14-137.tar.gz
tar -xf mcl-14-137.tar.gz
log_block
cd mcl-14-137 && ./configure --prefix="$RIBAPDIR" >> $LOG
make install >> $LOG
log_block
echo ''
echo 'Done with MCL'
echo ''
sleep 1
#################################################
cd "$RIBAPTMP"
echo 'Downloading BLAST+'
sleep 1
echo ''
wget ftp://ftp.ncbi.nlm.nih.gov/blast/executables/LATEST/ncbi-blast-2.9.0+-x64-linux.tar.gz
tar -xf ncbi-blast-2.9.0+-x64-linux.tar.gz
cp ncbi-blast-2.9.0+/bin/* "$RIBAPDIR"/bin
echo ''
echo 'Done with BLAST+'
echo ''
sleep 1
#################################################
cd "$RIBAPTMP"
echo 'Downloading GNU parallel'
sleep 1
echo ''
wget ftp://ftp.gnu.org/gnu/parallel/parallel-20190622.tar.bz2
tar -xf parallel-20190622.tar.bz2
cd parallel-20190622
log_block
./configure --prefix="$RIBAPDIR" >> $LOG && make >> $LOG && make install >> $LOG
log_block
echo ''
echo 'Done with GNU Parallel'
echo ''
sleep 1
#################################################
cd "$RIBAPTMP"
echo 'Downloading RAxML'
sleep 1
echo ''
wget https://github.com/stamatak/standard-RAxML/archive/master.zip
unzip master.zip && cd standard-RAxML-master
for FILE in *SSE*.gcc; do
make -f "$FILE"
rm *.o
done
# eeeewwww - windows! ;)
find . -executable -type f | grep -v "Windows" | xargs -I{} cp {} "$RIBAPDIR"/bin/
echo ''
echo 'Done with RAxML'
echo ''
sleep 1
#################################################
cd "$RIBAPTMP"
echo 'Downloading MAFFT'
sleep 1
echo ''
wget https://mafft.cbrc.jp/alignment/software/mafft-7.427-without-extensions-src.tgz
tar -xf mafft-7.427-without-extensions-src.tgz && cd mafft-7.427-without-extensions/core/
sed -i -e '/PREFIX = / s:PREFIX = .*:PREFIX = '"$RIBAPDIR"/bin':' Makefile
sed -i -e '/BINDIR = / s:BINDIR = .*:BINDIR = '"$RIBAPDIR"/bin':' Makefile
make clean && make && make install
echo ''
echo 'Done with MAFFT'
echo ''
sleep 1
#################################################
cd "$RIBAPTMP"
echo 'Downloading FastTree'
sleep 1
echo ''
wget http://www.microbesonline.org/fasttree/FastTree
chmod 775 FastTree && cp FastTree "$RIBAPDIR"/bin
ln -s "$RIBAPDIR"/bin/FastTree "$RIBAPDIR"/bin/fasttree
echo ''
echo 'Done with FastTree'
echo ''
sleep 1
#################################################
echo 'Downloading and Installing Prokka'
sleep 1
echo ''
git clone https://github.com/tseemann/prokka.git "$RIBAPTMP"/prokka
rsync -a "$RIBAPTMP"/prokka/* "$RIBAPDIR"
log_block
"$RIBAPDIR"/bin/prokka --setupdb >> "$LOG" 2>&1
if [ $? -eq 0 ]; then
echo ''
echo 'Prokka is ready to use.'
else
echo ''
echo 'Uh-oh. Something went wrong while the database setup of Prokka!'
echo "Please have a look at $LOG"
echo 'https://github.com/tseemann/prokka'
#rm -rf "$RIBAPDIR"
exit 1
fi
echo ''
#################################################
cd "$RIBAPTMP"
echo 'Downloading and Installing roary'
sleep 1
echo ''
wget https://github.com/sanger-pathogens/Roary/tarball/master
tar -xf master
rsync -a sanger-pathogens-Roary-*/* "$RIBAPDIR"
#cd "$RIBAPDIR"/lib/Bio
#find . -iname "*pm" | xargs -n 1 sed -i 's/DIR => getcwd/DIR => $self->output_directory/'
echo ''
echo 'I am done with roary'
echo ''
#################################################
cd "$RIBAPTMP"
echo 'Downloading and Installing GLPK'
sleep 1
echo ''
wget ftp://ftp.gnu.org/gnu/glpk/glpk-4.65.tar.gz
tar -xf glpk-4.65.tar.gz
cd glpk-4.65
log_block
./configure --prefix="$RIBAPDIR" >> "$LOG"
log_block
make --jobs=4 >> "$LOG"
log_block
make install >> "$LOG"
log_block
make clean >> "$LOG"
echo ''
echo 'GLPK is good to go!'
echo ''
sleep 1
# "CD-HIT: a fast program for clustering and comparing large sets of protein or nucleotide sequences", Weizhong Li & Adam Godzik. Bioinformatics, (2006) 22:1658-1659
# "CD-HIT: accelerated for clustering the next generation sequencing data", Limin Fu, Beifang Niu, Zhengwei Zhu, Sitao Wu & Weizhong Li. Bioinformatics, (2012) 28:3150-3152
cd "$RIBAPTMP"
git clone https://github.com/soedinglab/MMseqs2.git
cd MMseqs2
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=. ..
make
make install
cp bin/* "$RIBAPDIR"/bin/
cp -r "$SCRIPTDIR"/scripts "$SCRIPTDIR"/ribap.sh "$SCRIPTDIR"/web "$RIBAPDIR"/bin
echo 'Cleaning up...'
cd "$RIBAPDIR"
rm -rf "$RIBAPTMP"
test_installation