AlphaGenome
Project description
AlphaGenome (wip)
Implementation of AlphaGenome, Deepmind's updated genomic attention model
Appreciation
- Miquel Girotto for contributing the organism, output embedding, and all the splicing prediction heads!
Install
$ pip install alphagenome-pytorch
Usage
The main unet transformer, without any heads
import torch
from alphagenome_pytorch import AlphaGenome
model = AlphaGenome()
dna = torch.randint(0, 5, (2, 8192))
# organism_index - 0 for human, 1 for mouse - can be changed with `num_organisms` on `AlphaGenome`
embeds_1bp, embeds_128bp, embeds_pair = model(dna, organism_index = 0) # (2, 8192, 1536), (2, 64, 3072), (2, 4, 4, 128)
Adding splice heads (thanks to @MiqG)
import torch
from alphagenome_pytorch import AlphaGenome
model = AlphaGenome()
model.add_splice_heads(
'human',
num_tracks_1bp = 10,
num_tracks_128bp = 10,
num_splicing_contexts = 64, # 2 strands x num. CURIE conditions
)
dna = torch.randint(0, 5, (2, 8192))
organism_index = torch.tensor([0, 1]) # the organism that each sequence belongs to
splice_donor_idx = torch.tensor([[10, 100, 34], [24, 546, 870]])
splice_acceptor_idx = torch.tensor([[15, 103, 87], [56, 653, 900]])
# get sequence embeddings
embeddings_1bp, embeddings_128bp, embeddings_pair = model(dna, organism_index, return_embeds = True) # (2, 8192, 1536), (2, 64, 3072), (2, 4, 4, 128)
# get track predictions
out = model(
dna,
organism_index,
splice_donor_idx = splice_donor_idx,
splice_acceptor_idx = splice_acceptor_idx
)
for organism, outputs in out.items():
for out_head, out_values in outputs.items():
print(organism, out_head, out_values.shape)
# human 1bp_tracks torch.Size([2, 8192, 10])
# human 128bp_tracks torch.Size([2, 64, 10])
# human contact_head torch.Size([2, 4, 4, 128])
# human splice_probs torch.Size([2, 8192, 5])
# human splice_usage torch.Size([2, 8192, 64])
# human splice_juncs torch.Size([2, 3, 3, 64])
Contributing
First install locally with the following
$ pip install '.[test]' # or uv pip install . '[test]'
Then make your changes, add a test to tests/test_alphagenome.py
$ pytest tests
That's it
Vibe coding with some attention network is totally welcomed, if it works
Citations
@article{avsec2025alphagenome,
title = {AlphaGenome: advancing regulatory variant effect prediction with a unified DNA sequence model},
author = {Avsec, {\v{Z}}iga and Latysheva, Natasha and Cheng, Jun and Novati, Guido and Taylor, Kyle R and Ward, Tom and Bycroft, Clare and Nicolaisen, Lauren and Arvaniti, Eirini and Pan, Joshua and Thomas, Raina and Dutordoir, Vincent and Perino, Matteo and De, Soham and Karollus, Alexander and Gayoso, Adam and Sargeant, Toby and Mottram, Anne and Wong, Lai Hong and Drot{\'a}r, Pavol and Kosiorek, Adam and Senior, Andrew and Tanburn, Richard and Applebaum, Taylor and Basu, Souradeep and Hassabis, Demis and Kohli, Pushmeet},
year = {2025}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alphagenome_pytorch-0.0.26.tar.gz.
File metadata
- Download URL: alphagenome_pytorch-0.0.26.tar.gz
- Upload date:
- Size: 499.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
476f780b07f18c50999943f8f5ae45887623c37afcf961ebc2c9e07278d1e8e0
|
|
| MD5 |
a6bd99927a1369b8a46449bf2c3a08a4
|
|
| BLAKE2b-256 |
d6c02b060aa74d9d9443162322b9fd114ad331c74c130df7aec7d6d3e4e050ec
|
File details
Details for the file alphagenome_pytorch-0.0.26-py3-none-any.whl.
File metadata
- Download URL: alphagenome_pytorch-0.0.26-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c9b2ffb21a45905227d7cf08222e678f254402254d6aaa56d9403c808666709
|
|
| MD5 |
8aeda5065b5895afe83649c15a1a9543
|
|
| BLAKE2b-256 |
e83b63078d3e6b57369a6858b86961ed2ffeb9028976a89fdb230e1454544179
|