comparison install_tool_deps.sh @ 0:47ec9c6f44b8 draft

planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit b63924933a03255872077beb4d0fde49d77afa92
author pjbriggs
date Thu, 09 Nov 2017 10:13:29 -0500
parents
children 1c1902e12caf
comparison
equal deleted inserted replaced
-1:000000000000 0:47ec9c6f44b8
1 #!/bin/bash -e
2 #
3 # Install the tool dependencies for Amplicon_analysis_pipeline.sh for
4 # testing from command line
5 #
6 function install_python_package() {
7 echo Installing $2 $3 from $4 under $1
8 local install_dir=$1
9 local install_dirs="$install_dir $install_dir/bin $install_dir/lib/python2.7/site-packages"
10 for d in $install_dirs ; do
11 if [ ! -d $d ] ; then
12 mkdir -p $d
13 fi
14 done
15 wd=$(mktemp -d)
16 echo Moving to $wd
17 pushd $wd
18 wget -q $4
19 if [ ! -f "$(basename $4)" ] ; then
20 echo "No archive $(basename $4)"
21 exit 1
22 fi
23 tar xzf $(basename $4)
24 if [ ! -d "$5" ] ; then
25 echo "No directory $5"
26 exit 1
27 fi
28 cd $5
29 /bin/bash <<EOF
30 export PYTHONPATH=$install_dir:$PYTHONPATH && \
31 export PYTHONPATH=$install_dir/lib/python2.7/site-packages:$PYTHONPATH && \
32 python setup.py install --prefix=$install_dir --install-scripts=$install_dir/bin --install-lib=$install_dir/lib/python2.7/site-packages >>$INSTALL_DIR/INSTALLATION.log 2>&1
33 EOF
34 popd
35 rm -rf $wd/*
36 rmdir $wd
37 }
38 function install_amplicon_analysis_pipeline_1_1() {
39 install_amplicon_analysis_pipeline $1 1.1
40 }
41 function install_amplicon_analysis_pipeline_1_0() {
42 install_amplicon_analysis_pipeline $1 1.0
43 }
44 function install_amplicon_analysis_pipeline() {
45 version=$2
46 echo Installing Amplicon_analysis $version
47 install_dir=$1/amplicon_analysis_pipeline/$version
48 if [ -f $install_dir/env.sh ] ; then
49 return
50 fi
51 mkdir -p $install_dir
52 echo Moving to $install_dir
53 pushd $install_dir
54 wget -q https://github.com/MTutino/Amplicon_analysis/archive/v${version}.tar.gz
55 tar zxf v${version}.tar.gz
56 mv Amplicon_analysis-${version} Amplicon_analysis
57 rm -rf v${version}.tar.gz
58 popd
59 # Make setup file
60 cat > $install_dir/env.sh <<EOF
61 #!/bin/sh
62 # Source this to setup Amplicon_analysis/$version
63 echo Setting up Amplicon analysis pipeline $version
64 export PATH=$install_dir/Amplicon_analysis:\$PATH
65 ## AMPLICON_ANALYSIS_REF_DATA_PATH should be set in
66 ## config/local_env.sh or in the job_conf.xml file
67 ## - see the README
68 ##export AMPLICON_ANALYSIS_REF_DATA_PATH=
69 #
70 EOF
71 }
72 function install_amplicon_analysis_pipeline_1_0_patched() {
73 version="1.0-patched"
74 echo Installing Amplicon_analysis $version
75 install_dir=$1/amplicon_analysis_pipeline/$version
76 if [ -f $install_dir/env.sh ] ; then
77 return
78 fi
79 mkdir -p $install_dir
80 echo Moving to $install_dir
81 pushd $install_dir
82 # Clone and patch analysis pipeline scripts
83 git clone https://github.com/pjbriggs/Amplicon_analysis.git
84 cd Amplicon_analysis
85 git checkout -b $version
86 branches=
87 if [ ! -z "$branches" ] ; then
88 for branch in $branches ; do
89 git checkout -b $branch origin/$branch
90 git checkout $version
91 git merge -m "Merge $branch into $version" $branch
92 done
93 fi
94 cd ..
95 popd
96 # Make setup file
97 cat > $install_dir/env.sh <<EOF
98 #!/bin/sh
99 # Source this to setup Amplicon_analysis/$version
100 echo Setting up Amplicon analysis pipeline $version
101 export PATH=$install_dir/Amplicon_analysis:\$PATH
102 ## AMPLICON_ANALYSIS_REF_DATA_PATH should be set in
103 ## config/local_env.sh or in the job_conf.xml file
104 ## - see the README
105 ##export AMPLICON_ANALYSIS_REF_DATA_PATH=
106 #
107 EOF
108 }
109 function install_cutadapt_1_11() {
110 echo Installing cutadapt 1.11
111 INSTALL_DIR=$1/cutadapt/1.11
112 if [ -f $INSTALL_DIR/env.sh ] ; then
113 return
114 fi
115 mkdir -p $INSTALL_DIR
116 install_python_package $INSTALL_DIR cutadapt 1.11 \
117 https://pypi.python.org/packages/47/bf/9045e90dac084a90aa2bb72c7d5aadefaea96a5776f445f5b5d9a7a2c78b/cutadapt-1.11.tar.gz \
118 cutadapt-1.11
119 # Make setup file
120 cat > $INSTALL_DIR/env.sh <<EOF
121 #!/bin/sh
122 # Source this to setup cutadapt/1.11
123 echo Setting up cutadapt 1.11
124 #if [ -f $1/python/2.7.10/env.sh ] ; then
125 # . $1/python/2.7.10/env.sh
126 #fi
127 export PATH=$INSTALL_DIR/bin:\$PATH
128 export PYTHONPATH=$INSTALL_DIR:\$PYTHONPATH
129 export PYTHONPATH=$INSTALL_DIR/lib:\$PYTHONPATH
130 export PYTHONPATH=$INSTALL_DIR/lib/python2.7:\$PYTHONPATH
131 export PYTHONPATH=$INSTALL_DIR/lib/python2.7/site-packages:\$PYTHONPATH
132 #
133 EOF
134 }
135 function install_sickle_1_33() {
136 echo Installing sickle 1.33
137 INSTALL_DIR=$1/sickle/1.33
138 if [ -f $INSTALL_DIR/env.sh ] ; then
139 return
140 fi
141 mkdir -p $INSTALL_DIR
142 mkdir -p $INSTALL_DIR/bin
143 wd=$(mktemp -d)
144 echo Moving to $wd
145 pushd $wd
146 wget -q https://github.com/najoshi/sickle/archive/v1.33.tar.gz
147 tar zxf v1.33.tar.gz
148 cd sickle-1.33
149 make >$INSTALL_DIR/INSTALLATION.log 2>&1
150 mv sickle $INSTALL_DIR/bin
151 popd
152 rm -rf $wd/*
153 rmdir $wd
154 # Make setup file
155 cat > $INSTALL_DIR/env.sh <<EOF
156 #!/bin/sh
157 # Source this to setup sickle/1.33
158 echo Setting up sickle 1.33
159 export PATH=$INSTALL_DIR/bin:\$PATH
160 #
161 EOF
162 }
163 function install_bioawk_27_08_2013() {
164 echo Installing bioawk 27-08-2013
165 INSTALL_DIR=$1/bioawk/27-08-2013
166 if [ -f $INSTALL_DIR/env.sh ] ; then
167 return
168 fi
169 mkdir -p $INSTALL_DIR
170 mkdir -p $INSTALL_DIR/bin
171 wd=$(mktemp -d)
172 echo Moving to $wd
173 pushd $wd
174 wget -q https://github.com/lh3/bioawk/archive/v1.0.tar.gz
175 tar zxf v1.0.tar.gz
176 cd bioawk-1.0
177 make >$INSTALL_DIR/INSTALLATION.log 2>&1
178 mv bioawk $INSTALL_DIR/bin
179 mv maketab $INSTALL_DIR/bin
180 popd
181 rm -rf $wd/*
182 rmdir $wd
183 # Make setup file
184 cat > $INSTALL_DIR/env.sh <<EOF
185 #!/bin/sh
186 # Source this to setup bioawk/2013-07-13
187 echo Setting up bioawk 2013-07-13
188 export PATH=$INSTALL_DIR/bin:\$PATH
189 #
190 EOF
191 }
192 function install_pandaseq_2_8_1() {
193 # Taken from https://github.com/fls-bioinformatics-core/galaxy-tools/blob/master/local_dependency_installers/pandaseq.sh
194 echo Installing pandaseq 2.8.1
195 local install_dir=$1/pandaseq/2.8.1
196 if [ -f $install_dir/env.sh ] ; then
197 return
198 fi
199 mkdir -p $install_dir
200 local wd=$(mktemp -d)
201 echo Moving to $wd
202 pushd $wd
203 wget -q https://github.com/neufeld/pandaseq/archive/v2.8.1.tar.gz
204 tar xzf v2.8.1.tar.gz
205 cd pandaseq-2.8.1
206 ./autogen.sh >$install_dir/INSTALLATION.log 2>&1
207 ./configure --prefix=$install_dir >>$install_dir/INSTALLATION.log 2>&1
208 make; make install >>$install_dir/INSTALLATION.log 2>&1
209 popd
210 rm -rf $wd/*
211 rmdir $wd
212 # Make setup file
213 cat > $1/pandaseq/2.8.1/env.sh <<EOF
214 #!/bin/sh
215 # Source this to setup pandaseq/2.8.1
216 echo Setting up pandaseq 2.8.1
217 export PATH=$install_dir/bin:\$PATH
218 export LD_LIBRARY_PATH=$install_dir/lib:\$LD_LIBRARY_PATH
219 #
220 EOF
221 }
222 function install_spades_3_5_0() {
223 # See http://spades.bioinf.spbau.ru/release3.5.0/manual.html
224 echo Installing spades 3.5.0
225 local install_dir=$1/spades/3.5.0
226 if [ -f $install_dir/env.sh ] ; then
227 return
228 fi
229 mkdir -p $install_dir
230 local wd=$(mktemp -d)
231 echo Moving to $wd
232 pushd $wd
233 wget -q http://spades.bioinf.spbau.ru/release3.5.0/SPAdes-3.5.0-Linux.tar.gz
234 tar zxf SPAdes-3.5.0-Linux.tar.gz
235 cd SPAdes-3.5.0-Linux
236 mv bin $install_dir
237 mv share $install_dir
238 popd
239 rm -rf $wd/*
240 rmdir $wd
241 # Make setup file
242 cat > $1/spades/3.5.0/env.sh <<EOF
243 #!/bin/sh
244 # Source this to setup spades/3.5.0
245 echo Setting up spades 3.5.0
246 export PATH=$install_dir/bin:\$PATH
247 #
248 EOF
249 }
250 function install_fastqc_0_11_3() {
251 echo Installing fastqc 0.11.3
252 local install_dir=$1/fastqc/0.11.3
253 if [ -f $install_dir/env.sh ] ; then
254 return
255 fi
256 mkdir -p $install_dir
257 local wd=$(mktemp -d)
258 echo Moving to $wd
259 pushd $wd
260 wget -q http://www.bioinformatics.babraham.ac.uk/projects/fastqc/fastqc_v0.11.3.zip
261 unzip -qq fastqc_v0.11.3.zip
262 cd FastQC
263 chmod 0755 fastqc
264 mv * $install_dir
265 popd
266 rm -rf $wd/*
267 rmdir $wd
268 # Make setup file
269 cat > $1/fastqc/0.11.3/env.sh <<EOF
270 #!/bin/sh
271 # Source this to setup fastqc/0.11.3
272 echo Setting up fastqc 0.11.3
273 export PATH=$install_dir:\$PATH
274 #
275 EOF
276 }
277 function install_qiime_1_8_0() {
278 # See http://qiime.org/1.8.0/install/install.html
279 echo Installing qiime 1.8.0
280 INSTALL_DIR=$1/qiime/1.8.0
281 if [ -f $INSTALL_DIR/env.sh ] ; then
282 return
283 fi
284 mkdir -p $INSTALL_DIR
285 # Atlas 3.10 (precompiled)
286 # NB this stolen from galaxyproject/iuc-tools
287 local wd=$(mktemp -d)
288 echo Moving to $wd
289 pushd $wd
290 wget -q https://depot.galaxyproject.org/software/atlas/atlas_3.10.2_linux_x64.tar.gz
291 tar zxvf atlas_3.10.2_linux_x64.tar.gz
292 mv lib $INSTALL_DIR
293 command -v gfortran || return 0
294 BUNDLED_LGF_CANON=$INSTALL_DIR/lib/libgfortran.so.3.0.0
295 BUNDLED_LGF_VERS=`objdump -p $BUNDLED_LGF_CANON | grep GFORTRAN_1 | sed -r 's/.*GFORTRAN_1\.([0-9])+/\1/' | sort -n | tail -1`
296 echo 'program test; end program test' > test.f90
297 gfortran -o test test.f90
298 LGF=`ldd test | grep libgfortran | awk '{print $3}'`
299 LGF_CANON=`readlink -f $LGF`
300 LGF_VERS=`objdump -p $LGF_CANON | grep GFORTRAN_1 | sed -r 's/.*GFORTRAN_1\.([0-9])+/\1/' | sort -n | tail -1`
301 if [ $LGF_VERS -gt $BUNDLED_LGF_VERS ]; then
302 cp -p $BUNDLED_LGF_CANON ${BUNDLED_LGF_CANON}.bundled
303 cp -p $LGF_CANON $BUNDLED_LGF_CANON
304 fi
305 popd
306 rm -rf $wd/*
307 rmdir $wd
308 # Atlas 3.10 (build from source)
309 # NB this stolen from galaxyproject/iuc-tools
310 ##local wd=$(mktemp -d)
311 ##echo Moving to $wd
312 ##pushd $wd
313 ##wget -q https://depot.galaxyproject.org/software/atlas/atlas_3.10.2+gx0_src_all.tar.bz2
314 ##wget -q https://depot.galaxyproject.org/software/lapack/lapack_3.5.0_src_all.tar.gz
315 ##wget -q https://depot.galaxyproject.org/software/atlas/atlas_patch-blas-lapack-1.0_src_all.diff
316 ##wget -q https://depot.galaxyproject.org/software/atlas/atlas_patch-shared-lib-1.0_src_all.diff
317 ##wget -q https://depot.galaxyproject.org/software/atlas/atlas_patch-cpu-throttle-1.0_src_all.diff
318 ##tar -jxvf atlas_3.10.2+gx0_src_all.tar.bz2
319 ##cd ATLAS
320 ##mkdir build
321 ##patch -p1 < ../atlas_patch-blas-lapack-1.0_src_all.diff
322 ##patch -p1 < ../atlas_patch-shared-lib-1.0_src_all.diff
323 ##patch -p1 < ../atlas_patch-cpu-throttle-1.0_src_all.diff
324 ##cd build
325 ##../configure --prefix="$INSTALL_DIR" -D c -DWALL -b 64 -Fa alg '-fPIC' --with-netlib-lapack-tarfile=../../lapack_3.5.0_src_all.tar.gz -v 2 -t 0 -Si cputhrchk 0
326 ##make
327 ##make install
328 ##popd
329 ##rm -rf $wd/*
330 ##rmdir $wd
331 export ATLAS_LIB_DIR=$INSTALL_DIR/lib
332 export ATLAS_INCLUDE_DIR=$INSTALL_DIR/include
333 export ATLAS_BLAS_LIB_DIR=$INSTALL_DIR/lib/atlas
334 export ATLAS_LAPACK_LIB_DIR=$INSTALL_DIR/lib/atlas
335 export ATLAS_ROOT_PATH=$INSTALL_DIR
336 export LD_LIBRARY_PATH=$INSTALL_DIR/lib:$LD_LIBRARY_PATH
337 export LD_LIBRARY_PATH=$INSTALL_DIR/lib/atlas:$LD_LIBRARY_PATH
338 # Numpy 1.7.1
339 local wd=$(mktemp -d)
340 echo Moving to $wd
341 pushd $wd
342 wget -q https://depot.galaxyproject.org/software/numpy/numpy_1.7_src_all.tar.gz
343 tar -zxvf numpy_1.7_src_all.tar.gz
344 cd numpy-1.7.1
345 cat > site.cfg <<EOF
346 [DEFAULT]
347 library_dirs = $ATLAS_LIB_DIR
348 include_dirs = $ATLAS_INCLUDE_DIR
349 [blas_opt]
350 libraries = blas, atlas
351 [lapack_opt]
352 libraries = lapack, atlas
353 EOF
354 export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python2.7
355 export ATLAS=$ATLAS_ROOT_PATH
356 python setup.py install --install-lib $INSTALL_DIR/lib/python2.7 --install-scripts $INSTALL_DIR/bin
357 popd
358 rm -rf $wd/*
359 rmdir $wd
360 # Python packages
361 ##install_python_package $INSTALL_DIR numpy 1.7.1 \
362 ## https://pypi.python.org/packages/84/fb/5e9dfeeb5d8909d659e6892c97c9aa66d3798fad50e1d3d66b3c614a9c35/numpy-1.7.1.tar.gz \
363 ## numpy-1.7.1
364 install_python_package $INSTALL_DIR matplotlib 1.3.1 \
365 https://pypi.python.org/packages/d4/d0/17f17792a4d50994397052220dbe3ac9850ecbde0297b7572933fa4a5c98/matplotlib-1.3.1.tar.gz \
366 matplotlib-1.3.1
367 install_python_package $INSTALL_DIR qiime 1.8.0 \
368 https://github.com/biocore/qiime/archive/1.8.0.tar.gz \
369 qiime-1.8.0
370 install_python_package $INSTALL_DIR pycogent 1.5.3 \
371 https://pypi.python.org/packages/1f/9f/c6f6afe09a3d62a6e809c7745413ffff0f1e8e04d88ab7b56faedf31fe28/cogent-1.5.3.tgz \
372 cogent-1.5.3
373 install_python_package $INSTALL_DIR pyqi 0.3.1 \
374 https://pypi.python.org/packages/60/f0/a7392f5f5caf59a50ccaddbb35a458514953512b7dd6053567cb02849c6e/pyqi-0.3.1.tar.gz \
375 pyqi-0.3.1
376 install_python_package $INSTALL_DIR biom-format 1.3.1 \
377 https://pypi.python.org/packages/98/3b/4e80a9a5c4a3c6764aa8c0c994973e7df71eee02fc6b8cc6e1d06a64ab7e/biom-format-1.3.1.tar.gz \
378 biom-format-1.3.1
379 install_python_package $INSTALL_DIR qcli 0.1.0 \
380 https://pypi.python.org/packages/9a/9a/9c634aed339a5f063e0c954ae439d03b33a7159aa50c6f21034fe2d48fe8/qcli-0.1.0.tar.gz \
381 qcli-0.1.0
382 install_python_package $INSTALL_DIR pynast 1.2.2 \
383 https://pypi.python.org/packages/a0/82/f381ff91afd7a2d92e74c7790823e256d87d5cd0a98c12eaac3d3ec64b8f/pynast-1.2.2.tar.gz \
384 pynast-1.2.2
385 install_python_package $INSTALL_DIR emperor 0.9.3 \
386 https://pypi.python.org/packages/cd/f1/5d502a16a348efe1af7a8d4f41b639c9a165bca0b2f9db36bce89ad1ab40/emperor-0.9.3.tar.gz \
387 emperor-0.9.3
388 # Update the acceptable Python version
389 sed -i 's/acceptable_version = (2,7,3)/acceptable_version = (2,7,6)/g' $INSTALL_DIR/bin/print_qiime_config.py
390 # Non-Python dependencies
391 local wd=$(mktemp -d)
392 echo Moving to $wd
393 pushd $wd
394 wget -q http://www.microbesonline.org/fasttree/FastTree
395 chmod 0755 FastTree
396 mv FastTree $INSTALL_DIR/bin
397 # Config file
398 sed -i 's,qiime_scripts_dir,qiime_scripts_dir\t'"$INSTALL_DIR\/bin"',g' $INSTALL_DIR/lib/python2.7/site-packages/qiime/support_files/qiime_config
399 popd
400 rm -rf $wd/*
401 rmdir $wd
402 # Make setup file
403 cat > $INSTALL_DIR/env.sh <<EOF
404 #!/bin/sh
405 # Source this to setup qiime/1.8.0
406 echo Setting up qiime 1.8.0
407 #if [ -f $1/python/2.7.10/env.sh ] ; then
408 # . $1/python/2.7.10/env.sh
409 #fi
410 export QIIME_CONFIG_FP=$INSTALL_DIR/lib/python2.7/site-packages/qiime/support_files/qiime_config
411 export PATH=$INSTALL_DIR/bin:\$PATH
412 export PYTHONPATH=$INSTALL_DIR:\$PYTHONPATH
413 export PYTHONPATH=$INSTALL_DIR/lib:\$PYTHONPATH
414 export PYTHONPATH=$INSTALL_DIR/lib/python2.7:\$PYTHONPATH
415 export PYTHONPATH=$INSTALL_DIR/lib/python2.7/site-packages:\$PYTHONPATH
416 export LD_LIBRARY_PATH=$ATLAS_LIB_DIR:\$LD_LIBRARY_PATH
417 export LD_LIBRARY_PATH=$ATLAS_LIB_DIR/atlas::\$LD_LIBRARY_PATH
418 #
419 EOF
420 }
421 function install_vsearch_1_1_3() {
422 echo Installing vsearch 1.1.3
423 local install_dir=$1/vsearch/1.1.3
424 if [ -f $install_dir/env.sh ] ; then
425 return
426 fi
427 mkdir -p $install_dir/bin
428 local wd=$(mktemp -d)
429 echo Moving to $wd
430 pushd $wd
431 wget -q https://github.com/torognes/vsearch/releases/download/v1.1.3/vsearch-1.1.3-linux-x86_64
432 chmod 0755 vsearch-1.1.3-linux-x86_64
433 mv vsearch-1.1.3-linux-x86_64 $install_dir/bin/vsearch
434 ln -s $install_dir/bin/vsearch $install_dir/bin/vsearch113
435 popd
436 # Clean up
437 rm -rf $wd/*
438 rmdir $wd
439 # Make setup file
440 cat > $install_dir/env.sh <<EOF
441 #!/bin/sh
442 # Source this to setup vsearch/1.1.3
443 echo Setting up vsearch 1.1.3
444 export PATH=$install_dir/bin:\$PATH
445 #
446 EOF
447 }
448 function install_microbiomeutil_2010_04_29() {
449 # Provides ChimeraSlayer
450 echo Installing microbiomeutil 2010-04-29
451 local install_dir=$1/microbiomeutil/2010-04-29
452 if [ -f $install_dir/env.sh ] ; then
453 return
454 fi
455 mkdir -p $install_dir
456 local wd=$(mktemp -d)
457 echo Moving to $wd
458 pushd $wd
459 wget -q https://sourceforge.net/projects/microbiomeutil/files/__OLD_VERSIONS/microbiomeutil_2010-04-29.tar.gz
460 tar zxf microbiomeutil_2010-04-29.tar.gz
461 cd microbiomeutil_2010-04-29
462 make >$install_dir/INSTALLATION.log 2>&1
463 mv * $install_dir
464 popd
465 # Clean up
466 rm -rf $wd/*
467 rmdir $wd
468 # Make setup file
469 cat > $install_dir/env.sh <<EOF
470 #!/bin/sh
471 # Source this to setup microbiomeutil/2010-04-29
472 echo Setting up microbiomeutil 2010-04-29
473 export PATH=$install_dir/ChimeraSlayer:\$PATH
474 #
475 EOF
476 }
477 function install_blast_2_2_26() {
478 echo Installing blast 2.2.26
479 local install_dir=$1/blast/2.2.26
480 if [ -f $install_dir/env.sh ] ; then
481 return
482 fi
483 mkdir -p $install_dir
484 local wd=$(mktemp -d)
485 echo Moving to $wd
486 pushd $wd
487 wget -q ftp://ftp.ncbi.nlm.nih.gov/blast/executables/legacy/2.2.26/blast-2.2.26-x64-linux.tar.gz
488 tar zxf blast-2.2.26-x64-linux.tar.gz
489 cd blast-2.2.26
490 mv * $install_dir
491 popd
492 # Clean up
493 rm -rf $wd/*
494 rmdir $wd
495 # Make setup file
496 cat > $install_dir/env.sh <<EOF
497 #!/bin/sh
498 # Source this to setup blast/2.2.26
499 echo Setting up blast 2.2.26
500 export PATH=$install_dir/bin:\$PATH
501 #
502 EOF
503 }
504 function install_fasta_number() {
505 # See http://drive5.com/python/fasta_number_py.html
506 echo Installing fasta_number
507 # Install to "default" version i.e. essentially a versionless
508 # installation (see Galaxy dependency resolver docs)
509 local install_dir=$1/fasta_number
510 local wd=$(mktemp -d)
511 echo Moving to $wd
512 pushd $wd
513 # Download and use MD5 as local version
514 wget -q http://drive5.com/python/python_scripts.tar.gz
515 local version=$(md5sum python_scripts.tar.gz | cut -d" " -f1)
516 # Check for existing installation
517 local default_dir=$install_dir/default
518 install_dir=$install_dir/$version
519 if [ -f $install_dir/env.sh ] ; then
520 return
521 fi
522 # Install scripts and make 'default' link
523 mkdir -p $install_dir/bin
524 mkdir -p $install_dir/lib
525 tar zxf python_scripts.tar.gz
526 mv fasta_number.py $install_dir/bin
527 mv die.py $install_dir/lib
528 ln -s $version $default_dir
529 popd
530 # Clean up
531 rm -rf $wd/*
532 rmdir $wd
533 # Make setup file
534 cat > $install_dir/env.sh <<EOF
535 #!/bin/sh
536 # Source this to setup fasta_number/$version
537 echo Setting up fasta_number $version
538 export PATH=$install_dir/bin:\$PATH
539 export PYTHONPATH=$install_dir/lib:\$PYTHONPATH
540 #
541 EOF
542 }
543 function install_fasta_splitter_0_2_4() {
544 echo Installing fasta-splitter 0.2.4
545 local install_dir=$1/fasta-splitter/0.2.4
546 if [ -f $install_dir/env.sh ] ; then
547 return
548 fi
549 mkdir -p $install_dir/bin
550 local wd=$(mktemp -d)
551 echo Moving to $wd
552 pushd $wd
553 # Install Perl packages using cpanm
554 mkdir -p $install_dir/lib/perl5
555 wget -q -L https://cpanmin.us/ -O cpanm
556 chmod +x cpanm
557 for package in "File::Util" ; do
558 /bin/bash <<EOF
559 export PATH=$install_dir/bin:$PATH PERL5LIB=$install_dir/lib/perl5:$PERL5LIB && \
560 ./cpanm -l $install_dir $package >>$install_dir/INSTALLATION.log
561 EOF
562 done
563 # Install fasta-splitter
564 wget -q http://kirill-kryukov.com/study/tools/fasta-splitter/files/fasta-splitter-0.2.4.zip
565 unzip -qq fasta-splitter-0.2.4.zip
566 chmod 0755 fasta-splitter.pl
567 mv fasta-splitter.pl $install_dir/bin
568 popd
569 # Clean up
570 rm -rf $wd/*
571 rmdir $wd
572 # Make setup file
573 cat > $install_dir/env.sh <<EOF
574 #!/bin/sh
575 # Source this to setup fasta-splitter/0.2.4
576 echo Setting up fasta-splitter 0.2.4
577 export PATH=$install_dir/bin:\$PATH
578 export PERL5LIB=$install_dir/lib/perl5:\$PERL5LIB
579 #
580 EOF
581 }
582 function install_rdp_classifier_2_2() {
583 echo Installing rdp-classifier 2.2R
584 local install_dir=$1/rdp-classifier/2.2
585 if [ -f $install_dir/env.sh ] ; then
586 return
587 fi
588 mkdir -p $install_dir
589 local wd=$(mktemp -d)
590 echo Moving to $wd
591 pushd $wd
592 wget -q https://sourceforge.net/projects/rdp-classifier/files/rdp-classifier/rdp_classifier_2.2.zip
593 unzip -qq rdp_classifier_2.2.zip
594 cd rdp_classifier_2.2
595 mv * $install_dir
596 popd
597 # Clean up
598 rm -rf $wd/*
599 rmdir $wd
600 # Make setup file
601 cat > $install_dir/env.sh <<EOF
602 #!/bin/sh
603 # Source this to setup rdp-classifier/2.2
604 echo Setting up RDP classifier 2.2
605 export RDP_JAR_PATH=$install_dir/rdp_classifier-2.2.jar
606 #
607 EOF
608 }
609 function install_R_3_2_0() {
610 # Adapted from https://github.com/fls-bioinformatics-core/galaxy-tools/blob/master/local_dependency_installers/R.sh
611 echo Installing R 3.2.0
612 local install_dir=$1/R/3.2.0
613 if [ -f $install_dir/env.sh ] ; then
614 return
615 fi
616 mkdir -p $install_dir
617 local wd=$(mktemp -d)
618 echo Moving to $wd
619 pushd $wd
620 wget -q http://cran.r-project.org/src/base/R-3/R-3.2.0.tar.gz
621 tar xzf R-3.2.0.tar.gz
622 cd R-3.2.0
623 ./configure --prefix=$install_dir
624 make
625 make install
626 popd
627 # Clean up
628 rm -rf $wd/*
629 rmdir $wd
630 # Make setup file
631 cat > $install_dir/env.sh <<EOF
632 #!/bin/sh
633 # Source this to setup R/3.2.0
634 echo Setting up R 3.2.0
635 export PATH=$install_dir/bin:\$PATH
636 export TCL_LIBRARY=$install_dir/lib/libtcl8.4.so
637 export TK_LIBRARY=$install_dir/lib/libtk8.4.so
638 #
639 EOF
640 }
641 function install_uc2otutab() {
642 # See http://drive5.com/python/uc2otutab_py.html
643 echo Installing uc2otutab
644 # Install to "default" version i.e. essentially a versionless
645 # installation (see Galaxy dependency resolver docs)
646 local install_dir=$1/uc2otutab/default
647 if [ -f $install_dir/env.sh ] ; then
648 return
649 fi
650 mkdir -p $install_dir/bin
651 local wd=$(mktemp -d)
652 echo Moving to $wd
653 pushd $wd
654 wget -q http://drive5.com/python/python_scripts.tar.gz
655 tar zxf python_scripts.tar.gz
656 mv die.py fasta.py progress.py uc.py $install_dir/bin
657 echo "#!/usr/bin/env python" >$install_dir/bin/uc2otutab.py
658 cat uc2otutab.py >>$install_dir/bin/uc2otutab.py
659 chmod +x $install_dir/bin/uc2otutab.py
660 popd
661 # Clean up
662 rm -rf $wd/*
663 rmdir $wd
664 # Make setup file
665 cat > $install_dir/env.sh <<EOF
666 #!/bin/sh
667 # Source this to setup uc2otutab/default
668 echo Setting up uc2otutab \(default\)
669 export PATH=$install_dir/bin:\$PATH
670 #
671 EOF
672 }
673 ##########################################################
674 # Main script starts here
675 ##########################################################
676 # Fetch top-level installation directory from command line
677 TOP_DIR=$1
678 if [ -z "$TOP_DIR" ] ; then
679 echo Usage: $(basename $0) DIR
680 exit
681 fi
682 if [ -z "$(echo $TOP_DIR | grep ^/)" ] ; then
683 TOP_DIR=$(pwd)/$TOP_DIR
684 fi
685 if [ ! -d "$TOP_DIR" ] ; then
686 mkdir -p $TOP_DIR
687 fi
688 # Install dependencies
689 install_amplicon_analysis_pipeline_1_1 $TOP_DIR
690 install_cutadapt_1_11 $TOP_DIR
691 install_sickle_1_33 $TOP_DIR
692 install_bioawk_27_08_2013 $TOP_DIR
693 install_pandaseq_2_8_1 $TOP_DIR
694 install_spades_3_5_0 $TOP_DIR
695 install_fastqc_0_11_3 $TOP_DIR
696 install_qiime_1_8_0 $TOP_DIR
697 install_vsearch_1_1_3 $TOP_DIR
698 install_microbiomeutil_2010_04_29 $TOP_DIR
699 install_blast_2_2_26 $TOP_DIR
700 install_fasta_number $TOP_DIR
701 install_fasta_splitter_0_2_4 $TOP_DIR
702 install_rdp_classifier_2_2 $TOP_DIR
703 install_R_3_2_0 $TOP_DIR
704 install_uc2otutab $TOP_DIR
705 ##
706 #