comparison Roary/install_dependencies.sh @ 0:c47a5f61bc9f draft

Uploaded
author dereeper
date Fri, 14 May 2021 20:27:06 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c47a5f61bc9f
1 #!/bin/bash
2
3 set -x
4 set -eu
5
6 start_dir=$(pwd)
7 ROARY_LIB_DIR="${start_dir}/lib"
8 ROARY_BIN_DIR="${start_dir}/bin"
9
10 PARALLEL_VERSION=${PARALLEL_VERSION:-"20160722"}
11 PARALLEL_DOWNLOAD_FILENAME="parallel-${PARALLEL_VERSION}.tar.bz2"
12 PARALLEL_URL="http://ftp.gnu.org/gnu/parallel/${PARALLEL_DOWNLOAD_FILENAME}"
13
14 BEDTOOLS_VERSION="2.27.1"
15 BEDTOOLS_DOWNLOAD_FILENAME="bedtools-${BEDTOOLS_VERSION}.tar.gz"
16 BEDTOOLS_URL="https://github.com/arq5x/bedtools2/releases/download/v${BEDTOOLS_VERSION}/${BEDTOOLS_DOWNLOAD_FILENAME}"
17
18 CDHIT_SHORT_VERSION="4.6.8"
19 CDHIT_LONG_VERSION="4.6.8-2017-0621"
20 CDHIT_DOWNLOAD_FILENAME="cd-hit-${CDHIT_SHORT_VERSION}.tar.gz"
21 CDHIT_URL="https://github.com/weizhongli/cdhit/releases/download/V${CDHIT_SHORT_VERSION}/cd-hit-v${CDHIT_LONG_VERSION}-source.tar.gz"
22
23 PRANK_VERSION="0.140603"
24 PRANK_DOWNLOAD_FILENAME="prank-msa-master.tar.gz"
25 PRANK_URL="https://github.com/ariloytynoja/prank-msa/archive/master.tar.gz"
26
27 BLAST_VERSION="2.6.0"
28 BLAST_DOWNLOAD_FILENAME="ncbi-blast-${BLAST_VERSION}+-x64-linux.tar.gz"
29 BLAST_URL="ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/${BLAST_VERSION}/${BLAST_DOWNLOAD_FILENAME}"
30
31 MCL_VERSION="14-137"
32 MCL_DOWNLOAD_FILENAME="mcl-${MCL_VERSION}.tar.gz"
33 MCL_URL="http://micans.org/mcl/src/mcl-${MCL_VERSION}.tar.gz"
34
35 FASTTREE_VERSION="2.1.10"
36 FASTTREE_DOWNLOAD_FILENAME="FastTree-${FASTTREE_VERSION}.c"
37 FASTTREE_URL="http://microbesonline.org/fasttree/FastTree-${FASTTREE_VERSION}.c"
38
39 MAFFT_VERSION="7.310"
40 MAFFT_DOWNLOAD_FILENAME="mafft-${MAFFT_VERSION}-without-extensions-src.tgz"
41 MAFFT_URL="http://mafft.cbrc.jp/alignment/software/${MAFFT_DOWNLOAD_FILENAME}"
42
43 # Make an install location
44 if [ ! -d 'build' ]; then
45 mkdir build
46 fi
47 cd build
48 build_dir=$(pwd)
49
50 PARALLEL_DOWNLOAD_PATH="$(pwd)/${PARALLEL_DOWNLOAD_FILENAME}"
51 BEDTOOLS_DOWNLOAD_PATH="$(pwd)/${BEDTOOLS_DOWNLOAD_FILENAME}"
52 CDHIT_DOWNLOAD_PATH="$(pwd)/${CDHIT_DOWNLOAD_FILENAME}"
53 PRANK_DOWNLOAD_PATH="$(pwd)/${PRANK_DOWNLOAD_FILENAME}"
54 BLAST_DOWNLOAD_PATH="$(pwd)/${BLAST_DOWNLOAD_FILENAME}"
55 MCL_DOWNLOAD_PATH="$(pwd)/${MCL_DOWNLOAD_FILENAME}"
56 FASTTREE_DOWNLOAD_PATH="$(pwd)/${FASTTREE_DOWNLOAD_FILENAME}"
57 MAFFT_DOWNLOAD_PATH="$(pwd)/${MAFFT_DOWNLOAD_FILENAME}"
58
59 PARALLEL_BUILD_DIR="$(pwd)/parallel-${PARALLEL_VERSION}"
60 BEDTOOLS_BUILD_DIR="$(pwd)/bedtools2"
61 CDHIT_BUILD_DIR="$(pwd)/cd-hit-v${CDHIT_LONG_VERSION}"
62 PRANK_BUILD_DIR="$(pwd)/prank-msa-master"
63 BLAST_BUILD_DIR="$(pwd)/ncbi-blast-${BLAST_VERSION}+"
64 MCL_BUILD_DIR="$(pwd)/mcl-${MCL_VERSION}"
65 FASTTREE_BUILD_DIR="$(pwd)/fasttree"
66 MAFFT_BUILD_DIR="$(pwd)/mafft-${MAFFT_VERSION}-without-extensions"
67
68
69 download () {
70 download_url=$1
71 download_path=$2
72 cd $build_dir
73 if [ -e "$download_path" ]; then
74 echo "Skipping download of $download_url, $download_path already exists"
75 else
76 echo "Downloading $download_url to $download_path"
77 wget $download_url -O $download_path
78 pwd
79 fi
80 }
81
82 untar () {
83 to_untar=$1
84 expected_directory=$2
85 if [ -d "$expected_directory" ]; then
86 rm -rf $expected_directory
87 fi
88 echo "Untarring $to_untar to $expected_directory"
89 cd $build_dir
90 tar xzvf $to_untar
91 rm $to_untar
92 pwd
93 }
94
95 if [ -e "$BLAST_BUILD_DIR/bin/blastp" ]; then
96 echo "blast already untarred to $BLAST_BUILD_DIR, skipping"
97 else
98 download $BLAST_URL $BLAST_DOWNLOAD_PATH
99 untar $BLAST_DOWNLOAD_PATH $BLAST_BUILD_DIR
100 fi
101
102 # Build parallel
103 if [ -e "$PARALLEL_BUILD_DIR/src/parallel" ]; then
104 echo "Parallel already built, skipping"
105 else
106 download $PARALLEL_URL $PARALLEL_DOWNLOAD_PATH
107 echo "Untarring parallel to $PARALLEL_BUILD_DIR"
108 tar xjvf $PARALLEL_DOWNLOAD_PATH
109 echo "Building parallel"
110 cd $PARALLEL_BUILD_DIR
111 ./configure
112 make
113 fi
114
115 # Build bedtools
116 if [ -e "$BEDTOOLS_BUILD_DIR/bin/bedtools" ]; then
117 echo "Bedtools already built, skipping"
118 else
119
120 download $BEDTOOLS_URL $BEDTOOLS_DOWNLOAD_PATH
121 untar $BEDTOOLS_DOWNLOAD_PATH $BEDTOOLS_BUILD_DIR
122 cd $BEDTOOLS_BUILD_DIR
123 echo "Building bedtools"
124 ls -alrt
125 make
126 fi
127
128 # Build cd-hit
129 if [ -e "$CDHIT_BUILD_DIR/cd-hit" ]; then
130 echo "cd-hit already built, skipping"
131 else
132 download $CDHIT_URL $CDHIT_DOWNLOAD_PATH
133 untar $CDHIT_DOWNLOAD_PATH $CDHIT_BUILD_DIR
134 echo "Building cd-hit"
135 cd $CDHIT_BUILD_DIR
136 make
137 fi
138
139 # Build prank
140 if [ -e "$PRANK_BUILD_DIR/src/prank" ]; then
141 echo "prank already built, skipping"
142 else
143 download $PRANK_URL $PRANK_DOWNLOAD_PATH
144 untar $PRANK_DOWNLOAD_PATH $PRANK_BUILD_DIR
145 echo "Building prank"
146 cd $PRANK_BUILD_DIR
147 cd src
148 make
149 fi
150
151 # Build MCL
152 if [ -e "$MCL_BUILD_DIR/src/shmcl/mcl" ]; then
153 echo "MCL already built, skipping"
154 else
155 download $MCL_URL $MCL_DOWNLOAD_PATH
156 untar $MCL_DOWNLOAD_PATH $MCL_BUILD_DIR
157 echo "Building MCL"
158 cd $MCL_BUILD_DIR
159 ./configure
160 make
161 fi
162
163 # Build FastTree
164 if [ -e "$FASTTREE_BUILD_DIR/FastTree" ]; then
165 echo "FastTree already built, skipping"
166 else
167 download $FASTTREE_URL $FASTTREE_DOWNLOAD_PATH
168 mkdir -p $FASTTREE_BUILD_DIR
169 mv $FASTTREE_DOWNLOAD_FILENAME $FASTTREE_BUILD_DIR
170 cd $FASTTREE_BUILD_DIR
171 echo "Building FastTree"
172 gcc -o FastTree FastTree-${FASTTREE_VERSION}.c -lm
173 fi
174
175 export MAFFT_INSTALL_DIR="${MAFFT_BUILD_DIR}/build"
176 # Build MAFFT
177 if [ -e "$MAFFT_BUILD_DIR/build/mafft" ]; then
178 echo "MAFFT already built, skipping"
179 else
180 download $MAFFT_URL $MAFFT_DOWNLOAD_PATH
181 untar $MAFFT_DOWNLOAD_PATH $MAFFT_BUILD_DIR
182 echo "Building MAFFT"
183 cd $MAFFT_BUILD_DIR
184 mkdir -p $MAFFT_INSTALL_DIR
185 cd core
186 sed -i '1s!.*!PREFIX = $(MAFFT_INSTALL_DIR)!' Makefile
187 make
188 make install
189 fi
190
191
192 # Add things to PATH
193 update_path () {
194 new_dir=$1
195 if [[ ! "$PATH" =~ (^|:)"${new_dir}"(:|$) ]]; then
196 echo "export PATH=${new_dir}:${PATH}"
197 export PATH=${new_dir}:${PATH}
198 fi
199 }
200
201 export PATH
202 PARALLEL_BIN_DIR="$PARALLEL_BUILD_DIR/src"
203 update_path $PARALLEL_BIN_DIR
204 BEDTOOLS_BIN_DIR="$BEDTOOLS_BUILD_DIR/bin"
205 update_path $BEDTOOLS_BIN_DIR
206 CDHIT_BIN_DIR="$CDHIT_BUILD_DIR"
207 update_path $CDHIT_BIN_DIR
208 PRANK_BIN_DIR="$PRANK_BUILD_DIR/src"
209 update_path $PRANK_BIN_DIR
210
211 BLAST_BIN_DIR="$BLAST_BUILD_DIR/bin"
212 update_path $BLAST_BIN_DIR
213
214 MCL_BIN_DIR="$MCL_BUILD_DIR/src/shmcl"
215 update_path $MCL_BIN_DIR
216 MCL_BIN_DIR_2="$MCL_BUILD_DIR/src/alien/oxygen/src"
217 update_path $MCL_BIN_DIR_2
218
219 FASTTREE_BIN_DIR=$FASTTREE_BUILD_DIR
220 update_path $FASTTREE_BIN_DIR
221 MAFFT_BIN_DIR="$MAFFT_INSTALL_DIR/bin"
222 update_path $MAFFT_BIN_DIR
223
224 update_perl_path () {
225 new_dir=$1
226 PERL5LIB=${PERL5LIB-$new_dir}
227 if [[ ! "$PERL5LIB" =~ (^|:)"${new_dir}"(:|$) ]]; then
228 echo "export PERL5LIB=${new_dir}:${PERL5LIB}"
229 export PERL5LIB=${new_dir}:${PERL5LIB}
230 fi
231 }
232
233 BEDTOOLS_LIB_DIR="$BEDTOOLS_BUILD_DIR/lib"
234 update_perl_path $BEDTOOLS_LIB_DIR
235
236 cd $start_dir
237 cpanm --notest Dist::Zilla
238 dzil authordeps --missing | cpanm --notest
239 dzil listdeps --missing | cpanm --notest
240
241 cd $start_dir
242
243 echo "Add the following lines to one of these files ~/.bashrc or ~/.bash_profile or ~/.profile"
244 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}"
245 echo "export PERL5LIB=${ROARY_LIB_DIR}:${BEDTOOLS_LIB_DIR}:${PERL5LIB}"
246
247 set +eu
248 set +x