# genomicsxai/alphagenome-pytorch architecture

> Architecture diagram of the GitHub repository genomicsxai/alphagenome-pytorch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/genomicsxai/alphagenome-pytorch
- Repository: https://github.com/genomicsxai/alphagenome-pytorch

## Overview

AlphaGenome PyTorch is a genomic-sequence prediction model and toolkit. The main workflow loads pretrained weights, accepts DNA sequence, and produces genomic-track, contact-map, and splicing predictions; optional metadata makes outputs easier to interpret. Additional product branches support chromosome-scale prediction and aggregation, variant-effect scoring, fine-tuning, and serving. The graph also shows the model’s prediction-head layer. Edges are limited to README-described workflows and relationships visible in the supplied source index or excerpts; unsampled implementations are represented by their exact tree paths.

Main entry points: [`src/alphagenome_pytorch/model.py`](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/model.py) (AlphaGenome model), [`src/alphagenome_pytorch/variant_scoring/inference.py`](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/variant_scoring/inference.py) (Variant scoring), [`src/alphagenome_pytorch/extensions/serving/router.py`](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/serving/router.py) (Model router), [`src/alphagenome_pytorch/cli/predict.py`](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/cli/predict.py) (Prediction CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model["Model and outputs"]
  node_model_api["AlphaGenome model<br/>[model.py]"]
  node_config["Model configuration<br/>[config.py]"]
  node_architecture["Model layers<br/>[layers.py]"]
  node_heads["Prediction heads<br/>[heads.py]"]
  node_splicing["Splicing utilities<br/>[splicing.py]"]
  node_named["Named outputs<br/>[named_outputs.py]"]
end

subgraph group_prediction["Prediction workflows"]
  node_cli_predict["Prediction CLI<br/>[predict.py]"]
  node_chromosome["Chromosome inference<br/>[full_chromosome.py]"]
  node_regions["Region inference<br/>[regions.py]"]
  node_aggregation["Track aggregation<br/>[aggregation.py]"]
  node_outputs["Genomic predictions"]
end

subgraph group_variant["Variant analysis"]
  node_variant_inference["Variant scoring<br/>[inference.py]"]
  node_annotations["Gene annotations<br/>[annotations.py]"]
  node_scorers["Variant scorers<br/>[base.py]"]
  node_score_aggregation["Score aggregation<br/>[aggregations.py]"]
  node_variant_result["Variant effects"]
end

subgraph group_finetuning["Fine-tuning"]
  node_transfer["Transfer setup<br/>[transfer.py]"]
  node_training["Fine-tuning training<br/>[training.py]"]
  node_checkpoint["Checkpointing<br/>[checkpointing.py]"]
  node_adapters["Fine-tuning adapters<br/>[adapters.py]"]
  node_distributed["Distributed training<br/>[distributed.py]"]
  node_logging["Training logging<br/>[logging.py]"]
end

subgraph group_serving["Model serving"]
  node_serving_router["Model router<br/>[router.py]"]
  node_bundle["Model bundles<br/>[bundle.py]"]
  node_serving_adapter["Serving adapter<br/>[adapter.py]"]
  node_rest["REST service<br/>[rest_service.py]"]
  node_grpc["gRPC service<br/>[grpc_service.py]"]
end

node_user(("Researcher"))
node_weights["Pretrained weights"]
node_sequence["DNA sequence"]

node_user -->|"loads model"| node_model_api
node_weights -->|"loads weights"| node_model_api
node_sequence -->|"provides sequence"| node_model_api
node_model_api -->|"uses layers"| node_architecture
node_model_api -->|"uses configuration"| node_config
node_model_api -->|"runs heads"| node_heads
node_model_api -->|"formats outputs"| node_named
node_model_api -->|"uses utilities"| node_splicing
node_model_api -->|"predicts tracks"| node_outputs
node_user -->|"requests prediction"| node_cli_predict
node_cli_predict -->|"loads model"| node_model_api
node_cli_predict -->|"runs chromosome inference"| node_chromosome
node_chromosome -->|"aggregates tracks"| node_aggregation
node_regions -->|"uses inference"| node_chromosome
node_user -->|"requests variant scoring"| node_variant_inference
node_variant_inference -->|"runs model"| node_model_api
node_variant_inference -->|"queries annotations"| node_annotations
node_variant_inference -->|"dispatches scoring"| node_scorers
node_variant_inference -->|"aggregates scores"| node_score_aggregation
node_variant_inference -->|"returns effects"| node_variant_result
node_user -->|"configures fine-tuning"| node_transfer
node_transfer -->|"creates adapters"| node_adapters
node_user -->|"starts training"| node_training
node_training -->|"saves checkpoints"| node_checkpoint
node_training -->|"uses distributed training"| node_distributed
node_logging -->|"uses rank utilities"| node_distributed
node_serving_router -->|"builds adapter"| node_serving_adapter
node_serving_router -->|"loads bundles"| node_bundle
node_rest -->|"routes requests"| node_serving_router
node_grpc -->|"routes requests"| node_serving_router

click node_model_api "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/model.py"
click node_config "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/config.py"
click node_architecture "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/layers.py"
click node_heads "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/heads.py"
click node_splicing "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/utils/splicing.py"
click node_named "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/named_outputs.py"
click node_cli_predict "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/cli/predict.py"
click node_chromosome "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/inference/full_chromosome.py"
click node_regions "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/inference/regions.py"
click node_aggregation "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/aggregation.py"
click node_variant_inference "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/variant_scoring/inference.py"
click node_annotations "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/variant_scoring/annotations.py"
click node_scorers "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/variant_scoring/scorers/base.py"
click node_score_aggregation "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/variant_scoring/aggregations.py"
click node_transfer "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/finetuning/transfer.py"
click node_training "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/finetuning/training.py"
click node_checkpoint "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/finetuning/checkpointing.py"
click node_adapters "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/finetuning/adapters.py"
click node_distributed "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/finetuning/distributed.py"
click node_logging "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/finetuning/logging.py"
click node_serving_router "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/serving/router.py"
click node_bundle "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/serving/bundle.py"
click node_serving_adapter "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/serving/adapter.py"
click node_rest "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/serving/rest_service.py"
click node_grpc "https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/serving/grpc_service.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_model_api,node_config,node_architecture,node_heads,node_splicing,node_named toneBlue
class node_cli_predict,node_chromosome,node_regions,node_aggregation,node_outputs toneAmber
class node_variant_inference,node_annotations,node_scorers,node_score_aggregation,node_variant_result toneMint
class node_transfer,node_training,node_checkpoint,node_adapters,node_distributed,node_logging toneRose
class node_serving_router,node_bundle,node_serving_adapter,node_rest,node_grpc,node_user,node_weights,node_sequence toneIndigo
```

## Components

### Model and outputs

- [AlphaGenome model](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/model.py): `src/alphagenome_pytorch/model.py`
- [Model configuration](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/config.py): `src/alphagenome_pytorch/config.py`
- [Model layers](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/layers.py): `src/alphagenome_pytorch/layers.py`
- [Prediction heads](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/heads.py): `src/alphagenome_pytorch/heads.py`
- [Splicing utilities](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/utils/splicing.py): `src/alphagenome_pytorch/utils/splicing.py`
- [Named outputs](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/named_outputs.py): `src/alphagenome_pytorch/named_outputs.py`

### Prediction workflows

- [Prediction CLI](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/cli/predict.py): `src/alphagenome_pytorch/cli/predict.py`
- [Chromosome inference](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/inference/full_chromosome.py): `src/alphagenome_pytorch/extensions/inference/full_chromosome.py`
- [Region inference](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/inference/regions.py): `src/alphagenome_pytorch/extensions/inference/regions.py`
- [Track aggregation](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/aggregation.py): `src/alphagenome_pytorch/aggregation.py`
- **Genomic predictions**

### Variant analysis

- [Variant scoring](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/variant_scoring/inference.py): `src/alphagenome_pytorch/variant_scoring/inference.py`
- [Gene annotations](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/variant_scoring/annotations.py): `src/alphagenome_pytorch/variant_scoring/annotations.py`
- [Variant scorers](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/variant_scoring/scorers/base.py): `src/alphagenome_pytorch/variant_scoring/scorers/base.py`
- [Score aggregation](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/variant_scoring/aggregations.py): `src/alphagenome_pytorch/variant_scoring/aggregations.py`
- **Variant effects**

### Fine-tuning

- [Transfer setup](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/finetuning/transfer.py): `src/alphagenome_pytorch/extensions/finetuning/transfer.py`
- [Fine-tuning training](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/finetuning/training.py): `src/alphagenome_pytorch/extensions/finetuning/training.py`
- [Checkpointing](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/finetuning/checkpointing.py): `src/alphagenome_pytorch/extensions/finetuning/checkpointing.py`
- [Fine-tuning adapters](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/finetuning/adapters.py): `src/alphagenome_pytorch/extensions/finetuning/adapters.py`
- [Distributed training](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/finetuning/distributed.py): `src/alphagenome_pytorch/extensions/finetuning/distributed.py`
- [Training logging](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/finetuning/logging.py): `src/alphagenome_pytorch/extensions/finetuning/logging.py`

### Model serving

- [Model router](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/serving/router.py): `src/alphagenome_pytorch/extensions/serving/router.py`
- [Model bundles](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/serving/bundle.py): `src/alphagenome_pytorch/extensions/serving/bundle.py`
- [Serving adapter](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/serving/adapter.py): `src/alphagenome_pytorch/extensions/serving/adapter.py`
- [REST service](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/serving/rest_service.py): `src/alphagenome_pytorch/extensions/serving/rest_service.py`
- [gRPC service](https://github.com/genomicsxai/alphagenome-pytorch/blob/main/src/alphagenome_pytorch/extensions/serving/grpc_service.py): `src/alphagenome_pytorch/extensions/serving/grpc_service.py`

### Other components

- **Researcher**
- **Pretrained weights**
- **DNA sequence**

## Connections

- Researcher → AlphaGenome model: loads model
- Pretrained weights → AlphaGenome model: loads weights
- DNA sequence → AlphaGenome model: provides sequence
- AlphaGenome model → Model layers: uses layers (evidence: `src/alphagenome_pytorch/model.py`)
- AlphaGenome model → Model configuration: uses configuration (evidence: `src/alphagenome_pytorch/model.py`)
- AlphaGenome model → Prediction heads: runs heads (evidence: `src/alphagenome_pytorch/model.py`)
- AlphaGenome model → Named outputs: formats outputs (evidence: `src/alphagenome_pytorch/model.py`)
- AlphaGenome model → Splicing utilities: uses utilities (evidence: `src/alphagenome_pytorch/model.py`)
- AlphaGenome model → Genomic predictions: predicts tracks
- Researcher → Prediction CLI: requests prediction
- Prediction CLI → AlphaGenome model: loads model (evidence: `src/alphagenome_pytorch/cli/predict.py`)
- Prediction CLI → Chromosome inference: runs chromosome inference (evidence: `src/alphagenome_pytorch/cli/predict.py`)
- Chromosome inference → Track aggregation: aggregates tracks (evidence: `src/alphagenome_pytorch/extensions/inference/full_chromosome.py`)
- Region inference → Chromosome inference: uses inference (evidence: `src/alphagenome_pytorch/extensions/inference/regions.py`)
- Researcher → Variant scoring: requests variant scoring
- Variant scoring → AlphaGenome model: runs model (evidence: `src/alphagenome_pytorch/variant_scoring/inference.py`)
- Variant scoring → Gene annotations: queries annotations (evidence: `src/alphagenome_pytorch/variant_scoring/inference.py`)
- Variant scoring → Variant scorers: dispatches scoring (evidence: `src/alphagenome_pytorch/variant_scoring/inference.py`)
- Variant scoring → Score aggregation: aggregates scores (evidence: `src/alphagenome_pytorch/variant_scoring/inference.py`)
- Variant scoring → Variant effects: returns effects
- Researcher → Transfer setup: configures fine-tuning
- Transfer setup → Fine-tuning adapters: creates adapters (evidence: `src/alphagenome_pytorch/extensions/finetuning/transfer.py`)
- Researcher → Fine-tuning training: starts training
- Fine-tuning training → Checkpointing: saves checkpoints (evidence: `src/alphagenome_pytorch/extensions/finetuning/training.py`)
- Fine-tuning training → Distributed training: uses distributed training (evidence: `src/alphagenome_pytorch/extensions/finetuning/training.py`)
- Training logging → Distributed training: uses rank utilities (evidence: `src/alphagenome_pytorch/extensions/finetuning/logging.py`)
- Model router → Serving adapter: builds adapter (evidence: `src/alphagenome_pytorch/extensions/serving/router.py`)
- Model router → Model bundles: loads bundles (evidence: `src/alphagenome_pytorch/extensions/serving/router.py`)
- REST service → Model router: routes requests (evidence: `src/alphagenome_pytorch/extensions/serving/rest_service.py`)
- gRPC service → Model router: routes requests (evidence: `src/alphagenome_pytorch/extensions/serving/grpc_service.py`)
