File size: 8,170 Bytes
35cdf53 | 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 | ---
license: cc-by-nc-sa-4.0
tasks:
- protein-complex-structure-prediction
frameworks:
- jax
language:
- en
- zh
tags:
- OneScience
- Life Sciences
- Protein Structure Prediction
- Biomolecular Interactions
- Complex Structure Prediction
- AlphaFold3
datasets:
- OneScience/AlphaFold3_dataset
---
<p align="center">
<strong>
<span style="font-size: 30px;">AlphaFold3</span>
</strong>
</p>
# Model Introduction
AlphaFold3 is a biomolecular structure prediction model proposed by Google DeepMind and Isomorphic Labs. It can predict the three-dimensional structures and interactions of molecules and their complexes, including proteins, DNA, RNA, and small-molecule ligands.
Paper: Accurate structure prediction of biomolecular interactions with AlphaFold 3
https://www.nature.com/articles/s41586-024-07487-w
# Model Description
AlphaFold3 uses Pairformer and diffusion models to predict biomolecular complex structures. This model package provides a JAX / Flax inference project and data search scripts, and is released together with the ModelScope dataset `OneScience/AlphaFold3_dataset`.
# Applicable Scenarios
| Scenario | Description |
| :---: | :--- |
| Direct inference with existing features | Input an AlphaFold3 JSON containing features such as MSA / template, and output structure prediction results |
| Protein structure prediction | Input a protein sequence, generate features together with search databases, and predict the structure |
| Biomolecular complex modeling | Input multi-component objects such as proteins, DNA, RNA, and ligands, and predict the spatial conformation of the complex |
| Data search workflow verification | Use Jackhmmer / Nhmmer or MMseqs workflows to check database paths and search tool connectivity |
| ModelScope / OneCode runtime | After downloading the model project and complete dataset, quickly verify script connectivity in a biology-domain runtime environment |
# Usage Instructions
## 1. OneCode Usage
You can experience intelligent one-click AI4S programming through the OneCode online environment:
[Click to experience intelligent one-click AI4S programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
## 2. Manual Installation and Usage
**Hardware Requirements**
- GPU or DCU runtime is recommended.
- CPU can be used for import checks and small-configuration connectivity verification, but full training and inference are slow.
- DCU users need to install DTK in advance. DTK 25.04.2 or later is recommended, or the OneScience-recommended version matching the current cluster.
**Environment Check**
- NVIDIA GPU:
```bash
nvidia-smi
```
- Hygon DCU:
```bash
hy-smi
```
### Download the Model Package
```bash
modelscope download --model OneScience/AlphaFold3 --local_dir ./AlphaFold3
cd AlphaFold3
```
### Install the Runtime Environment
**DCU Environment**
```bash
# First activate DTK and Conda
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# Supports uv installation
pip install onescience[bio-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
```
After installation, return to the model package directory:
```bash
cd ./AlphaFold3
```
If the current environment has not yet built the AlphaFold3 C++ extension and runtime data files, execute:
```bash
python -m onescience.flax_model.alphafold3.build_extension
python -m onescience.flax_models.alphafold3.build_data
```
### Training and Inference Data Introduction
The OneScience community has uploaded the complete data required for AlphaFold3 inference and data search to ModelScope: [OneScience/AlphaFold3_dataset](https://modelscope.cn/datasets/OneScience/AlphaFold3_dataset). This model package does not include a training entry point; this dataset is mainly used for MSA / template feature construction and pre-inference data search.
```bash
modelscope download --dataset OneScience/AlphaFold3_dataset --local_dir ./data/alphafold3
```
### Training Weights
Weights will be uploaded soon.
### Prepare Weights
Place the AlphaFold3 model weights in the following directory, or specify them through an environment variable:
```text
weight/
AlphaFold3/
...
```
The default lookup order is:
- `ALPHAFOLD3_MODEL_DIR`
- `${ONESCIENCE_MODELS_DIR}/AlphaFold3`
- `weight/AlphaFold3`
Example:
```bash
export ALPHAFOLD3_MODEL_DIR=/path/to/AlphaFold3
```
### Direct Inference
When the input JSON already contains features such as MSA and template, you can run directly:
```bash
bash scripts/infer.sh
```
Equivalent Python command example:
```bash
python scripts/run_alphafold.py \
--json_path inputs/7r6r_data.json \
--model_dir weight/AlphaFold3 \
--output_dir outputs \
--run_data_pipeline=false \
--flash_attention_implementation=triton
```
The output will be written to `outputs/`, including the best structure, structure results for different seeds / samples, the ranking score CSV, and a copy of the input JSON.
### Jackhmmer / Nhmmer Data Search
When the input JSON contains only sequences and requires local database search, use:
```bash
bash scripts/infer_jackhmmer.sh
```
Common environment variables:
```bash
export ALPHAFOLD3_DATASET_ROOT=/path/to/alphafold3
export ALPHAFOLD3_MODEL_DIR=/path/to/AlphaFold3
export ALPHAFOLD3_JSON_PATH=inputs/t1119_search.json
export ALPHAFOLD3_OUTPUT_DIR=outputs
export ALPHAFOLD3_RUN_INFERENCE=false
```
Here, `ALPHAFOLD3_DATASET_ROOT` is expected by default to contain database directories such as `public_databases/`, `jackhmmer_split/`, and `mmseqsDB/`.
### MMseqs Data Search
If the runtime environment provides the MMseqs program and MMseqs database, use:
```bash
bash scripts/infer_mmseqs.sh
```
Common environment variables:
```bash
export ALPHAFOLD3_MMSEQS_HOME=/path/to/mmseqs
export ALPHAFOLD3_DATASET_ROOT=/path/to/alphafold3
export ALPHAFOLD3_MMSEQS_DB_DIR=/path/to/alphafold3/mmseqsDB
export ALPHAFOLD3_RUN_INFERENCE=false
```
To continue inference after searching, set `ALPHAFOLD3_RUN_INFERENCE` to `true` and make sure the weight directory is available.
# Data Format
AlphaFold3 input uses JSON format. The basic structure is as follows:
```json
{
"dialect": "alphafold3",
"version": 1,
"name": "example",
"sequences": [
{
"protein": {
"id": "A",
"sequence": "..."
}
}
],
"modelSeeds": [100],
"bondedAtomPairs": null,
"userCCD": null
}
```
This repository provides two examples:
- `inputs/7r6r_data.json`: Contains information such as sequence, MSA, and template, and is suitable for direct inference.
- `inputs/t1119_search.json`: Contains only sequence and is suitable for data search workflow verification.
The complete ModelScope dataset `OneScience/AlphaFold3_dataset` is recommended to be downloaded to `data/alphafold3/` under the model package. The relative structure read by the data search workflow by default is as follows:
```text
data/
alphafold3/
public_databases/
mmcif_files/
pdb_seqres_2022_09_28.fasta
...
jackhmmer_split/
bfd-first_non_consensus_sequences.fasta@64
mgy_clusters_2022_05.fa@512
uniprot_cluster_annot_2021_04.fa@256
uniref90_2022_05.fa@128
mmseqsDB/
small_bfd_db
mgnify_db
uniprot_cluster_annot_db
uniref90_db
```
# Verification
Static import check:
```bash
python tests/check_import_boundaries.py
```
# Official OneScience Information
| Platform | OneScience Main Repository | Skills Repository |
| --- | --- | --- |
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
# Citations and License
- This repository is based on the AlphaFold3 open-source model and provides DCU adaptation.
- AlphaFold3 source code uses the CC BY-NC-SA 4.0 license; model parameters are subject to separate terms of use.
- For scientific research, cite the original paper: [Accurate structure prediction of biomolecular interactions with AlphaFold 3](https://www.nature.com/articles/s41586-024-07487-w).
|