File size: 8,213 Bytes
40d185e | 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-Sugon/AlphaFold3_dataset
---
<p align="center">
<strong>
<span style="font-size: 30px;">AlphaFold3</span>
</strong>
</p>
# Model Introduction
AlphaFold 3 is a biomolecular structure prediction model developed by Google DeepMind and Isomorphic Labs. It predicts the three-dimensional structures and interactions of proteins, DNA, RNA, small-molecule ligands, and their complexes.
Paper: Accurate structure prediction of biomolecular interactions with AlphaFold 3
https://www.nature.com/articles/s41586-024-07487-w
# Model Description
AlphaFold 3 uses a Pairformer and a diffusion model to predict biomolecular complex structures. This model package provides a JAX / Flax inference implementation and database-search scripts, together with the accompanying Hugging Face dataset `OneScience-Sugon/AlphaFold3_dataset`.
# Use Cases
| Scenario | Description |
| :---: | :--- |
| Direct inference from existing features | Takes an AlphaFold 3 JSON file containing precomputed features such as MSAs and templates as input and produces structure predictions |
| Protein structure prediction | Takes a protein sequence as input, generates features by searching databases, and predicts its structure |
| Biomolecular complex modeling | Takes multicomponent systems comprising proteins, DNA, RNA, ligands, and other molecules as input and predicts their 3D structures |
| Database-search pipeline validation | Uses Jackhmmer / Nhmmer or MMseqs pipelines to verify database paths and the availability of search tools |
| Hugging Face / OneCode execution | After downloading the model project and complete dataset, quickly verifies that the scripts run correctly in a life-sciences runtime environment |
# Usage Instructions
## 1. OneCode
Try one-click AI4S development in the OneCode online environment:
[Try one-click AI4S development](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
## 2. Manual Installation
**Hardware Requirements**
- GPU or DCU is recommended.
- A CPU can be used for import checks and lightweight configuration tests; full training and inference will be slow.
- DCU users must install DTK in advance. DTK 25.04.2 or later is recommended, or a OneScience-recommended version matching the current cluster.
**Environment Check**
- NVIDIA GPU:
```bash
nvidia-smi
```
- Hygon DCU:
```bash
hy-smi
```
### Download the Model Package
```bash
hf download --model OneScience-Sugon/AlphaFold3 --local-dir ./AlphaFold3
cd AlphaFold3
```
### Install the Runtime Environment
**DCU Environment**
```bash
# Activate DTK and CONDA first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# uv installation supported
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 AlphaFold 3 C++ extension and runtime data files have not yet been built in the current environment, run:
```bash
python -m onescience.flax_model.alphafold3.build_extension
python -m onescience.flax_models.alphafold3.build_data
```
### Training and Inference Data Overview
The OneScience community has uploaded the complete data required for AlphaFold 3 inference and database searches to Hugging Face: [OneScience-Sugon/AlphaFold3_dataset](https://huggingface.co/datasets/OneScience-Sugon/AlphaFold3_dataset). This model package does not include a training entry point; the dataset is primarily used to construct MSA / template features and perform database searches before inference.
```bash
hf download --dataset OneScience-Sugon/AlphaFold3_dataset --local-dir ./data/alphafold3
```
### Model Weights
Model weights will be available soon.
### Preparing Weights
Place the AlphaFold 3 model weights in the following directory, or specify them via environment variables:
```text
weight/
AlphaFold3/
...
```
Default lookup order:
- `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 templates, you can run inference 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
```
Output is written to `outputs/` and includes the top-ranked structure, structures generated from different seed / sample combinations, a CSV file containing ranking scores, and a copy of the input JSON.
### Jackhmmer / Nhmmer Database Search
When the input JSON contains only sequences and requires a 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
```
`ALPHAFOLD3_DATASET_ROOT` is expected to contain directories such as `public_databases/`, `jackhmmer_split/`, and `mmseqsDB/`.
### MMseqs Database Search
If the runtime environment provides the MMseqs executable and the required MMseqs databases, 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 proceed with inference after the database search, set `ALPHAFOLD3_RUN_INFERENCE` to `true` and ensure that the weights directory is available.
# Data Format
AlphaFold 3 inputs are provided in JSON format with the following basic structure:
```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 sequence, MSA, and template information; suitable for direct inference.
- `inputs/t1119_search.json`: contains only sequences; suitable for database-search pipeline validation.
It is recommended to download the full Hugging Face dataset `OneScience-Sugon/AlphaFold3_dataset` to `data/alphafold3/` under the model package. The relative directory structure expected by the database-search pipeline 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
```
# OneScience Official 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 |
# Citation & License
- This repository is adapted from the open-source AlphaFold 3 model to support DCUs.
- The AlphaFold 3 source code is licensed under CC BY-NC-SA 4.0; model parameters are subject to separate usage terms.
- For scientific use, please cite the original paper: [Accurate structure prediction of biomolecular interactions with AlphaFold 3](https://www.nature.com/articles/s41586-024-07487-w).
|