| --- |
| license: apache-2.0 |
| tasks: |
| - genomic-sequence-modeling |
| frameworks: |
| - jax |
| language: |
| - en |
| - zh |
| tags: |
| - OneScience |
| - Life Sciences |
| - Genomics |
| - DNA Sequence Model |
| - Variant Effect Prediction |
| - AlphaGenome |
| datasets: |
| - OneScience/alphagenome_dataset |
| --- |
| |
| <p align="center"> |
| <strong> |
| <span style="font-size: 30px;">AlphaGenome</span> |
| </strong> |
| </p> |
| |
| # Model Introduction |
|
|
| AlphaGenome is a DNA sequence model proposed by Google DeepMind. It can take DNA intervals up to 1 Mbp as input and predict multiple classes of genomic functional signals for track prediction and regulatory variant effect scoring. |
|
|
| Paper: Advancing regulatory variant effect prediction with AlphaGenome |
| https://www.nature.com/articles/s41586-025-10014-0 |
|
|
| # Model Description |
|
|
| AlphaGenome is implemented based on JAX / Flax and supports genomic interval inference, variant effect scoring, track evaluation, and fine-tuning examples. This model package is accompanied by the ModelScope dataset `OneScience/alphagenome_dataset`, which can be used for quick local verification. |
|
|
| # Applicable Scenarios |
|
|
| | Scenario | Description | |
| | :---: | :--- | |
| | Genomic interval prediction | Input a reference genome FASTA, chromosome, and interval coordinates, and output predicted tracks for ATAC, DNase, CAGE, RNA-seq, ChIP, and other signals | |
| | Variant effect scoring | Input a VCF or built-in example variants, compare prediction differences between reference and variant sequences, and generate a variant scoring table | |
| | Track prediction evaluation | Use validation data from the AlphaGenome dataset to calculate regression evaluation metrics for different assay bundles | |
| | Fine-tuning experiments | Use a custom reference genome, interval CSV, and BigWig signal files to verify the fine-tuning workflow | |
| | ModelScope / OneCode runtime | After downloading the model project and accompanying 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/alphagenome --local_dir ./alphagenome |
| cd alphagenome |
| ``` |
|
|
| ### 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 ./alphagenome |
| ``` |
|
|
| ### Training and Inference Data Introduction |
|
|
| The OneScience community has uploaded the data required for AlphaGenome inference, evaluation, and fine-tuning to ModelScope: [OneScience/alphagenome_dataset](https://modelscope.cn/datasets/OneScience/alphagenome_dataset). After downloading, place the data in the `data/` directory of the model package. |
|
|
| ```bash |
| modelscope download --dataset OneScience/alphagenome_dataset --local_dir ./data |
| ``` |
|
|
| ### Training Weights |
|
|
| The repository includes `weight/alphagenome-all-folds`, and all scripts also support specifying model weights through `--model_dir`. |
|
|
| ### Prepare Weights |
|
|
| If using local weights, place the AlphaGenome Orbax checkpoint in the following directory: |
|
|
| ```text |
| weight/ |
| alphagenome-all-folds/ |
| _CHECKPOINT_METADATA |
| _METADATA |
| ... |
| ``` |
|
|
| If running in a shared runtime environment, you can also reuse a unified directory through environment variables: |
|
|
| ```bash |
| export ONESCIENCE_MODELS_DIR=/path/to/onescience/models |
| export ONESCIENCE_DATASETS_DIR=/path/to/onescience/datasets |
| ``` |
|
|
| The scripts will preferentially read: |
|
|
| - `${ONESCIENCE_MODELS_DIR}/AlphaGenome/alphagenome-all-folds` |
| - `${ONESCIENCE_DATASETS_DIR}/AlphaGenome` |
|
|
| If the above environment variables are not set, the defaults under the current model package are read: |
|
|
| - `weight/alphagenome-all-folds` |
| - `data/` |
|
|
| ### Interval Inference |
|
|
| ```bash |
| bash scripts/inference.sh |
| ``` |
|
|
| Equivalent Python command example: |
|
|
| ```bash |
| python scripts/run_inference.py \ |
| --fasta_path ./data/reference/HOMO_SAPIENS/GRCh38.p13.genome.fa \ |
| --model_dir ./weight/alphagenome-all-folds \ |
| --chromosome chr19 \ |
| --start 10587331 \ |
| --end 11635907 \ |
| --output_dir ./outputs |
| ``` |
|
|
| Inference results will be saved to `outputs/`. |
|
|
| ### Variant Effect Scoring |
|
|
| ```bash |
| bash scripts/run_variant.sh |
| ``` |
|
|
| When specifying VCF input, you can use: |
|
|
| ```bash |
| python scripts/run_variant_scoring.py \ |
| --vcf_path ./data/example.vcf \ |
| --fasta_path ./data/reference/HOMO_SAPIENS/GRCh38.p13.genome.fa \ |
| --model_dir ./weight/alphagenome-all-folds \ |
| --output_dir ./outputs_variant |
| ``` |
|
|
| Scoring results will be saved as CSV files. |
|
|
| ### Track Prediction Evaluation |
|
|
| ```bash |
| bash scripts/run_track.sh |
| ``` |
|
|
| You can also explicitly specify the data and output paths: |
|
|
| ```bash |
| python scripts/run_track_prediction_eval.py \ |
| --model_dir ./weight/alphagenome-all-folds \ |
| --model_version ALL_FOLDS \ |
| --data_dir ./data/v1/train \ |
| --output_path ./outputs_track/eval_results.csv |
| ``` |
|
|
| ### Fine-tuning Example |
|
|
| ```bash |
| python scripts/run_finetuning.py \ |
| --fasta_path ./data/reference/HOMO_SAPIENS/GRCh38.p13.genome.fa \ |
| --regions_csv ./data/finetune_regions.csv \ |
| --bigwig_paths ./data/sample_atac.bw \ |
| --output_dir ./finetuned_model \ |
| --num_steps 1000 \ |
| --batch_size 2 |
| ``` |
|
|
| # Data Format |
|
|
| The ModelScope dataset `OneScience/alphagenome_dataset` is recommended to be downloaded to `data/` under the model package. The default structure is as follows: |
|
|
| ```text |
| data/ |
| reference/ |
| HOMO_SAPIENS/ |
| GRCh38.p13.genome.fa |
| GRCh38.p13.genome.fa.fai |
| v1/ |
| train/ |
| ... |
| ``` |
|
|
| Where: |
|
|
| - `reference/HOMO_SAPIENS/GRCh38.p13.genome.fa` is the human reference genome FASTA. |
| - `.fai` is the FASTA index file. |
| - `v1/train/` is the data directory used for track prediction evaluation. |
| - Custom fine-tuning also requires preparing an interval CSV file with column names `chromosome,start,end`, as well as one or more BigWig signal files. |
|
|
| # 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 AlphaGenome open-source model and provides DCU adaptation. The related source code uses the Apache License 2.0. |
| - For scientific research, cite the original paper: [Advancing regulatory variant effect prediction with AlphaGenome](https://www.nature.com/articles/s41586-025-10014-0). |
|
|