-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstall.sh
executable file
·395 lines (376 loc) · 15.6 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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
#!/bin/bash
# EPN, Mon Dec 14 16:55:10 2020
# install.sh
# A shell script for downloading and installing Ribovore and its dependencies.
#
# usage:
# install.sh <"linux" or "macosx-intel" or "macosx-silicon">
#
# for example:
# install.sh linux
#
# The following line will make the script fail if any commands fail
set -e
RIBOINSTALLDIR=$PWD
# versions
VERSION="1.0.5"
# blast+
BVERSION="2.14.1"
# infernal
IVERSION="1.1.5"
IESLCLUSTERVERSION="1.1.2"
# dependency git tag
RVERSION="ribovore-$VERSION"
# set defaults
INPUTSYSTEM="?"
RIBOTYPERONLY="?"
DOKEEP="no"
########################
# Validate correct usage
########################
# make sure correct number of cmdline arguments were used, exit if not
if [ "$#" -ne 1 ]; then
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <os>"
echo " or "
echo "Usage: $0 <os> keep"
echo ""
echo "valid options for <os> are:"
echo " \"linux\": full install for linux"
echo " \"macosx-intel\": full install for macosx-intel"
echo " \"macosx-silicon\": full install for macosx-silicon"
echo " \"rt-linux\": ribotyper only for linux"
echo " \"rt-macosx-intel\": ribotyper only for macosx-intel"
echo " \"rt-macosx-silicon\": ribotyper only for macosx-silicon"
echo ""
echo "use \"keep\" as 2nd argument to keep nonessential files"
echo "which are normally removed"
exit 1
fi
fi
# make sure 1st argument is valid
if [ "$1" = "linux" ]; then
INPUTSYSTEM="linux";
RIBOTYPERONLY="no"
fi
if [ "$1" = "macosx-intel" ]; then
INPUTSYSTEM="macosx-intel";
RIBOTYPERONLY="no"
fi
if [ "$1" = "macosx-silicon" ]; then
INPUTSYSTEM="macosx-silicon";
RIBOTYPERONLY="no"
fi
if [ "$1" = "rt-linux" ]; then
INPUTSYSTEM="linux";
RIBOTYPERONLY="yes"
fi
if [ "$1" = "rt-macosx-intel" ]; then
INPUTSYSTEM="macosx-intel";
RIBOTYPERONLY="yes"
fi
if [ "$1" = "rt-macosx-silicon" ]; then
INPUTSYSTEM="macosx-silicon";
RIBOTYPERONLY="yes"
fi
if [ "$INPUTSYSTEM" = "?" ]; then
echo "Usage: $0 <os>"
echo " or "
echo "Usage: $0 <os> keep"
echo ""
echo "valid options for <os> are:"
echo " \"linux\": full install for linux"
echo " \"macosx-intel\": full install for macosx-intel"
echo " \"macosx-silicon\": full install for macosx-silicon"
echo " \"rt-linux\": ribotyper only for linux"
echo " \"rt-macosx-intel\": ribotyper only for macosx-intel"
echo " \"rt-macosx-silicon\": ribotyper only for macosx-silicon"
echo ""
echo "use \"keep\" as 2nd argument to keep src and other nonessential"
echo "files which are normally removed"
exit 1
fi
# make sure 2nd argument (if we have one) is "keep"
if [ "$#" -eq 2 ]; then
if [ "$2" = "keep" ]; then
DOKEEP="yes";
fi
if [ "$DOKEEP" = "no" ]; then
echo "Usage: $0 <os>"
echo " or "
echo "Usage: $0 <os> keep"
echo ""
echo "valid options for <os> are:"
echo " \"linux\": full install for linux"
echo " \"macosx-intel\": full install for macosx-intel"
echo " \"macosx-silicon\": full install for macosx-silicon"
echo " \"rt-linux\": ribotyper only for linux"
echo " \"rt-macosx-intel\": ribotyper only for macosx-intel"
echo " \"rt-macosx-silicon\": ribotyper only for macosx-silicon"
echo ""
echo "use \"keep\" as 2nd argument to keep src and other nonessential"
echo "files which are normally removed"
exit 1
fi
fi
########################################################
echo "------------------------------------------------"
echo "DOWNLOADING AND BUILDING RIBOVORE $VERSION"
echo "------------------------------------------------"
echo ""
echo "************************************************************"
echo "IMPORTANT: BEFORE YOU WILL BE ABLE TO RUN RIBOVORE SCRIPTS,"
echo "YOU NEED TO FOLLOW THE INSTRUCTIONS OUTPUT AT THE END"
echo "OF THIS SCRIPT TO UPDATE YOUR ENVIRONMENT VARIABLES."
echo "************************************************************"
echo ""
echo "Determining current directory ... "
echo "Set RIBOINSTALLDIR as current directory ($RIBOINSTALLDIR)."
###########################################
# Download section
###########################################
echo "------------------------------------------------"
# ribovore
echo "Downloading ribovore ... "
curl -k -L -o $RVERSION.zip https://github.com/ncbi/ribovore/archive/$RVERSION.zip; unzip $RVERSION.zip; mv ribovore-$RVERSION ribovore; rm $RVERSION.zip
# for a test build of a release, comment out above curl and uncomment block below
# ----------------------------------------------------------------------------
#git clone https://github.com/ncbi/ribovore.git ribovore
#cd ribovore
#git checkout release-$VERSION
#rm -rf .git
#cd ..
# ----------------------------------------------------------------------------
if [ "$RIBOTYPERONLY" = "yes" ]; then
rm -rf ribovore/taxonomy
fi
# sequip
echo "Downloading sequip ... "
curl -k -L -o sequip-$RVERSION.zip https://github.com/nawrockie/sequip/archive/$RVERSION.zip; unzip sequip-$RVERSION.zip; mv sequip-$RVERSION sequip; rm sequip-$RVERSION.zip
# to checkout a specific branch, comment out above curl and uncomment block below
# ----------------------------------------------------------------------------
#git clone https://github.com/nawrockie/sequip.git sequip
#cd sequip
#git checkout develop
#rm -rf .git
#cd ..
# ----------------------------------------------------------------------------
if [ "$RIBOTYPERONLY" != "yes" ]; then
# rRNA_sensor
echo "Downloading rRNA_sensor ... "
curl -k -L -o rRNA_sensor-$RVERSION.zip https://github.com/aaschaffer/rRNA_sensor/archive/$RVERSION.zip; unzip rRNA_sensor-$RVERSION.zip; mv rRNA_sensor-$RVERSION rRNA_sensor; rm rRNA_sensor-$RVERSION.zip
# to checkout a specific branch, comment out above curl and uncomment block below
# ----------------------------------------------------------------------------
#git clone https://github.com/aaschaffer/rRNA_sensor.git rRNA_sensor
#cd rRNA_sensor
#git checkout release-0.14
#rm -rf .git
#cd ..
# ----------------------------------------------------------------------------
fi
# download two infernal binary distributions
# the first is a recent release, we'll use most programs from this release,
# the second is *only* for esl-cluster which is no longer available in current releases
#
# - to download source distributions and build them instead of binary distributions, see
# 'infernal block 2' below.
# ----- infernal block 1 start -----
if [ "$INPUTSYSTEM" = "linux" ]; then
echo "Downloading Infernal version $IVERSION for Linux"
curl -k -L -o infernal.tar.gz http://eddylab.org/infernal/infernal-$IVERSION-linux-intel-gcc.tar.gz
tar xfz infernal.tar.gz
rm infernal.tar.gz
mv infernal-$IVERSION-linux-intel-gcc infernal
if [ "$RIBOTYPERONLY" != "yes" ]; then
echo "Downloading Infernal version $IESLCLUSTERVERSION for Linux"
curl -k -L -o infernal2.tar.gz http://eddylab.org/infernal/infernal-$IESLCLUSTERVERSION-linux-intel-gcc.tar.gz
tar xfz infernal2.tar.gz
rm infernal2.tar.gz
mv infernal-$IESLCLUSTERVERSION-linux-intel-gcc/binaries/esl-cluster infernal/binaries/
rm -rf infernal-$IESLCLUSTERVERSION-linux-intel-gcc
fi
elif [ "$INPUTSYSTEM" = "macosx-intel" ]; then
echo "Downloading Infernal version $IVERSION for Mac/OSX-intel"
curl -k -L -o infernal.tar.gz http://eddylab.org/infernal/infernal-$IVERSION-macosx-intel.tar.gz
tar xfz infernal.tar.gz
rm infernal.tar.gz
mv infernal-$IVERSION-macosx-intel infernal
if [ "$RIBOTYPERONLY" != "yes" ]; then
echo "Downloading Infernal version $IESLCLUSTERVERSION for Mac/OSX"
curl -k -L -o infernal2.tar.gz http://eddylab.org/infernal/infernal-$IESLCLUSTERVERSION-macosx-intel.tar.gz
tar xfz infernal2.tar.gz
rm infernal2.tar.gz
mv infernal-$IESLCLUSTERVERSION-macosx-intel/binaries/esl-cluster infernal/binaries/
rm -rf infernal-$IESLCLUSTERVERSION-macosx-intel
fi
else
echo "Downloading Infernal version $IVERSION for Mac/OSX-silicon"
curl -k -L -o infernal.tar.gz http://eddylab.org/infernal/infernal-$IVERSION-macosx-silicon.tar.gz
# esl-cluster doesn't exist in an infernal release that builds on silicon, but the intel version runs on silicon
tar xfz infernal.tar.gz
rm infernal.tar.gz
mv infernal-$IVERSION-macosx-silicon infernal
if [ "$RIBOTYPERONLY" != "yes" ]; then
echo "Downloading Infernal version $IESLCLUSTERVERSION for Mac/OSX"
curl -k -L -o infernal2.tar.gz http://eddylab.org/infernal/infernal-$IESLCLUSTERVERSION-macosx-intel.tar.gz
tar xfz infernal2.tar.gz
rm infernal2.tar.gz
mv infernal-$IESLCLUSTERVERSION-macosx-intel/binaries/esl-cluster infernal/binaries/
rm -rf infernal-$IESLCLUSTERVERSION-macosx-intel
fi
fi
# ----- infernal block 1 end -----
# if you'd rather download the source distros and build them yourself
# (maybe because the binaries aren't working for you for some reason)
# comment out 'infernal block 1' above and
# uncomment 'infernal block 2' below
#
# ----- infernal block 2 start -----
#echo "Downloading Infernal version $IVERSION src distribution"
#curl -k -L -o infernal.tar.gz http://eddylab.org/infernal/infernal-$IVERSION.tar.gz
#tar xfz infernal.tar.gz
#rm infernal.tar.gz
#
#echo "Building Infernal ... "
#mv infernal-$IVERSION infernal
#cd infernal
#mkdir binaries
#sh ./configure --bindir=$PWD/binaries --prefix=$PWD
#make
#make install
#(cd easel/miniapps; make install)
#cd ..
#echo "Finished building Infernal version $IESLCLUSTERVERSION"
#
# ----- infernal block 2 end -----
#
################################
# download blast binaries
if [ "$RIBOTYPERONLY" != "yes" ]; then
if [ "$INPUTSYSTEM" = "linux" ]; then
echo "Downloading BLAST version $BVERSION for Linux"
curl -k -L -o blast.tar.gz https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/$BVERSION/ncbi-blast-$BVERSION+-x64-linux.tar.gz
else
echo "Downloading BLAST version $BVERSION for Mac/OSX"
echo "curl -k -L -o blast.tar.gz https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/$BVERSION/ncbi-blast-$BVERSION+-x64-macosx.tar.gz"
curl -k -L -o blast.tar.gz https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/$BVERSION/ncbi-blast-$BVERSION+-x64-macosx.tar.gz
fi
tar xfz blast.tar.gz
rm blast.tar.gz
mv ncbi-blast-$BVERSION+ ncbi-blast
echo "------------------------------------------------"
# if linux, download vecscreen_plus_taxonomy
if [ "$INPUTSYSTEM" = "linux" ]; then
curl -k -L -o vecscreen_plus_taxonomy-$RVERSION.zip https://github.com/aaschaffer/vecscreen_plus_taxonomy/archive/$RVERSION.zip;
unzip vecscreen_plus_taxonomy-$RVERSION.zip;
mv vecscreen_plus_taxonomy-$RVERSION vecscreen_plus_taxonomy
rm vecscreen_plus_taxonomy-$RVERSION.zip
(cd vecscreen_plus_taxonomy/scripts; gunzip srcchk.gz; gunzip vecscreen.gz;)
else
echo "Not installing vecscreen_plus_taxonomy (only available for Linux)"
fi
echo "------------------------------------------------"
fi
########################################################
# remove nonessential files, unless 'keep' used
if [ "$DOKEEP" = "no" ]; then
echo "------------------------------------------------"
echo "Removing nonessential files"
# infernal, we only need binaries subdir
mv infernal/binaries ./binaries
rm -rf infernal
mkdir infernal
mv binaries infernal
# ncbi-blast, we only need blastdbcmd and blastn
if [ "$RIBOTYPERONLY" != "yes" ]; then
mv ncbi-blast/bin/blastdbcmd ./
mv ncbi-blast/bin/blastn ./
rm -rf ncbi-blast
mkdir ncbi-blast
mkdir ncbi-blast/bin
mv blastdbcmd ncbi-blast/bin
mv blastn ncbi-blast/bin
fi
echo "------------------------------------------------"
fi
########################################################
###############################################
# Message about setting environment variables
###############################################
echo "********************************************************"
echo ""
echo "The final step is to update your environment variables."
echo "(See ribovore/README.txt for more information.)"
echo ""
echo "If you are using the bash or zsh shell add the following lines to"
echo "the end of your '.bashrc' or '.zshrc' file in your home directory:"
echo ""
echo "export RIBOINSTALLDIR=\"$RIBOINSTALLDIR\""
echo "export RIBOSCRIPTSDIR=\"\$RIBOINSTALLDIR/ribovore\""
echo "export RIBOINFERNALDIR=\"\$RIBOINSTALLDIR/infernal/binaries\""
echo "export RIBOEASELDIR=\"\$RIBOINSTALLDIR/infernal/binaries\""
echo "export RIBOSEQUIPDIR=\"\$RIBOINSTALLDIR/sequip\""
echo "export RIBOTIMEDIR=\"/usr/bin\""
if [ "$RIBOTYPERONLY" != "yes" ]; then
echo "export RIBOBLASTDIR=\"\$RIBOINSTALLDIR/ncbi-blast/bin\""
echo "export RRNASENSORDIR=\"\$RIBOINSTALLDIR/rRNA_sensor\""
if [ "$INPUTSYSTEM" = "linux" ]; then
echo "export VECPLUSDIR=\"\$RIBOINSTALLDIR/vecscreen_plus_taxonomy\""
echo "export BLASTDB=\"\$VECPLUSDIR/univec-files\":\"\$RRNASENSORDIR\":\"\$BLASTDB\""
echo "export PERL5LIB=\"\$RIBOSCRIPTSDIR\":\"\$RIBOSEQUIPDIR\":\"\$VECPLUSDIR\":\"\$PERL5LIB\""
else
echo "export BLASTDB=\"\$RRNASENSORDIR\":\"\$BLASTDB\""
echo "export PERL5LIB=\"\$RIBOSCRIPTSDIR\":\"\$RIBOSEQUIPDIR\":\"\$PERL5LIB\""
fi
echo "export PATH=\"\$RIBOSCRIPTSDIR\":\"\$RIBOBLASTDIR\":\"\$RRNASENSORDIR\":\"\$PATH\""
else
echo "export PERL5LIB=\"\$RIBOSCRIPTSDIR\":\"\$RIBOSEQUIPDIR\":\"\$PERL5LIB\""
echo "export PATH=\"\$RIBOSCRIPTSDIR\":\"\$PATH\""
fi
echo ""
echo "After adding the export lines to your .bashrc or .zshrc file, source that file"
echo "to update your current environment with the command:"
echo ""
echo "source ~/.bashrc"
echo ""
echo "OR"
echo ""
echo "source ~/.zshrc"
echo ""
echo "---"
echo "If you are using the C shell, add the following"
echo "lines to the end of your '.cshrc' file in your home"
echo "directory:"
echo ""
echo "setenv RIBOINSTALLDIR \"$RIBOINSTALLDIR\""
echo "setenv RIBOSCRIPTSDIR \"\$RIBOINSTALLDIR/ribovore\""
echo "setenv RIBOINFERNALDIR \"\$RIBOINSTALLDIR/infernal/binaries\""
echo "setenv RIBOEASELDIR \"\$RIBOINSTALLDIR/infernal/binaries\""
echo "setenv RIBOSEQUIPDIR \"\$RIBOINSTALLDIR/sequip\""
echo "setenv RIBOTIMEDIR \"/usr/bin\""
if [ "$RIBOTYPERONLY" != "yes" ]; then
echo "setenv RIBOBLASTDIR \"\$RIBOINSTALLDIR/ncbi-blast/bin\""
echo "setenv RRNASENSORDIR \"\$RIBOINSTALLDIR/rRNA_sensor\""
if [ "$INPUTSYSTEM" = "linux" ]; then
echo "setenv VECPLUSDIR \"\$RIBOINSTALLDIR/vecscreen_plus_taxonomy\""
echo "setenv BLASTDB \"\$VECPLUSDIR/univec-files\":\"\$RRNASENSORDIR\":\"\$BLASTDB\""
echo "setenv PERL5LIB \"\$RIBOSCRIPTSDIR\":\"\$RIBOSEQUIPDIR\":\"\$VECPLUSDIR\":\"\$PERL5LIB\""
else
echo "setenv BLASTDB \"\$RRNASENSORDIR\":\"\$BLASTDB\""
echo "setenv PERL5LIB \"\$RIBOSCRIPTSDIR\":\"\$RIBOSEQUIPDIR\":\"\$PERL5LIB\""
fi
echo "setenv PATH \"\$RIBOSCRIPTSDIR\":\"\$RIBOBLASTDIR\":\"\$RRNASENSORDIR\":\"\$PATH\""
else
echo "setenv PERL5LIB \"\$RIBOSCRIPTSDIR\":\"\$RIBOSEQUIPDIR\":\"\$PERL5LIB\""
echo "setenv PATH \"\$RIBOSCRIPTSDIR\":\"\$PATH\""
fi
echo ""
echo "After adding the setenv lines to your .cshrc file, source that file"
echo "to update your current environment with the command:"
echo ""
echo "source ~/.cshrc"
echo ""
echo "(To determine which shell you use, type: 'echo \$SHELL')"
echo ""
echo "********************************************************"
echo ""