| --- |
| 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). |
|
|