File size: 17,586 Bytes
a3f3d91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
![Aggrescan3D logo](https://bitbucket.org/lcbio/aggrescan3d/wiki/logo.png "Aggrescan3D logo")

This is a repository for Aggrescan3D standalone application developed by the [Laboratory of Computational Biology at University of Warsaw](http://lcbio.pl) in cooperation with the [Laboratory of Protein Folding and Conformational Diseases at Univesity of Barcelona](https://ibb.uab.cat/wp-content/themes/viral/modules/ibb_membres/view_grup.php?CodiGrup=36). 

## Detailed instructions and tutorials are provided on [Aggrescan3D WIKI PAGE](https://bitbucket.org/lcbio/aggrescan3d/wiki/Home) ##

-------------------------------------------
### Table of contents
[1. Introduction](#markdown-header-introduction)

[2. Windows installation guide](#markdown-header-windows-users)

[3. Linux installation guide](#markdown-header-linux-users)  
  
[4. macOS installation guide](#markdown-header-macos-users)

[5. Docker image](#markdown-header-docker-image)

---

## Introduction
*Aggrescan3D* can be installed on Linux, macOS or Windows. This comprehensive tutorial is aimed to guide users through the installation process and is split into three parts for corresponding systems. 

*Aggrescan3D* is a python package using *Python 2.7* version. We *highly* recommend that you use the scientific Anaconda distribution that comes with pre-installed packages 
and conda package manager which allows for an easier and less error prone installation. If you choose to use Anaconda simply go to [their web page](https://www.anaconda.com/download/)
and download a Python 2.7 installation for your target operating system (the installer will suggest installing only for current user for Windows systems we also advise that as managing an all-user install can be more challenging 
and this guide assumes that the user chooses the recommended option). Further steps will give specific instructions for conda users as well as for vanilla python.

##### Tips for users who are not familiar with Python or using command prompt/terminal:
- *Python3.X* is **NOT** the latest version of *Python2.7* and you should always use *Python2.7* to run Aggrescan3D.
- Throughout this tutorial a PATH will be frequently mentioned. PATH is a variable that tells the system where to look for your installed programs when you issue commands. Detailed instructions on how to modify it will be given in appropriate parts of this guide.
- Most sections of this guide contain a correctness test step which can be executed to see wether or not the isntallation was successful. When in doubt run the test. 
- While this tutorial attempts to covers much ground as possible if something goes wrong please contact us for assistance this will also help us improve our software and this guide too!

---

## Windows users

#### 1. Python 2.7 

##### Anaconda distribution 

If you have chosen to use Anaconda this step is already done. 

* Please do note that at this point you should always use  the Anaconda Prompt available in the start menu under that name instead of the regular command prompt.

##### Vanilla Python distribution   

- Follow instructions on [python.org](https://python.org). During the installation process select to include pip and setuptools as those will be necessary. 
- Add Python27/Scripts (by default under C:\Python27\Scripts) folder to your PATH. This folder contains pip which will install Aggrescan3D as well as it is the folder which will contain the Aggrescan3D program once its installed.

Follow the steps described in GFortran section. The folder should be located at ```C:\Python27\Scripts``` by default so either follow the steps in the Control Panel or type:

```
set PATH=%PATH%;C:\Python27\Scripts
``` 

- Note that you have to re-type that in each command prompt in which you want to use *pip* or *Aggrescan3D*.  

##### pip not installed with Python

If you chose not to install pip with your Python installation you need to do that manually. 
Assuming you've already made Python2.7 accessible under command "python", download [this](https://bootstrap.pypa.io/get-pip.py) script, 
change to the directory with downloaded script and run:

```python get-pip.py```
 
##### Correctness test 
To check if pip (hence also Python) are working open a  `command
prompt` (press `cmd + R`; enter "cmd"; hit `enter`) and run the following command:

```pip freeze```

This should list all the packages that you have currently installed.

If you wish to check that you have the correct Python version add the Python binary (python.exe) replacing the example path with your respective one:

```set PATH=%PATH%;C:\Python27``` 

And then type:

```python --version```

Minimum recommended python version for Aggrescan3D is 2.7.12 but as low as 2.7.6 should work. We recommend that you download the latest version from
[python.org](https://python.org).

#### 2. FoldX (optional)

 In order to run stability calculations or mutant calculations FoldX has to be present on the system and PATH to it provided to the program upon running a calculation. 
 
 FoldX is free for academic use and the licence can be obtained at http://foldxsuite.crg.eu/ 

#### 3. *CABS-flex* (optional)

 In order to run the dynamic mode (*highly recommneded*) one has to install *CABS-flex*. Detailed instructions how to do so can be found [here](https://bitbucket.org/lcbio/cabsflex/src/master/README.md)

#### 4. *Aggrescan3D*
##### Anaconda users
In your Anaconda Prompt type:

```conda install -c lcbio aggrescan3d```

##### Vanilla Python
In the regular command prompt type:

```pip install aggrescan3d```

##### Correctness test 
Run a simulation of lcbio's favorite 2gb1 with:

```aggrescan -i 2gb1 -w test_run -v 4```

- If the result is `'aggrescan3d' is not recognized as an internal or external command, operable program or batch file.` it means that your Python's Scripts folder is not on the PATH variable.
- If you see a ```Simulation completed successfully``` message, congratulations you have completed your first *aggrescan3d* simulation. 

To check if the server app works:

```a3d_server```

- Open your favourite web browser (Be warned though - Internet Explorer will not be able to provide full functionality)
- Go to localhost:5000
- ** Some of the app functionality might not work on the Windows system (namely job stopping) and the app is generally less responsive and more prone to hang should work well in most cases though ** 

---

## Linux users ##

#### 1. Python 2.7 

##### Anaconda distribution 

If you have chosen to use Anaconda this step is already done. Anaconda installer should ask you if you want it to be added to your PATH, 
for most users this is desirable because it means that when typing ```python``` it will call Anaconda's Python rather than regular one.  

* Check if the ```python``` command refers to Anaconda Python type:

```python --version```

The output should be something like ```Python 2.7.14 :: Anaconda, Inc. ```. If it is not add a following line to your ~/.bashrc file (found in the user's home directory) 
replacing the path with your anaconda's installation path:

```export $PATH="/absolute/path/to/anaconda2/bin:$PATH"```

and then close and reopen the terminal or simply run:

```source ~/.bashrc```

##### Vanilla Python distribution   

Python 2.7 should be present on all unix systems, to verify the version, open your terminal and type:

```python --version```

We recommended python version for 2.7.12 or higher but earlier releases might also work. 

##### pip not installed with Python

pip should also be installed by default on most unix systems, verify that it works issuing the following command:

```pip freeze```

This should return a list of installed packages for your Python. 
if that is not the case install it using your system's package manager:

```sudo apt-get install python-pip```

#### 2. FoldX (optional)

 In order to run stability calculations or mutant calculations FoldX has to be present on the system and PATH to it provided to the program upon running a calculation. 
 
 FoldX is free for academic use and the licence can be obtained at http://foldxsuite.crg.eu/ 

#### 3. *CABS-flex* (optional)

 In order to run the dynamic mode (*highly recommneded*) one has to install *CABS-flex*. Detailed instructions how to do so can be found [here](https://bitbucket.org/lcbio/cabsflex/src/master/README.md)

#### 4. *Aggrescan3D*
##### Anaconda users
Simply type:

```conda install -c lcbio aggrescan3d```

##### Vanilla Python
Simply type:

```pip install aggrescan3d```

##### **Troubleshooting**

- If pip install fails due to writing rights **do not use sudo pip install.** 

- Depending on your privileges and the way your system is managed you might want or need to install *Aggrescan3D* just for the current user:

```pip install --user aggrescan3d```

- When using the --user flag the binary is placed in a folder that is usually not on your PATH. Usually it is located in your 
```$HOME/.local/bin``` but check if that is the case before continuing. Once you located the binary add its location to your path via editing your .bashrc folder in home directory. Add the line:

```export PATH="$HOME/.local/bin:$PATH"```

##### Correctness test 
Run a simulation of lcbio's favorite 2gb1 with:

```aggrescan -i 2gb1 -w test_run -v 4```

- If the result is `'aggrescan3d' is not recognized as an internal or external command, operable program or batch file.` it means that your Python's Scripts folder is not on the PATH variable.
- If you see a ```Simulation completed successfully``` message, congratulations you have completed your first *aggrescan3d* simulation. 

To check if the server app works:

```a3d_server```

- Open your favourite web browser
- Go to 0.0.0.0:5000 (if the server is not responding depending on the loopback settings localhost:5000 might work)

---

## macOS users

#### 1. Python 2.7 

##### Anaconda distribution 
If you have chosen to use Anaconda this step is already done. Anaconda installer should ask you if you want it to be added to your PATH, 
for most users this is desirable because it means that when typing ```python``` it will call Anaconda's Python rather than regular one.  
* Check if the ```python``` command refers to Anaconda Python type:

```python --version```

If the result doesnt include the word Anaconda it means your system is using other Python version by default this can be changed by prepending Anaconda to your PATH.

- Move into home directory
- Create a .bash_profile file using a text editor (like nano) ```nano .bash_profile```
- Add the line ```export PATH="/absolute/path/to/anaconda2/bin:$PATH"``` with your respective path to anaconda2 installation
- Save the file and relaunch the terminal 

##### Vanilla Python distribution   

macOS comes with *Python2.7* already installed. To check if you have the correct Python version open the `Terminal.app` and type:

```python --version```

If you get the message: `bash: python: command not found` it may mean that your system doesn't have Python installed, or
Python's binary is not in the system `PATH`. To check this run in the `Terminal.app` the following command:

```/Library/Frameworks/Python.framework/Versions/2.7/bin/python --version```

If you still get the message: `bash: python: command not found` you need to install *Python2.7*. Otherwise add Python's
binary to the system's `PATH` by running in the `Terminal.app` the following command and then reopen the terminal:

```echo "export PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin/:$PATH" >> ~/.bash_profile```

##### pip not installed with Python

Assuming you've already installed Python2.7 and made it accessible under command "python" simply install pip via setuptools by:

```sudo easy_install pip```

#### 2. FoldX (optional)

 In order to run stability calculations or mutant calculations FoldX has to be present on the system and PATH to it provided to the program upon running a calculation. 
 
 FoldX is free for academic use and the licence can be obtained at http://foldxsuite.crg.eu/ 

#### 3. *CABS-flex* (optional)

 In order to run the dynamic mode (*highly recommneded*) one has to install *CABS-flex*. Detailed instructions how to do so can be found [here](https://bitbucket.org/lcbio/cabsflex/src/master/README.md)

#### 4. *Aggrescan3D*
##### Anaconda users
Simply type:

```conda install -c lcbio aggrescan3d```

##### Vanilla Python
Simply type:

```pip install aggrescan3d```

*For macOS "El Captian" are newer `six` library comes preinstalled and may cause installation erros. Try running: `pip install aggrescan3d --ignore-installed six` instead.*

##### Correctness test 
Run a simulation of lcbio's favorite 2gb1 with:

```aggrescan -i 2gb1 -w test_run -v 4```

- If the result is `'aggrescan3d' is not recognized as an internal or external command, operable program or batch file.` it means that your Python's Scripts folder is not on the PATH variable.
- If you see a ```Simulation completed successfully``` message, congratulations you have completed your first *aggrescan3d* simulation. 

To check if the server app works:

```a3d_server```

- Open your favourite web browser
- Go to 0.0.0.0:5000 (if the server is not responding depending on the loopback settings localhost:5000 might work)

---

## Docker image

*Aggrescan3D* is also available as a docker image and this tutorial will guide the user through how to create a local, always available *Aggrescan3D* server on their PC using the Docker technology. This could also be a good workaround for
users facing compatibility and installation issues.
 
*Please note we cannot include FoldX nor Modeller software in distributed images as they require a licence to run. We however explain how to get those running easly and unlok the full potentail of Aggrescan3D inside a Docker container*
 
- ```lcbio/a3d_server``` - [conda](https://hub.docker.com/r/lcbio/a3d_server/) based distribution. Included Dockerfile should allow the users to build a Docker Image with dynamic mode support

 
### Beginner's tutorial
 
 While we cannot provide a ground-up guide on Docker usage we do provide basic instructions and further reading material that should make it possible to use this without prior experience. This tutorial is Linux oriented but Docker is also available on Windows10 Pro.
 
#### 1. Installing Docker
 
 Please refer to the [docs](https://docs.docker.com/install/) which contain detailed and well written guides for different systems:
 
 We also recommend you read [this](https://docs.docker.com/get-started/) starter article on the docker docs
 
 And [this](https://docs.docker.com/install/linux/linux-postinstall/) post-installation tips (especially if you get permission errors and have to always run docker with sudo)
 
#### 2. Using dynamic mode in the container
 
 To do that one has to create their own image based on our conda image.
 
 - Create a new folder and cd into it ```mkdir docker_build && cd docker_build```
 - Create a Dockerfile and copy the contents which can be found [here](https://hub.docker.com/r/lcbio/a3d_server/)
 - Uncomment the suggested lines and replace XXXX with your Modeller licence key
 - Run ```docker build -t image_name .``` 
 - If the process is successful the image will be available under 'image_name'
 
#### 3. Get the *Aggrescan3D* image (skip if you did point 2)
  
 To make the image available on your system run:
```
#!bash
docker pull lcbio/a3d_server
```
#### 4. Running the Docker container
 
 The basic goal of the conatiner is to provide a server-like service locally. We recommend to use a following command (explained below):
 
```
#!bash
docker run --name a3d_service -p 5000:5000 -v /your/absolute/path/to/FoldX:/home/FoldX --restart unless-stopped -d a3d_server
```
 - The name command will assign a name to your container which will make it easier to manipulate it in the future
 - The -p option exposes your container's 5000 port to your machine's 5000 port. This will mean that you can access the service from your machine. 
 - The -v option mounts your FoldX folder inside the container which makes it available to the service. This is necessary if you wish to use the stability calculations or mutations. Please leave the second part (after ':') unchanged and make sure you provide an absoulte path.
 - The restrart unless-stopped will restart the container on system restart meaning it will be always available (Blocking port 5000 though). 
 - The -d options means detach - the container will run in the background  
 
 Addition interaction with the container can be performed as follows:

 - To stop the service: ```docker stop a3d_service```
 - To start it again: ```docker start a3d_service```
 - To restart a running container (in case it hung, etc): ```docker start a3d_service ```
 - To copy files from container to local system (results on the container are stored inside /opt/conda/lib/python2.7/site-packages/a3d_gui/computations/): ```docker cp a3d_service:path/inside/the/container local/path```
 - To delete the container (*this will delete all the simulation results that were not copied to the filesystem!*): ```docker rm a3d_service```

 To interact with the container's console for purposes other than the server run it via which will give access to a shell with aggrescan installed: 
 
```docker run --name my_container a3d_server /bin/bash```
 
#### 5. Further reading 
 
 - Running docker images [explained](https://www.pluralsight.com/guides/docker-a-beginner-guide)
 - We found [this](https://docker-curriculum.com/) guide to be quite informative and well-written.