forked from Xinglab/IRIS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·351 lines (273 loc) · 7.85 KB
/
install
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
#!/bin/bash
#
# Install dependencies
#
# ** Must manually install conda first. **
# This script will create two conda environments (Python 2 and 3)
# and install dependencies to them.
# https://docs.conda.io/en/latest/miniconda.html
# https://repo.anaconda.com/miniconda/Miniconda2-latest-Linux-x86_64.sh
#
# ** Must manually download the IRIS_data set **
# https://drive.google.com/file/d/1TaswpWPnEd4TXst46jsa9XSMzLsbzjOQ/view?usp=sharing
#
# ** Must manually download IEDB tools version 2.15.5 to the IEDB directory. **
# download file to IEDB/IEDB_MHC_I-2.15.5.tar.gz
# This script will unpack and install the IEDB tools.
# http://tools.iedb.org/main/download/ -> MHC Class I -> previous version -> 2.15.5
function install_iedb() {
echo
echo "checking IEDB dependency"
cd "${SCRIPT_DIR}/IEDB" || return 1
if [[ ! -d mhc_i ]]
then
tar -xvf IEDB_MHC_I-2.15.5.tar.gz || return 1
fi
cd mhc_i || return 1
./configure || return 1
}
# This script will automatically download and build bedtools
# https://github.com/arq5x/bedtools2/releases
function install_bedtools() {
echo
echo "checking bedtools dependency"
cd "${SCRIPT_DIR}" || return 1
if [[ ! -d bedtools ]]
then
mkdir bedtools || return 1
fi
cd bedtools || return 1
if [[ ! -f bedtools-2.29.0.tar.gz ]]
then
local BEDTOOLS_URI="https://github.com/arq5x/bedtools2/releases/download/v2.29.0/bedtools-2.29.0.tar.gz"
curl -L "${BEDTOOLS_URI}" -o bedtools-2.29.0.tar.gz || return 1
fi
if [[ ! -d bedtools2 ]]
then
tar -xvf bedtools-2.29.0.tar.gz || return 1
fi
cd bedtools2 || return 1
make || return 1
}
function install_star() {
echo
echo "checking STAR dependency"
cd "${SCRIPT_DIR}" || return 1
if [[ ! -d STAR ]]
then
mkdir STAR || return 1
fi
cd STAR || return 1
if [[ ! -f 2.5.3a.tar.gz ]]
then
local STAR_URI="https://github.com/alexdobin/STAR/archive/2.5.3a.tar.gz"
curl -L "${STAR_URI}" -o 2.5.3a.tar.gz || return 1
fi
if [[ ! -d STAR-2.5.3a ]]
then
tar -xvf 2.5.3a.tar.gz || return 1
fi
cd STAR-2.5.3a/source || return 1
make || return 1
}
function install_samtools() {
echo
echo "checking SAM tools dependency"
cd "${SCRIPT_DIR}" || return 1
if [[ ! -d samtools ]]
then
mkdir samtools || return 1
fi
cd samtools || return 1
if [[ ! -f samtools-1.3.tar.bz2 ]]
then
local SAMTOOLS_URI="https://sourceforge.net/projects/samtools/files/samtools/1.3/samtools-1.3.tar.bz2/download"
curl -L "${SAMTOOLS_URI}" -o samtools-1.3.tar.bz2 || return 1
fi
if [[ ! -d samtools-1.3 ]]
then
tar -xvf samtools-1.3.tar.bz2 || return 1
fi
cd samtools-1.3 || return 1
./configure --enable-plugins --enable-libcurl --with-plugin-path="$(pwd)"/htslib-1.3 || return 1
make all plugins-htslib || return 1
}
function install_rmats() {
echo
echo "checking rMATS dependency"
cd "${SCRIPT_DIR}" || return 1
if [[ ! -d rMATS ]]
then
mkdir rMATS || return 1
fi
cd rMATS || return 1
if [[ ! -f rMATS.4.0.2.tgz ]]
then
local RMATS_URI="https://sourceforge.net/projects/rnaseq-mats/files/MATS/rMATS.4.0.2.tgz/download"
curl -L "${RMATS_URI}" -o rMATS.4.0.2.tgz || return 1
fi
if [[ ! -d rMATS.4.0.2 ]]
then
tar -xvf rMATS.4.0.2.tgz || return 1
fi
}
function install_cufflinks() {
echo
echo "checking Cufflinks dependency"
cd "${SCRIPT_DIR}" || return 1
if [[ ! -d cufflinks ]]
then
mkdir cufflinks || return 1
fi
cd cufflinks || return 1
if [[ ! -f cufflinks-2.2.1.Linux_x86_64.tar.gz ]]
then
local CUFFLINKS_URI="http://cole-trapnell-lab.github.io/cufflinks/assets/downloads/cufflinks-2.2.1.Linux_x86_64.tar.gz"
curl "${CUFFLINKS_URI}" -o cufflinks-2.2.1.Linux_x86_64.tar.gz || return 1
fi
if [[ ! -d cufflinks-2.2.1.Linux_x86_64 ]]
then
tar -xvf cufflinks-2.2.1.Linux_x86_64.tar.gz || return 1
fi
}
function install_seq2hla() {
echo
echo "checking seq2HLA dependency"
cd "${SCRIPT_DIR}" || return 1
if [[ ! -d seq2hla ]]
then
local SEQ_2_HLA_URI="https://bitbucket.org/sebastian_boegel/seq2hla"
hg clone "${SEQ_2_HLA_URI}" || return 1
fi
}
function install_ms_gf() {
echo
echo "checking MS GF+ dependency"
cd "${SCRIPT_DIR}" || return 1
if [[ ! -d ms_gf_plus ]]
then
mkdir ms_gf_plus || return 1
fi
cd ms_gf_plus || return 1
if [[ ! -f MSGFPlus_v20190703.zip ]]
then
local MSGF_URI="https://github.com/MSGFPlus/msgfplus/releases/download/v2019.07.03/MSGFPlus_v20190703.zip"
curl -L "${MSGF_URI}" -o MSGFPlus_v20190703.zip || return 1
fi
if [[ ! -f README.md ]]
then
unzip MSGFPlus_v20190703.zip || return 1
fi
}
function install_python_packages() {
echo
echo "checking python dependencies"
cd "${SCRIPT_DIR}" || return 1
# Python 2
conda::activate_env "${CONDA_ENV_NAME_2}" || return 1
pip install -r requirements.txt || return 1
conda install -c bioconda bowtie # has an error return even when successful
conda::deactivate_env || return 1
# Python 3
conda::activate_env "${CONDA_ENV_NAME_3}" || return 1
pip install -r qsub/requirements.txt || return 1
conda::deactivate_env || return 1
}
function install_iris_data() {
echo
echo "checking IRIS data dependency"
cd "${SCRIPT_DIR}" || return 1
if [[ ! -d IRIS_data ]]
then
if [[ ! -f IRIS_data.tgz ]]; then
echo "Need to download IRIS_data.tgz from:"
echo "https://drive.google.com/file/d/1TaswpWPnEd4TXst46jsa9XSMzLsbzjOQ/view?usp=sharing"
return 1
fi
tar -xvf IRIS_data.tgz || return 1
fi
}
function install_iris_package() {
echo
echo "installing IRIS"
cd "${SCRIPT_DIR}" || return 1
conda::activate_env "${CONDA_ENV_NAME_2}" || return 1
python setup.py install || return 1
cd "${SCRIPT_DIR}" || return 1
conda::deactivate_env || return 1
}
function ensure_conda_envs() {
echo
echo "checking conda"
conda::create_env_with_name_and_python_version "${CONDA_ENV_NAME_2}"\
"${CONDA_PYTHON_VERSION_2}" || return 1
conda::create_env_with_name_and_python_version "${CONDA_ENV_NAME_3}"\
"${CONDA_PYTHON_VERSION_3}" || return 1
}
function install_optional() {
install_star
if [[ "$?" -ne 0 ]]; then
echo "Error installing optional dependency: star" >&2
fi
install_samtools
if [[ "$?" -ne 0 ]]; then
echo "Error installing optional dependency: samtools" >&2
fi
install_rmats
if [[ "$?" -ne 0 ]]; then
echo "Error installing optional dependency: rmats" >&2
fi
install_cufflinks
if [[ "$?" -ne 0 ]]; then
echo "Error installing optional dependency: cufflinks" >&2
fi
install_seq2hla
if [[ "$?" -ne 0 ]]; then
echo "Error installing optional dependency: seq2hla" >&2
fi
install_ms_gf
if [[ "$?" -ne 0 ]]; then
echo "Error installing optional dependency: ms gf" >&2
fi
}
function install() {
local INSTALL_OPTIONAL="$1"
ensure_conda_envs || return 1
install_iedb || return 1
install_bedtools || return 1
if [[ "${INSTALL_OPTIONAL}" -ne 0 ]]; then
install_optional || return 1
fi
install_python_packages || return 1
install_iris_data || return 1
install_iris_package || return 1
}
function display_usage() {
echo "usage:"
echo " ./install {core|all}"
echo ""
echo "./install core: installs only the required dependencies for the major IRIS modules"
echo ""
echo "./install all: installs all dependencies"
}
function main() {
local INSTALL_OPTIONAL
if [[ "$#" -ne 1 ]]; then
echo "exactly one argument required" >&2
display_usage
return 1
elif [[ "$1" = 'core' ]]; then
INSTALL_OPTIONAL=0
elif [[ "$1" = 'all' ]]; then
INSTALL_OPTIONAL=1
else
echo "unrecognized argument: $1" >&2
display_usage
return 1
fi
source set_env_vars.sh || return 1
source conda.sh || return 1
SCRIPT_DIR="$(pwd)" || return 1
install "${INSTALL_OPTIONAL}" || return 1
}
main "$@"