-
Notifications
You must be signed in to change notification settings - Fork 51
/
install_dependencies.sh
executable file
·179 lines (153 loc) · 4.12 KB
/
install_dependencies.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
#!/bin/bash
set -x
set -e
start_dir=$(pwd)
# Determine OS type
OS="Linux"
if [[ $OSTYPE == "darwin"* ]]; then
OS="OSX"
fi
# Alias wget on OSX
if [[ $OS == "OSX" ]]; then
function _wget() { curl "${1}" -o $(basename "${1}") ; };
alias wget='_wget'
fi
# Get tree builder options
RAXML_VERSION="8.2.12"
FASTTREE_VERSION="2.1.11"
IQTREE_VERSION="2.0.3"
RAXMLNG_VERSION="1.0.1"
RAPIDNJ_VERSION="2.3.2"
RAXML_DIR="standard-RAxML-$RAXML_VERSION"
RAXML_ZIP_FILE="$RAXML_DIR.tar.gz"
IQTREE_DIR=""
IQTREE_ZIP_FILE=""
if [[ $OS == "Linux" ]]; then
IQTREE_DIR="iqtree-$IQTREE_VERSION-Linux"
IQTREE_ZIP_FILE="$IQTREE_DIR.tar.gz"
elif [[ $OS == "OSX" ]]; then
IQTREE_DIR="iqtree-$IQTREE_VERSION-MacOSX"
IQTREE_ZIP_FILE="$IQTREE_DIR.zip"
fi
FASTTREE_DIR="FastTree-$FASTTREE_VERSION"
FASTTREE_SOURCE="$FASTTREE_DIR.c"
RAXMLNG_DIR="raxmlng_dir"
RAXMLNG_ZIP_FILE=""
if [[ $OS == "Linux" ]]; then
RAXMLNG_ZIP_FILE="raxml-ng_v${RAXMLNG_VERSION}_linux_x86_64.zip"
elif [[ $OS == "OSX" ]]; then
RAXMLNG_ZIP_FILE="raxml-ng_v${RAXMLNG_VERSION}_macos_x86_64.zip"
fi
RAPIDNJ_DIR="rapidnj-$RAPIDNJ_VERSION"
RAPIDNJ_ZIP_FILE="$RAPIDNJ_VERSION.zip"
RAXML_DOWNLOAD_URL="https://github.com/stamatak/standard-RAxML/archive/v$RAXML_VERSION.tar.gz"
FASTTREE_DOWNLOAD_URL="http://www.microbesonline.org/fasttree/$FASTTREE_SOURCE"
IQTREE_DOWNLOAD_URL="https://github.com/Cibiv/IQ-TREE/releases/download/v$IQTREE_VERSION/$IQTREE_ZIP_FILE"
RAXMLNG_DOWNLOAD_URL="https://github.com/amkozlov/raxml-ng/releases/download/$RAXMLNG_VERSION/$RAXMLNG_ZIP_FILE"
RAPIDNJ_DOWNLOAD_URL="https://github.com/johnlees/rapidnj/archive/$RAPIDNJ_ZIP_FILE"
# Make an install location
if [ ! -d 'build' ]; then
mkdir build
fi
cd build
build_dir=$(pwd)
# DOWNLOAD ALL THE THINGS
download () {
url=$1
download_location=$2
if [ -e $download_location ]; then
echo "Skipping download of $url, $download_location already exists"
else
echo "Downloading $url to $download_location"
wget $url -O $download_location
fi
}
download $RAXML_DOWNLOAD_URL $RAXML_ZIP_FILE
download $FASTTREE_DOWNLOAD_URL $FASTTREE_SOURCE
download $IQTREE_DOWNLOAD_URL $IQTREE_ZIP_FILE
download $RAXMLNG_DOWNLOAD_URL $RAXMLNG_ZIP_FILE
download $RAPIDNJ_DOWNLOAD_URL $RAPIDNJ_ZIP_FILE
# Update dependencies
if [[ "$OS" == 'Linux' ]]; then
sudo apt-get update -q
sudo apt-get install -y -q autoconf \
check \
g++ \
libtool \
libsubunit-dev \
pkg-config \
python-dev
fi
# Build all the things
## RAxML
cd $build_dir
if [ ! -d $RAXML_DIR ]; then
tar xzf $RAXML_ZIP_FILE
fi
cd $RAXML_DIR
if [ -e "raxmlHPC" ]; then
echo "Already built single-processor RAxML; skipping build"
else
make -f Makefile.gcc
fi
if [ -e "raxmlHPC-PTHREADS" ]; then
echo "Already built multi-processor RAxML; skipping build"
else
make -f Makefile.PTHREADS.gcc
fi
## FastTree
cd $build_dir
if [ ! -d $FASTTREE_DIR ]; then
mkdir $FASTTREE_DIR
fi
cd $FASTTREE_DIR
if [ -e "$FASTTREE_DIR/FastTree" ]; then
echo "Skipping, FastTree already exists"
else
gcc -O3 -finline-functions -funroll-loops -Wall -o FastTree $build_dir/$FASTTREE_SOURCE -lm
fi
## IQTree
cd $build_dir
if [ ! -d $IQTREE_DIR ]; then
if [[ $OS == "Linux" ]]; then
tar xzf $IQTREE_ZIP_FILE
elif [[ $OS == "OSX" ]]; then
unzip $IQTREE_ZIP_FILE
fi
fi
cd $IQTREE_DIR
if [ -e "bin/iqtree" ]; then
cp bin/iqtree iqtree
fi
## RAxML-NG
cd $build_dir
if [ ! -d $RAXMLNG_DIR ]; then
mkdir $RAXMLNG_DIR
fi
unzip $RAXMLNG_ZIP_FILE
mv raxml-ng $RAXMLNG_DIR
## RapidNJ
cd $build_dir
if [ ! -d $RAPIDNJ_DIR ]; then
unzip $RAPIDNJ_ZIP_FILE
fi
cd $RAPIDNJ_DIR
make
if [ -e "bin/rapidnj" ]; then
cp bin/rapidnj rapidnj
fi
# Setup environment variables
update_path () {
new_dir=$1
if [[ ! "$PATH" =~ (^|:)"${new_dir}"(:|$) ]]; then
export PATH=${new_dir}:${PATH}
fi
}
update_path $build_dir/$RAXML_DIR
update_path $build_dir/$FASTTREE_DIR
update_path $build_dir/$IQTREE_DIR
update_path $build_dir/$RAXMLNG_DIR
update_path $build_dir/$RAPIDNJ_DIR
cd $start_dir
set +x
set +e