forked from saezlab/pypath
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mac-install-conda.sh
175 lines (157 loc) · 4.8 KB
/
mac-install-conda.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
#!/bin/bash
#
# This file is part of the `pypath` python module
#
# Copyright
# 2014-2018
# EMBL, EMBL-EBI, Uniklinik RWTH Aachen, Heidelberg University
#
# File author(s): Dénes Türei ([email protected])
# Nicolas Palacio
#
# Distributed under the GPLv3 License.
# See accompanying file LICENSE.txt or copy at
# http://www.gnu.org/licenses/gpl-3.0.html
#
# Website: http://pypath.omnipathdb.org/
#
#
# Tested on OS X 10.11.3
#
# help message
USAGE="Usage:\n\t$0\n\t\t[-h (show help and exit)]\n\t\t[-p <2|3> (Python version)]\n\t\t"\
"[-c (do not install cairo)]\n\t\t[-g (do not install graphviz)]\n\t\t"\
"[-t (run tests only)]\n\t\t-a <Anaconda path, e.g. ~/anaconda3>\n\n"
# default options
PYMAINVER="3"
INSTALL=true
TESTS=true
ICAIRO=true
IGRAPHVIZ=true
# processing cli arguments
while getopts ":htp:c:" opt;
do
case $opt in
h)
echo -en "$USAGE"
exit 0
;;
t)
INSTALL=false
;;
a)
CONDAROOT="${OPTARG}"
;;
p)
PYMAINVER="${OPTARG}"
;;
c)
ICAIRO=false
;;
g)
IGRAPHVIZ=false
;;
?)
echo -en "$USAGE"
exit 2
;;
esac
done
if [ -z "${CONDAROOT+x}" ];
then
if [[ $PYMAINVER == "3" ]];
then
CONDAINS="Anaconda3-4.1.1-MacOSX-x86_64.sh"
CONDABIN="$HOME/anaconda3/bin"
CONDAURL="http://repo.continuum.io/archive/Anaconda3-4.1.1-MacOSX-x86_64.sh"
PYFABRIC="fabric3"
else
CONDAINS="Anaconda2-4.1.1-MacOSX-x86_64.sh"
CONDABIN="$HOME/anaconda2/bin"
CONDAURL="http://repo.continuum.io/archive/Anaconda2-4.1.1-MacOSX-x86_64.sh"
PYFABRIC="fabric"
fi
else
CONDABIN="$CONDAROOT/bin"
CONDA="$CONDABIN/conda"
CONDAPIP="$CONDABIN/pip"
fi
CONDA="$CONDABIN/conda"
CONDAPIP="$CONDABIN/pip"
CONDAPY="$CONDABIN/python"
PYPATHURL="http://pypath.omnipathdb.org/releases/latest/pypath-latest.tar.gz"
if [[ "$INSTALL" == "true" ]];
then
echo -en "\n\n===[ Attempting to install pypath and all its dependencies with the help of Anaconda. ]===\n\n"
echo -en "\t Note: this method works on most of the Mac computers."\
" Watch out for errors, and the test results post installation.\n\t"\
" This will take a couple of minutes. Now relax, and hope the best.\n\n"
if [ ! -d $CONDABIN ];
then
if [ ! -f $CONDAINS ];
then
curl -LO $CONDAURL
fi
chmod +x $CONDAINS
bash ./$CONDAINS -b
fi
# optionally installing (py)cairo
if [[ "$ICAIRO" == "true" ]];
then
$CONDA install -y -c vgauthier cairo=1.12.18
if [[ "$PYMAINVER" == "3" ]];
then
$CONDA install -y -c richlewis pycairo=1.10.0
else
$CONDA install -y -c pkgw/label/superseded py2cairo
fi
fi
$CONDA install -y pymysql
# optionally install (py)graphviz
if [[ "$IGRAPHVIZ" == "true" ]];
then
$CONDA install -y graphviz
$CONDA install -y -c omnia pygraphviz
fi
# installing igraph
$CONDA install -y -c marufr python-igraph
if [[ $PYMAINVER == "3" ]];
then
$CONDAPIP install git+https://github.com/brentp/fishers_exact_test.git
fi
$CONDAPIP install $PYFABRIC
$CONDAPIP install pysftp
$CONDAPIP install future
$CONDAPIP install bioservices
$CONDAPIP install tqdm
$CONDAPIP install $PYPATHURL
fi
# beginning part `TESTS`
if [[ "$TESTS" == "true" ]];
then
# check and report:
echo -en "\n\n\t===[ Testing installation ]===\n\n"
declare -a modules=(cairo igraph future numpy scipy pandas suds bioservices pymysql pygraphviz fisher pysftp fabric tqdm pypath)
for mod in "${modules[@]}"
do
$CONDAPY -c "import $mod" >/dev/null 2>&1
if [[ $? == 0 ]];
then
echo -en "\t [ OK ] Module \`$mod\` for Python $PYMAINVER is available.\n"
else
echo -en "\t [ !! ] Module \`$mod\` for Python $PYMAINVER failed to install.\n"
fi
done
$CONDAPY -c "import pypath; pa = pypath.PyPath()" >/dev/null 2>&1
if [[ $? == 0 ]];
then
echo -en "\t [ OK ] Congratulations! You have pypath installed! :)\n"\
"\t The authors wish you interesting findings in your analysis.\n"\
"\t If you experience any issue, don't hesitate to contact [email protected].\n\n"
else
echo -en "\t [ !! ] You have no pypath installed or some issue avoids the module to load.\n"\
"\t Please check the list above for failed items. Contact [email protected] if you need help.\n\n"
fi
# end of part `TESTS`
fi
echo -en "\n===[ Tasks complete. Please report any issue to [email protected]. Bye. ]===\n\n"