README.md 2.45 KB
Newer Older
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
1
2
3
4
5
# OpenFold

A faithful PyTorch reproduction of DeepMind's 
[AlphaFold 2](https://github.com/deepmind/alphafold).

Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
## Features

OpenFold carefully reproduces (almost) all of the features of the original open
source inference code. The sole exception is model ensembling, which fared
poorly in DeepMind's own ablation testing and is being phased out in future
DeepMind experiments. It is omitted here for the sake of reducing clutter. In 
cases where the Nature paper differs from the source, we always defer to the 
latter.

Unlike DeepMind's public code, OpenFold is also trainable. It can be trained 
with or without [DeepSpeed](https://github.com/microsoft/deepspeed) and with 
mixed precision. bfloat16 training is not currently supported, but will be 
soon. 

Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
20
21
## Installation

Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
22
23
24
Python dependencies available through `pip` are provided in `requirements.txt`. 
OpenFold also depends on `openmm==7.5.1` and `pdbfixer`, which are only
available via `conda`. 
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
25

Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
26
For convenience, we provide a script that installs Miniconda locally, creates a 
27
28
`conda` virtual environment, installs all Python dependencies, and downloads
useful resources (including DeepMind's pretrained parameters). Run:
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
29
30

```bash
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
31
32
33
scripts/install_third_party_dependencies.sh
```

Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
34
To activate the environment, run:
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
35
36

```bash
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
37
source scripts/activate_conda_venv.sh
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
38
39
```

40
To deactivate it, run:
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
41
42

```bash
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
43
source scripts/deactivate_conda_venv.sh
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
44
45
```

Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
46
## Usage
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
47

Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
48
49
To run inference on a sequence using a set of DeepMind's pretrained parameters, 
run e.g.
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
50

Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
51
```bash
52
53
54
55
56
57
58
59
60
61
python3 run_pretrained_openfold.py \
        test.fasta \
        data/uniref90/uniref90.fasta \
        data/mgnify/mgy_clusters_2018_12.fa \
        data/pdb70/pdb70 \
        data/pdb_mmcif/mmcif_files/ \
        --output_dir ./ \
        --bfd_database_path data/bfd/bfd_metaclust_clu_complete_id30_c90_final_seq.sorted_opt \
        --uniclust30_database_path data/uniclust30/uniclust30_2018_08/uniclust30_2018_08 \
        --device cuda:1
Gustaf Ahdritz's avatar
Gustaf Ahdritz committed
62
```
63

64
65
66
67
68
69
70
71
where `data` is a directory populated by `scripts/download_all_data.sh`. Run

```bash
python3 run_pretrained_openfold.py --help
```

for a full list of options.

72
73
74
75
76
77
78
## Copyright notice

While AlphaFold's and, by extension, OpenFold's source code is licensed under
the permissive Apache Licence, Version 2.0, DeepMind's pretrained parameters 
remain under the more restrictive CC BY-NC 4.0 license, a copy of which is 
downloaded to `openfold/resources/params` by the installation script. They are
thereby made unavailable for commercial use.