|
| 1 | +# AlphaFold3 |
| 2 | + |
| 3 | +AlphaFold3 is a cutting-edge AI system developed by DeepMind for predicting protein structures with high accuracy. Building on its predecessors, AlphaFold3 integrates additional molecular modeling capabilities, making it a powerful tool for structural biology research. |
| 4 | + |
| 5 | +This guide provides step-by-step instructions on setting up and running AlphaFold3 on UBELIX using Slurm. |
| 6 | + |
| 7 | +## Directory Structure Setup |
| 8 | + |
| 9 | +Before running AlphaFold3, set up the necessary directory structure. |
| 10 | + |
| 11 | +1. Choose a suitable location for AlphaFold3. For example: |
| 12 | + ```bash |
| 13 | + export AF3_ROOT=~/alphafold3/ |
| 14 | + ``` |
| 15 | +2. Create the required directories: |
| 16 | + ```bash |
| 17 | + mkdir -p $AF3_ROOT |
| 18 | + mkdir -p $AF3_ROOT/input # Store input JSON files |
| 19 | + mkdir -p $AF3_ROOT/output # Store generated structure outputs |
| 20 | + mkdir -p $AF3_ROOT/model_parameters # Store downloaded model parameters |
| 21 | + mkdir -p $AF3_ROOT/databases # Store public databases |
| 22 | + ``` |
| 23 | + |
| 24 | +## Cloning the AlphaFold3 Repository |
| 25 | + |
| 26 | +Clone the official AlphaFold3 source code from GitHub: |
| 27 | + |
| 28 | +```bash |
| 29 | +cd $AF3_ROOT |
| 30 | +git clone https://github.com/google-deepmind/alphafold3.git src |
| 31 | +``` |
| 32 | + |
| 33 | +## Creating the Slurm Submission Script |
| 34 | + |
| 35 | +Create a Slurm submission script (e.g., `run_alphafold3.sh`) for running AlphaFold3 on a GPU node. |
| 36 | + |
| 37 | +1. Navigate to the project directory: |
| 38 | + ```bash |
| 39 | + cd $AF3_ROOT |
| 40 | + ``` |
| 41 | +2. Create `run_alphafold3.sh` and add the following content: |
| 42 | + ```bash |
| 43 | + #!/bin/bash |
| 44 | + #SBATCH --job-name="alphafold3_job" |
| 45 | + #SBATCH --time=01:00:00 |
| 46 | + #SBATCH --partition=gpu |
| 47 | + #SBATCH --gres=gpu:rtx4090:1 |
| 48 | + #SBATCH --cpus-per-task=16 |
| 49 | + #SBATCH --mem-per-cpu=5760M |
| 50 | + |
| 51 | + module load CUDA/12.6 |
| 52 | + |
| 53 | + singularity exec \ |
| 54 | + --nv \ |
| 55 | + --bind $PWD/input:/root/af_input \ |
| 56 | + --bind $PWD/output:/root/af_output \ |
| 57 | + --bind $PWD/model_parameters:/root/models \ |
| 58 | + --bind $PWD/databases:/root/public_databases \ |
| 59 | + /storage/software/singularity/containers/alphafold3.sif \ |
| 60 | + python src/run_alphafold.py \ |
| 61 | + --json_path=/root/af_input/fold_input.json \ |
| 62 | + --model_dir=/root/models \ |
| 63 | + --db_dir=/root/public_databases \ |
| 64 | + --output_dir=/root/af_output |
| 65 | + ``` |
| 66 | +4. Save and close the file |
| 67 | + |
| 68 | +## Downloading Public Databases |
| 69 | + |
| 70 | +AlphaFold3 requires publicly available databases for structure prediction. |
| 71 | + |
| 72 | +!!! danger "Danger: Very large databases" |
| 73 | + |
| 74 | + The AlphaFold3 databases are nearly 650GB in size. To avoid redundant downloads and conserve storage, it is recommended that a single copy be maintained in a shared workspace for the entire lab. Check with colleagues and supervisors if a copy of the databases is already accessible to you! |
| 75 | + |
| 76 | + === "Link existing databases" |
| 77 | + |
| 78 | + If the public databases are already available, simply create a symbolic |
| 79 | + link to their location: |
| 80 | + |
| 81 | + ```bash |
| 82 | + cd $AF3_ROOT |
| 83 | + ln -s /path/to/workspace/databases databases |
| 84 | + ``` |
| 85 | + |
| 86 | + === "Install databases to shared workspace" |
| 87 | + |
| 88 | + 1. Navigate to the shared workspace to store the dabases, e.g.: |
| 89 | + ```bash |
| 90 | + cd /path/to/workspace/alphafold3/databases |
| 91 | + ``` |
| 92 | + 2. Download the database fetch script: |
| 93 | + ```bash |
| 94 | + wget https://raw.githubusercontent.com/google-deepmind/alphafold3/refs/heads/main/fetch_databases.sh |
| 95 | + ``` |
| 96 | + 3. Make the script executable and run it: |
| 97 | + ```bash |
| 98 | + chmod u+x fetch_databases.sh |
| 99 | + ./fetch_databases.sh databases |
| 100 | + ``` |
| 101 | + 4. Continue with lining existing databases |
| 102 | + ```bash |
| 103 | + cd $AF3_ROOT |
| 104 | + ln -s /path/to/workspace/databases databases |
| 105 | + ``` |
| 106 | + |
| 107 | + === "Install databases to user home " |
| 108 | + |
| 109 | + 1. Navigate to the AlphaFold3 project directory: |
| 110 | + ```bash |
| 111 | + cd $AF3_ROOT |
| 112 | + ``` |
| 113 | + 2. Download the database fetch script: |
| 114 | + ```bash |
| 115 | + wget https://raw.githubusercontent.com/google-deepmind/alphafold3/refs/heads/main/fetch_databases.sh |
| 116 | + ``` |
| 117 | + 3. Make the script executable and run it: |
| 118 | + ```bash |
| 119 | + chmod u+x fetch_databases.sh |
| 120 | + ./fetch_databases.sh databases |
| 121 | + ``` |
| 122 | + |
| 123 | +## Downloading Model Parameters |
| 124 | + |
| 125 | +AlphaFold3 model parameters need to be downloaded separately. To request access to the model parameters, please complete this [form](https://forms.gle/svvpY4u2jsHEwWYS6). Access will be granted at Google DeepMind’s sole discretion. You may only use AlphaFold 3 model parameters if received directly from Google. Use is subject to these [terms of use](https://github.com/google-deepmind/alphafold3/blob/main/WEIGHTS_TERMS_OF_USE.md). |
| 126 | + |
| 127 | +Ensure they are stored in the `model_parameters` directory: |
| 128 | + |
| 129 | +```bash |
| 130 | +cd $AF3_ROOT/model_parameters |
| 131 | +# Download and extract model parameters following official AlphaFold3 instructions. |
| 132 | +``` |
| 133 | + |
| 134 | +## Preparing Input File |
| 135 | + |
| 136 | +AlphaFold3 requires a JSON input file containing sequence and configuration details. Create an input file at `input/fold_input.json`: |
| 137 | + |
| 138 | +Example: |
| 139 | + |
| 140 | +```json |
| 141 | +{ |
| 142 | + "name": "2PV7", |
| 143 | + "sequences": [ |
| 144 | + { |
| 145 | + "protein": { |
| 146 | + "id": ["A", "B"], |
| 147 | + "sequence": "GMRESYANENQFGFKTINSDIHKIVIVGGYGKLGGLFARYLRASGYPISILDREDWAVAESILANADVVIVSVPINLTLETIERLKPYLTENMLLADLTSVKREPLAKMLEVHTGAVLGLHPMFGADIASMAKQVVVRCDGRFPERYEWLLEQIQIWGAKIYQTNATEHDHNMTYIQALRHFSTFANGLHLSKQPINLANLLALSSPIYRLELAMIGRLFAQDAELYADIIMDKSENLAVIETLKQTYDEALTFFENNDRQGFIDAFHKVRDWFGDYSEQFLKESRQLLQQANDLKQG" |
| 148 | + } |
| 149 | + } |
| 150 | + ], |
| 151 | + "modelSeeds": [1], |
| 152 | + "dialect": "alphafold3", |
| 153 | + "version": 1 |
| 154 | +} |
| 155 | +``` |
| 156 | + |
| 157 | +## Submitting the Job |
| 158 | + |
| 159 | +Once everything is set up, submit the job to Slurm: |
| 160 | + |
| 161 | +```bash |
| 162 | +sbatch run_alphafold3.sh |
| 163 | +``` |
| 164 | + |
| 165 | +## Output Location |
| 166 | + |
| 167 | +Once the job is complete, the predicted structures will be available in: |
| 168 | + |
| 169 | +``` |
| 170 | +$AF3_ROOT/output/ |
| 171 | +``` |
| 172 | + |
0 commit comments