forked from LinkageIO/Camoco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·304 lines (276 loc) · 8.48 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
#!/usr/bin/env bash
# Script to setup camoco in an anaconda environment
# Written by Joe Jeffers and Rob Schaefer
# Email: [email protected], [email protected]
function usage(){
cat <<EOF
Usage: $0 [flags]
Flags
-----
-h | --help
print help message
-b | --base
Base installation directory for camoco (default: ~/.camoco).
EOF
exit 0
}
# Configurable variables
BASE=$HOME/.camoco
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
PLATFORM=`uname`
function red(){
printf "${RED}$1${NC}\n"
}
function green(){
printf "${GREEN}$1${NC}\n"
}
while [[ $# > 0 ]]
do
key="$1"
case $key in
-h|--help)
usage
shift
;;
-b|--base)
BASE=$2
shift
;;
*)
#unknown options
;;
esac
shift
done
NAME="camoco"
#===================================================
#----------Check for internet connection------------
#===================================================
wget -q --tries=10 --timeout=20 --spider http://github.com
if [[ $? -ne 0 ]]; then
echo "Check your internet connection and try again."
exit
fi
export CWD=$(pwd)
#===================================================
#----------Setup the build Environment--------------
#===================================================
echo "Setting up the build environment"
source $HOME/.bashrc
mkdir -p $BASE
mkdir -p $BASE/conda
mkdir -p $BASE/bin
mkdir -p $BASE/lib
cd $BASE
export LD_LIBRARY_PATH=$BASE/lib:$LD_LIBRARY_PATH
export PATH=$PATH:$BASE/bin:$BASE/conda/bin
#===================================================
#----------------Install conda ---------------------
#===================================================
# if ! hash conda 2>/dev/null
if [ ! -e $BASE/conda/bin/conda ]
then
cd $BASE
if [[ "$PLATFORM" == 'Darwin' ]]
then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
fi
bash miniconda.sh -b -f -p $BASE/conda
rm -f miniconda.sh
else
green "Conda Already Installed"
fi
#===================================================
#----------------Install git lfs--------------------
#===================================================
# if ! hash git-lfs 2>/dev/null ; then
# echo "Installing git-lfs for the large files in the repo"
# cd $BASE
# wget https://github.com/github/git-lfs/releases/download/v1.1.0/git-lfs-linux-amd64-1.1.0.tar.gz
# tar xzf git-lfs-linux-amd64-1.1.0.tar.gz
# rm -rf git-lfs-linux-amd64-1.1.0.tar.gz
# cd git-lfs-1.1.0/
# rm -rf $BASE/bin/git-lfs*
# mv git-lfs $BASE/bin/
# cd $BASE
# rm -rf git-lfs*
# git lfs install
# git lfs uninstall
# else
# green "Git-lfs already installed"
# fi
# ===================================================
# ------------------Install mcl----------------------
# ===================================================
if [ ! -e $BASE/bin/mcl ]
then
echo "Installing mcl locally"
cd $BASE
wget http://micans.org/mcl/src/mcl-latest.tar.gz
echo "Extracting the taball"
tar xzf mcl-latest.tar.gz
rm -rf mcl-latest.tar.gz
cd $(find . -name 'mcl-*' -type d | head -n 1)
./configure --prefix=$BASE
make
make install
cd $BASE
rm -rf $(find . -name 'mcl-*' -type d | head -n 1)
else
green 'mcl already installed'
fi
#===================================================
#-----Install libraries to Ensure Smoothness--------
#===================================================
# if [[ "$PLATFORM" != 'Darwin' ]]
# then
# if [ ! -e $BASE/bin/icu-config ]
# then
# echo "Installing a local version of the icu library"
# cd $BASE
# wget http://archive.ubuntu.com/ubuntu/pool/main/i/icu/icu_4.8.1.1.orig.tar.gz
# echo "Extracting the tarball"
# tar xzf icu_4.8.1.1.orig.tar.gz
# rm -rf icu_4.8.1.1.orig.tar.gz
# cd icu/source
# ./configure --prefix=$BASE
# make
# make install
# cd $BASE
# rm -rf icu/
# else
# green "icu already installed"
# fi
# fi
# if [ ! -e $BASE/lib/libqhull.so ]
# then
# echo "Installing a local version of the qhull library"
# cd $BASE
# wget http://www.qhull.org/download/qhull-2012.1-src.tgz
# echo "Extracting the tarball"
# tar xzf qhull-2012.1-src.tgz
# rm -rf qhull-2012.1-src.tgz
# cd qhull-2012.1
# make
# mv bin/* $BASE/bin/
# mv lib/* $BASE/lib/
# ln -s $BASE/lib/libqhull.so $BASE/lib/libqhull.so.5
# cd $BASE
# rm -rf qhull-2012.1/
# else
# green 'qhull already installed'
# fi
#===================================================
#----------Build the Conda Environment--------------
#===================================================
if [ ! -d $BASE/conda/envs/camoco ]
then
echo "Making the conda virtual environment named $NAME in $BASE"
conda remove -y --name $NAME --all
conda config --add envs_dirs $BASE/conda/envs
conda config --append channels conda-forge
conda config --append channels blaze
conda create -y -n $NAME python=3 setuptools pip cython numpy scipy pandas \
matplotlib blaze nose six pyyaml yaml pyparsing python-dateutil \
pytz numexpr patsy statsmodels networkx=1.11 mpmath termcolor scikit-learn \
ipython ipdb pytest-cov flask gunicorn apsw
else
green 'conda already installed'
fi
#===================================================
#----------Activate the Conda Environment-----------
#===================================================
green "activating $NAME"
source $BASE/conda/bin/activate $NAME
green 'checking python'
which python
# ==================================================
# ----------Take care of some pip packages ---------
# ==================================================
python -c 'import powerlaw'
if [ $? -eq 1 ]
then
pip install powerlaw
else
green "powerlaw Installed"
fi
python -c 'import bcolz'
if [ $? -eq 1 ]
then
pip install bcolz
else
green "bcolz Installed"
fi
python -c 'import GeneWordSearch'
if [ $? -eq 1 ]
then
pip install GeneWordSearch
else
green "GeneWordSearch Installed"
fi
#===================================================
#-----------------Install apsw----------------------
#===================================================
# python -c 'import apsw'
# if [ $? -eq 1 ]
# then
# echo "Installing apsw into the conda environment"
# #cd $BASE
# #rm -rf apsw
# #git clone https://github.com/rogerbinns/apsw.git
# #cd apsw
# #python setup.py fetch --version=3.15.2 --missing-checksum-ok --all build --enable-all-extensions install
# #cd $BASE
# #rm -rf apsw
# pip install --user https://github.com/rogerbinns/apsw/releases/download/3.15.2-r1/apsw-3.15.2-r1.zip \
# --global-option=fetch --global-option=--version --global-option=3.15.2 --global-option=--all \
# --global-option=build --global-option=--enable-all-extensions
# else
# green "apsw installed"
# fi
#==================================================
#---------------Update Setuptools------------------
#==================================================
#pip install setuptools --upgrade
#==================================================
#-----------------Install Camoco-------------------
#=================================================
green "Installing Camoco"
cd $CWD
python setup.py install
python -c 'import camoco'
if [ $? -eq 1 ]
then
red 'Camoco failed to install!'
exit 1
else
green 'Camoco installed!'
fi
source deactivate
#===================================================
#------------Update the bashrc----------------------
#===================================================
# if [ $(grep $BASE/conda/bin ~/.bashrc | wc -l) -eq 0 ]
# then
# red '-----------------------------------------------'
# red "Update your $HOME/.bashrc:"
# echo "export LD_LIBRARY_PATH=$BASE/lib:\$LD_LIBRARY_PATH"
# echo "export PATH=$BASE/bin:$BASE/conda/bin:\$PATH"
# red '-----------------------------------------------'
# fi
#===================================================
#-------------Use Instructions----------------------
#===================================================
# green '==============================================='
# echo "All done, to use camoco, first restart the shell."
# echo "Then type: source activate $NAME"
# echo 'Start with the Camoco manual page: camoco --help'
# echo "When finished, type: source deactivate"
echo ""
echo ""
echo "Please report all bugs to: https://github.com/schae234/Camoco/issues"
# green '==============================================='