-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_new_cellprofiler.sh
executable file
·182 lines (152 loc) · 4.86 KB
/
install_new_cellprofiler.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
#!/bin/bash
################################################################################
######### Script to install cellprofiler into an anaconda environment. #########
################################################################################
#
# Need to run this in qlogin session, with around 8GB of memory:
#
# >>> qlogin -l h_vmem=8G
#
# then find this script and run:
#
# >>> ./install_new_cellprofiler.sh
#
# It should take a few minutes, and looks like it's frozen after downloading
# scikit-image, but it's fine.
#
# You'll also have to re-install cptools2 for the generated analysis scripts to
# point to the new anaconda environment.
# >>> module load python
# >>> cd /exports/igmm/eddie/Drug-Discovery/tools/cptools2
# >>> python setup.py install --user
#
################################################################################
# this makes sure ctrl-c properly stops the script
trap "exit" INT
set -e
# exit the install script if anything fails
# load anaconda
module load anaconda/5.0.1
ENV_NAME=cellprofiler
GROUP_NAME=igmm_datastore_Drug-Discovery
DRUG_DISCOVERY_PREFIX=/exports/igmm/eddie/Drug-Discovery
# check user is in the Drug-Discovery group
if groups "$USER" | grep -qw "$GROUP_NAME"
then
if [ ! -d "DRUG_DISCOVERY_PREFIX"/"$USER" ]; then
mkdir "$DRUG_DISCOVERY_PREFIX"/"$USER"
fi
CONDA_PKGS=""$DRUG_DISCOVERY_PREFIX"/"$USER"/.conda_pkgs"
CONDA_ENVS=""$DRUG_DISCOVERY_PREFIX"/"$USER"/.conda_envs"
else
echo "$USER not found in Drug-Discovery group, exiting"
exit 1
fi
# set up conda env to save packages in Drug-Discovery, not the in the home
# directory -- otherwise we run out of space
# create paths to locations in Drug-Discovery/$USER
CONDA_PKGS=""$DRUG_DISCOVERY_PREFIX"/"$USER"/.conda_pkgs"
CONDA_ENVS=""$DRUG_DISCOVERY_PREFIX"/"$USER"/.conda_envs"
# Append package and environment directory locations # to the .condarc file in
# the user's home directory. This is used by anaconda as the location to store
# dependencies and what not. If this is not set
# create ~/.condarc file if it doesn't already exist
if [ ! -f ~/.condarc ]; then
touch ~/.condarc
fi
cat <<EOT >> ~/.condarc
pkgs_dirs:
- $CONDA_PKGS
envs_dirs:
- $CONDA_ENVS
EOT
# If the anaconda package and environment directories:
# /exports/eddie/Drug-Discovery/$USER/.conda_pkgs
# /exports/eddie/Drug-Discovery/$USER/.conda_envs
# don't yet exist then these are created
if [ ! -d "$CONDA_PKGS" ]
then
mkdir "$CONDA_PKGS"
fi
if [ ! -d "$CONDA_ENVS" ]
then
mkdir "$CONDA_ENVS"
fi
# Create new directory to store the environment. This environment is
# unique to the user's CellProfiler installation.
CONDA_ENV_DIRECTORY=""$DRUG_DISCOVERY_PREFIX"/$USER/"$ENV_NAME"_conda_env"
if [ -d "$CONDA_ENV_DIRECTORY" ]
then
echo "Warning: replacing $CONDA_ENV_DIRECTORY"
rm -rf "$CONDA_ENV_DIRECTORY"
fi
mkdir "$CONDA_ENV_DIRECTORY"
cd "$CONDA_ENV_DIRECTORY"
# Create an environment file and save it as 'environment.yml' in the current
# directory. This file contains the dependencies and versions required by
# cellprofiler. Package version numbers are tricky and will need to be changed
# if a different version of CellProfiler is installed. Dependencies unique to
# CellProfiler (prokaryote, centrosome) are often updated so that they only
# work with the latest version of CellProfiler.
cat <<EOT >> environment.yml
# run: conda env create -f environment.yml
# run: conda env update -f environment.yml
# run: conda env remove -n cellprofiler
name: cellprofiler
# in order of priority: highest (top) to lowest (bottom)
channels:
- conda-forge
- anaconda
- goodman # mysql-python for mac
- bjornfjohansson
- bioconda
- cyclus # java-jdk for windows
- daf # wxpython for linux
dependencies:
- appdirs
- cython=0.28.5
- h5py=2.8.0
- ipywidgets
- java-jdk
- jupyter=1.0.0
- libtiff
- libxml2
- libxslt
- lxml=4.2.5
- packaging=17.1
- pillow=5.2.0
- pip
- python=2
- pyzmq=15.3.0
- mahotas=1.4.4
- matplotlib=2.2.3
- mysql-python
- numpy=1.14.5
- raven=6.3.0
- requests=2.18.4
- scikit-image=0.14.0
- scikit-learn=0.19.1
- scipy=1.1.0
- sphinx
- tifffile=0.15.1
- wxpython=3.0.2.0
- pip:
- cellh5==1.3.0
- centrosome==1.0.9
- inflect==1.0.0
- prokaryote==2.4.0
- javabridge==1.0.15
- python-bioformats==1.4.0
- git+https://github.com/CarragherLab/CellProfiler.git@master
EOT
# Fix $JAVA_HOME so javabridge points to where anaconda's java install is going
# to be.
CONDA_ENV_PREFIX="$CONDA_ENVS"/"$ENV_NAME"
export JAVA_HOME=$CONDA_ENV_PREFIX
# Call conda to create this environment from the environment.yml
conda env create -f environment.yml
# Call again and update, as sometimes prokaryote and javabridge don't install
# properly
conda env update -f environment.yml
echo "DONE!"
exit 0