Skill Tracer
Skills › Scientific Agent Skills › alphagenome › model-api.md

model-api.md

271 lines · skills/alphagenome/references/model-api.md at 5f2bc03

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1# AlphaGenome model API (`alphagenome.models.dna_client`)
2
3Reviewed 2026-09-30 against released `alphagenome` 0.9.0, the current official
4SDK source, scoring definitions, and research implementation. Network examples
5are illustrative; local SDK/plotting contracts were exercised without a key. The client is a thin gRPC wrapper: no
6weights, no GPU, one API key. The same key serves the Atlas.
7

AlphaGenome model API (alphagenome.models.dna_client)

Reviewed 2026-09-30 against released alphagenome 0.9.0, the current official SDK source, scoring definitions, and research implementation. Network examples are illustrative; local SDK/plotting contracts were exercised without a key. The client is a thin gRPC wrapper: no weights, no GPU, one API key. The same key serves the Atlas.

Raw lines 1 to 7
8## Setup
9
10```bash
11uv pip install alphagenome # PyPI; Python >= 3.10, tested here on 3.12 and 3.13
12export ALPHAGENOME_API_KEY=... # https://deepmind.google.com/science/alphagenome
13```
15```python
16import os
17from alphagenome.data import gene_annotation, genome, transcript
18from alphagenome.models import dna_client, variant_scorers
19from alphagenome.visualization import plot_components
21dna_model = dna_client.create(os.environ["ALPHAGENOME_API_KEY"], timeout=30)
22```
24`alphagenome.colab_utils.get_api_key()` reads `ALPHA_GENOME_API_KEY` (note the
25underscore) or a Colab secret of that name. The scripts here accept both.

Setup

uv pip install alphagenome            # PyPI; Python >= 3.10, tested here on 3.12 and 3.13
export ALPHAGENOME_API_KEY=...        # https://deepmind.google.com/science/alphagenome
import os
from alphagenome.data import gene_annotation, genome, transcript
from alphagenome.models import dna_client, variant_scorers
from alphagenome.visualization import plot_components

dna_model = dna_client.create(os.environ["ALPHAGENOME_API_KEY"], timeout=30)

alphagenome.colab_utils.get_api_key() reads ALPHA_GENOME_API_KEY (note the underscore) or a Colab secret of that name. The scripts here accept both.

Raw lines 8 to 26
27## Coordinates and inputs
29| Object | Convention |
30| --- | --- |
31| `genome.Interval(chromosome, start, end, strand='.')` | **0-based, half-open** |
32| `genome.Variant(chromosome, position, reference_bases, alternate_bases, name='')` | **1-based** position, VCF-style anchored alleles |
33| `genome.Variant.from_str("chr22:36201698:A>C")` | adds `chr` if missing; `VariantFormat.GNOMAD` (`22-1024-A-C`), `GTEX` (`chr22_1024_A_C_b38`), `OPEN_TARGETS` (`22_1024_A_C`), `OPEN_TARGETS_BIGQUERY` (`22:1024:A:C`) |
34| `variant.reference_interval.resize(width)` | the usual way to build the model window around a variant |
35| Human | hg38 (GRCh38.p13) |
36| Mouse | mm10 (GRCm38.p6), `organism=dna_client.Organism.MUS_MUSCULUS` |
38Supported input widths (`dna_client.SUPPORTED_SEQUENCE_LENGTHS`):
40| Name | bp | Use |
41| --- | --- | --- |
42| `SEQUENCE_LENGTH_16KB` | 16,384 | ISM scans, fast iteration |
43| `SEQUENCE_LENGTH_100KB` | 131,072 | |
44| `SEQUENCE_LENGTH_500KB` | 524,288 | |
45| `SEQUENCE_LENGTH_1MB` | 1,048,576 | default; best accuracy and full distal context; ContactMapScorer uses a 1 Mb mask |
47Any other width raises. Sequences may contain `N` (pad with `'N'` for short
48constructs: `seq.center(dna_client.SEQUENCE_LENGTH_1MB, 'N')`). 2 kb inputs were
49removed in 0.5.0.

Coordinates and inputs

ObjectConvention
genome.Interval(chromosome, start, end, strand='.')0-based, half-open
genome.Variant(chromosome, position, reference_bases, alternate_bases, name='')1-based position, VCF-style anchored alleles
genome.Variant.from_str("chr22:36201698:A>C")adds chr if missing; VariantFormat.GNOMAD (22-1024-A-C), GTEX (chr22_1024_A_C_b38), OPEN_TARGETS (22_1024_A_C), OPEN_TARGETS_BIGQUERY (22:1024:A:C)
variant.reference_interval.resize(width)the usual way to build the model window around a variant
Humanhg38 (GRCh38.p13)
Mousemm10 (GRCm38.p6), organism=dna_client.Organism.MUS_MUSCULUS

Supported input widths (dna_client.SUPPORTED_SEQUENCE_LENGTHS):

NamebpUse
SEQUENCE_LENGTH_16KB16,384ISM scans, fast iteration
SEQUENCE_LENGTH_100KB131,072
SEQUENCE_LENGTH_500KB524,288
SEQUENCE_LENGTH_1MB1,048,576default; best accuracy and full distal context; ContactMapScorer uses a 1 Mb mask

Any other width raises. Sequences may contain N (pad with 'N' for short constructs: seq.center(dna_client.SEQUENCE_LENGTH_1MB, 'N')). 2 kb inputs were removed in 0.5.0.

Raw lines 27 to 50
51## Output types (`dna_client.OutputType`)
53| Type | Signal | Resolution | Human tracks |
54| --- | --- | --- | --- |
55| `ATAC`, `DNASE` | chromatin accessibility | 1 bp | 167 / 305 |
56| `CHIP_TF` | TF binding ChIP-seq | 128 bp | 1,617 |
57| `CHIP_HISTONE` | histone marks | 128 bp | 1,116 |
58| `CAGE`, `PROCAP` | transcription initiation (5' ends) | 1 bp | 546 / 12 (PROCAP human only) |
59| `RNA_SEQ` | stranded coverage | 1 bp | 667 |
60| `SPLICE_SITES` | donor/acceptor probability | 1 bp | 4 (donor/acceptor on each strand; 2 after gene-score merging) |
61| `SPLICE_SITE_USAGE` | fraction of transcripts using each site | 1 bp | 734 |
62| `SPLICE_JUNCTIONS` | split-read counts per junction | junction | 734 |
63| `CONTACT_MAPS` | log-fold contact signal over genomic-distance expectation | 2,048 bp bins | 28 |
65These are the published human output counts (5,930 including junction tracks),
66not the strand-merged scorer counts in the Atlas. Query metadata for the
67actual organism and release; metadata fields vary by output type. Track rows carry `name`, `strand`,
68`ontology_curie`, `biosample_name`, `biosample_type`, plus `gtex_tissue`
69(RNA_SEQ, SPLICE_*), `transcription_factor` (CHIP_TF), `histone_mark`
70(CHIP_HISTONE). Discover them with:
72```python
73meta = dna_model.output_metadata(dna_client.Organism.HOMO_SAPIENS)
74df = meta.concatenate() # every output type in one DataFrame
75df[df.biosample_name.str.contains("liver", case=False)][["output_type", "name", "ontology_curie", "biosample_name"]]
76```
78or `python scripts/score_variants.py --list-tracks --query liver -o tracks.tsv`.
80Ontology terms are CURIEs: `UBERON:0002048` (lung), `UBERON:0001157` (colon,
81transverse), `UBERON:0001114` (right liver lobe), `CL:0000084` (T cell),
82`CL:0000236` (B cell), `EFO:0002067` (K562), `CLO:...` for cell lines.
83Passing `ontology_terms=None` returns every track. The `ontology-term-resolution`
84skill turns free text into validated CURIEs; then confirm the term exists in
85`output_metadata`, because the model only has tracks for its training biosamples.

Output types (dna_client.OutputType)

TypeSignalResolutionHuman tracks
ATAC, DNASEchromatin accessibility1 bp167 / 305
CHIP_TFTF binding ChIP-seq128 bp1,617
CHIP_HISTONEhistone marks128 bp1,116
CAGE, PROCAPtranscription initiation (5' ends)1 bp546 / 12 (PROCAP human only)
RNA_SEQstranded coverage1 bp667
SPLICE_SITESdonor/acceptor probability1 bp4 (donor/acceptor on each strand; 2 after gene-score merging)
SPLICE_SITE_USAGEfraction of transcripts using each site1 bp734
SPLICE_JUNCTIONSsplit-read counts per junctionjunction734
CONTACT_MAPSlog-fold contact signal over genomic-distance expectation2,048 bp bins28

These are the published human output counts (5,930 including junction tracks), not the strand-merged scorer counts in the Atlas. Query metadata for the actual organism and release; metadata fields vary by output type. Track rows carry name, strand, ontology_curie, biosample_name, biosample_type, plus gtex_tissue (RNA_SEQ, SPLICE_*), transcription_factor (CHIP_TF), histone_mark (CHIP_HISTONE). Discover them with:

meta = dna_model.output_metadata(dna_client.Organism.HOMO_SAPIENS)
df = meta.concatenate()                      # every output type in one DataFrame
df[df.biosample_name.str.contains("liver", case=False)][["output_type", "name", "ontology_curie", "biosample_name"]]

or python scripts/score_variants.py --list-tracks --query liver -o tracks.tsv.

Ontology terms are CURIEs: UBERON:0002048 (lung), UBERON:0001157 (colon, transverse), UBERON:0001114 (right liver lobe), CL:0000084 (T cell), CL:0000236 (B cell), EFO:0002067 (K562), CLO:... for cell lines. Passing ontology_terms=None returns every track. The ontology-term-resolution skill turns free text into validated CURIEs; then confirm the term exists in output_metadata, because the model only has tracks for its training biosamples.

Raw lines 51 to 86
Runs code python scripts/score_variants.py :78
Names a skill ontology-term-resolution :83
87## Predictions
89```python
90interval = genome.Interval("chr22", 36_201_698 - 2**19, 36_201_698 + 2**19) # 1 Mb
92out = dna_model.predict_interval(
93 interval=interval,
94 requested_outputs=[dna_client.OutputType.RNA_SEQ, dna_client.OutputType.DNASE],
95 ontology_terms=["UBERON:0001157"],
97out.rna_seq.values.shape # (1048576, n_tracks) float32
98out.rna_seq.metadata # track DataFrame
99out.rna_seq.interval, out.rna_seq.resolution
101variant = genome.Variant.from_str("chr22:36201698:A>C")
102vo = dna_model.predict_variant(
103 interval=variant.reference_interval.resize(dna_client.SEQUENCE_LENGTH_1MB),
104 variant=variant,
105 requested_outputs=[dna_client.OutputType.RNA_SEQ],
106 ontology_terms=["UBERON:0001157"],
108vo.reference.rna_seq, vo.alternate.rna_seq # TrackData for REF and ALT haplotypes
110# Illustrative synthetic input, with lower reliability than near-reference DNA.
111out = dna_model.predict_sequence(
112 sequence="ACGT" * (dna_client.SEQUENCE_LENGTH_16KB // 4),
113 requested_outputs=[dna_client.OutputType.DNASE], ontology_terms=["UBERON:0001157"],
115```
117`predict_variants` / `predict_intervals` / `predict_sequences` take lists and run
118in parallel (`max_workers`, default 5). `TrackData` supports
119`filter_to_positive_strand()`, `select_tracks_by_name()`, `slice_by_interval()`,
120`resize()`, `change_resolution()`, `reverse_complement()`, and NumPy-style
121`tdata[interval, mask]` indexing.

Predictions

interval = genome.Interval("chr22", 36_201_698 - 2**19, 36_201_698 + 2**19)   # 1 Mb

out = dna_model.predict_interval(
    interval=interval,
    requested_outputs=[dna_client.OutputType.RNA_SEQ, dna_client.OutputType.DNASE],
    ontology_terms=["UBERON:0001157"],
)
out.rna_seq.values.shape          # (1048576, n_tracks)  float32
out.rna_seq.metadata              # track DataFrame
out.rna_seq.interval, out.rna_seq.resolution

variant = genome.Variant.from_str("chr22:36201698:A>C")
vo = dna_model.predict_variant(
    interval=variant.reference_interval.resize(dna_client.SEQUENCE_LENGTH_1MB),
    variant=variant,
    requested_outputs=[dna_client.OutputType.RNA_SEQ],
    ontology_terms=["UBERON:0001157"],
)
vo.reference.rna_seq, vo.alternate.rna_seq     # TrackData for REF and ALT haplotypes

# Illustrative synthetic input, with lower reliability than near-reference DNA.
out = dna_model.predict_sequence(
    sequence="ACGT" * (dna_client.SEQUENCE_LENGTH_16KB // 4),
    requested_outputs=[dna_client.OutputType.DNASE], ontology_terms=["UBERON:0001157"],
)

predict_variants / predict_intervals / predict_sequences take lists and run in parallel (max_workers, default 5). TrackData supports filter_to_positive_strand(), select_tracks_by_name(), slice_by_interval(), resize(), change_resolution(), reverse_complement(), and NumPy-style tdata[interval, mask] indexing.

Raw lines 87 to 122
123## Variant scoring
125```python
126scorers = list(variant_scorers.RECOMMENDED_VARIANT_SCORERS.values()) # 19 configurations
127adatas = dna_model.score_variant(interval, variant, variant_scorers=scorers) # list[AnnData], one per scorer
128df = variant_scorers.tidy_scores(adatas, match_gene_strand=True) # long DataFrame
129df[["variant_id", "output_type", "variant_scorer", "gene_name", "biosample_name",
130 "ontology_curie", "raw_score", "quantile_score"]]
132# many variants, same window size
133adatas = dna_model.score_variants(
134 [v.reference_interval.resize(dna_client.SEQUENCE_LENGTH_1MB) for v in variants],
135 variants, scorers, organism=dna_client.Organism.HOMO_SAPIENS, max_workers=5)
136df = variant_scorers.tidy_scores(adatas)
137```
139`score_variant` has **no** `ontology_terms` argument: filter `df` on
140`ontology_curie` or `biosample_name` afterwards (or on `adata.var`). At most 20
141scorers per request, no duplicates. `merge_stranded_gene_tracks=True`
142(default) merges + and - RNA-seq tracks for gene-centric scorers.

Variant scoring

scorers = list(variant_scorers.RECOMMENDED_VARIANT_SCORERS.values())    # 19 configurations
adatas = dna_model.score_variant(interval, variant, variant_scorers=scorers)   # list[AnnData], one per scorer
df = variant_scorers.tidy_scores(adatas, match_gene_strand=True)          # long DataFrame
df[["variant_id", "output_type", "variant_scorer", "gene_name", "biosample_name",
    "ontology_curie", "raw_score", "quantile_score"]]

# many variants, same window size
adatas = dna_model.score_variants(
    [v.reference_interval.resize(dna_client.SEQUENCE_LENGTH_1MB) for v in variants],
    variants, scorers, organism=dna_client.Organism.HOMO_SAPIENS, max_workers=5)
df = variant_scorers.tidy_scores(adatas)

score_variant has no ontology_terms argument: filter df on ontology_curie or biosample_name afterwards (or on adata.var). At most 20 scorers per request, no duplicates. merge_stranded_gene_tracks=True (default) merges + and - RNA-seq tracks for gene-centric scorers.

Raw lines 123 to 143
144### Recommended scorers (`RECOMMENDED_VARIANT_SCORERS`)
146| Key | Class | Configuration | Meaning of `raw_score` |
147| --- | --- | --- | --- |
148| `ATAC`, `DNASE`, `CHIP_TF`, `CAGE`, `PROCAP` | `CenterMaskScorer` | width 501, `DIFF_LOG2_SUM` | log2(sum ALT + 1) - log2(sum REF + 1) over the 501 bp around the variant |
149| `CHIP_HISTONE` | `CenterMaskScorer` | width 2001, `DIFF_LOG2_SUM` | same, 2 kb window |
150| `RNA_SEQ` | `GeneMaskLFCScorer` | | `ln(mean ALT + 0.001) - ln(mean REF + 0.001)` over exons; exponentiate to obtain the pseudocount-adjusted ratio |
151| `RNA_SEQ_ACTIVE` | `GeneMaskActiveScorer` | | maximum mean exon activity across the two alleles; **not** a logarithm or difference |
152| `SPLICE_SITES`, `SPLICE_SITE_USAGE` | `GeneMaskSplicingScorer` | width None | max change in site probability / usage within the gene |
153| `SPLICE_JUNCTIONS` | `SpliceJunctionScorer` | | change in junction counts, per junction |
154| `POLYADENYLATION` | `PolyadenylationScorer` | | max log fold change in poly(A) isoform ratio; human only |
155| `CONTACT_MAPS` | `ContactMapScorer` | | mean absolute contact-signal change along the variant bin |
156| `*_ACTIVE` (ATAC, DNASE, CHIP_TF, CHIP_HISTONE, CAGE, PROCAP) | `CenterMaskScorer` | `ACTIVE_SUM` | activity of the stronger allele |
158Custom configurations: `CenterMaskScorer(requested_output, width in {None, 501,
1592001, 10001, 100001, 200001}, aggregation_type in {DIFF_MEAN, DIFF_SUM,
160DIFF_SUM_LOG2, DIFF_LOG2_SUM, L2_DIFF, L2_DIFF_LOG1P, ACTIVE_MEAN, ACTIVE_SUM})`
161and `GeneMaskSplicingScorer(..., width in {None, 101, 1001, 10001})`.
163`quantile_score` is the rank of `raw_score` against a background of common
164variants (gnomAD v3 MAF > 0.01) for that scorer and track, mapped from CDF `p` to `2*p - 1` for signed scorers; unsigned scorers
165retain `[0, 1]` quantiles. Finite background ranks saturate near 1. Quantiles
166are available only for calibrated human recommended configurations; mouse
167and custom configurations can lack the layer entirely. Use it to judge unusualness, the raw
168score to judge magnitude, and never one without the other
169(`references/interpretation.md`).

Recommended scorers (RECOMMENDED_VARIANT_SCORERS)

KeyClassConfigurationMeaning of raw_score
ATAC, DNASE, CHIP_TF, CAGE, PROCAPCenterMaskScorerwidth 501, DIFF_LOG2_SUMlog2(sum ALT + 1) - log2(sum REF + 1) over the 501 bp around the variant
CHIP_HISTONECenterMaskScorerwidth 2001, DIFF_LOG2_SUMsame, 2 kb window
RNA_SEQGeneMaskLFCScorerln(mean ALT + 0.001) - ln(mean REF + 0.001) over exons; exponentiate to obtain the pseudocount-adjusted ratio
RNA_SEQ_ACTIVEGeneMaskActiveScorermaximum mean exon activity across the two alleles; not a logarithm or difference
SPLICE_SITES, SPLICE_SITE_USAGEGeneMaskSplicingScorerwidth Nonemax change in site probability / usage within the gene
SPLICE_JUNCTIONSSpliceJunctionScorerchange in junction counts, per junction
POLYADENYLATIONPolyadenylationScorermax log fold change in poly(A) isoform ratio; human only
CONTACT_MAPSContactMapScorermean absolute contact-signal change along the variant bin
*_ACTIVE (ATAC, DNASE, CHIP_TF, CHIP_HISTONE, CAGE, PROCAP)CenterMaskScorerACTIVE_SUMactivity of the stronger allele

Custom configurations: CenterMaskScorer(requested_output, width in {None, 501, 2001, 10001, 100001, 200001}, aggregation_type in {DIFF_MEAN, DIFF_SUM, DIFF_SUM_LOG2, DIFF_LOG2_SUM, L2_DIFF, L2_DIFF_LOG1P, ACTIVE_MEAN, ACTIVE_SUM}) and GeneMaskSplicingScorer(..., width in {None, 101, 1001, 10001}).

quantile_score is the rank of raw_score against a background of common variants (gnomAD v3 MAF > 0.01) for that scorer and track, mapped from CDF p to 2*p - 1 for signed scorers; unsigned scorers retain [0, 1] quantiles. Finite background ranks saturate near 1. Quantiles are available only for calibrated human recommended configurations; mouse and custom configurations can lack the layer entirely. Use it to judge unusualness, the raw score to judge magnitude, and never one without the other (references/interpretation.md).

Raw lines 144 to 170
171## In silico mutagenesis
173```python
174window = genome.Interval("chr20", 3_753_000, 3_753_400).resize(dna_client.SEQUENCE_LENGTH_16KB)
175ism_interval = window.resize(256) # mutate the central 256 bp (3 x 256 variants)
176scorer = variant_scorers.CenterMaskScorer(
177 requested_output=dna_client.OutputType.DNASE, width=501,
178 aggregation_type=variant_scorers.AggregationType.DIFF_MEAN)
179scores = dna_model.score_ism_variants(interval=window, ism_interval=ism_interval,
180 variant_scorers=[scorer], interval_variant=None)
181# scores: list (per variant) of list (per scorer) of AnnData
182from alphagenome.interpretation import ism
183track_index = 0 # Choose by matching the returned track metadata to the target tissue.
184matrix = ism.ism_matrix(
185 [s[0].X[0, track_index] for s in scores],
186 variants=[s[0].uns["variant"] for s in scores], interval=ism_interval,
188plot_components.plot(
189 [plot_components.SeqLogo(scores=matrix, scores_interval=ism_interval, ylabel="ISM")],
190 interval=ism_interval,
192```
194`interval_variant=` runs the scan on the ALT haplotype. The client chunks ISM
195requests to 10 bp per call; a 256 bp scan is about 26 requests. For an hg38 SNV
196window the Atlas already holds the answer (`atlas_query.py avi --interval`), so
197reserve live ISM for mouse, non-reference backgrounds, or custom scorers.

In silico mutagenesis

window = genome.Interval("chr20", 3_753_000, 3_753_400).resize(dna_client.SEQUENCE_LENGTH_16KB)
ism_interval = window.resize(256)                      # mutate the central 256 bp (3 x 256 variants)
scorer = variant_scorers.CenterMaskScorer(
    requested_output=dna_client.OutputType.DNASE, width=501,
    aggregation_type=variant_scorers.AggregationType.DIFF_MEAN)
scores = dna_model.score_ism_variants(interval=window, ism_interval=ism_interval,
                                      variant_scorers=[scorer], interval_variant=None)
# scores: list (per variant) of list (per scorer) of AnnData
from alphagenome.interpretation import ism
track_index = 0  # Choose by matching the returned track metadata to the target tissue.
matrix = ism.ism_matrix(
    [s[0].X[0, track_index] for s in scores],
    variants=[s[0].uns["variant"] for s in scores], interval=ism_interval,
)
plot_components.plot(
    [plot_components.SeqLogo(scores=matrix, scores_interval=ism_interval, ylabel="ISM")],
    interval=ism_interval,
)

interval_variant= runs the scan on the ALT haplotype. The client chunks ISM requests to 10 bp per call; a 256 bp scan is about 26 requests. For an hg38 SNV window the Atlas already holds the answer (atlas_query.py avi --interval), so reserve live ISM for mouse, non-reference backgrounds, or custom scorers.

Raw lines 171 to 198
199## Gene annotation and plots
201```python
202import pandas as pd
203gtf = pd.read_feather("https://storage.googleapis.com/alphagenome/reference/gencode/hg38/gencode.v46.annotation.gtf.gz.feather")
204gtf = gene_annotation.filter_protein_coding(gtf)
205gtf = gene_annotation.filter_to_mane_select_transcript(gtf) # or filter_to_longest_transcript
206# Extract annotations from the same locus as the earlier REF/ALT prediction.
207plot_interval = variant.reference_interval.resize(20_000)
208transcripts = transcript.TranscriptExtractor(gtf).extract(plot_interval)
209# For a new gene-centred prediction window:
210hbb_interval = gene_annotation.get_gene_interval(gtf, gene_symbol="HBB").resize(dna_client.SEQUENCE_LENGTH_1MB)
212plot_components.plot(
213 [
214 plot_components.TranscriptAnnotation(transcripts),
215 plot_components.OverlaidTracks({"REF": vo.reference.rna_seq, "ALT": vo.alternate.rna_seq},
216 colors={"REF": "dimgrey", "ALT": "red"}),
217 ],
218 interval=plot_interval,
219 annotations=[plot_components.VariantAnnotation([variant])],
221```
223Components: `Tracks`, `OverlaidTracks`, `ContactMaps`, `ContactMapsDiff`,
224`TranscriptAnnotation`, `SeqLogo`, `Sashimi` (splice junctions; filter by
225strand yourself, it has no `strand` argument), with `IntervalAnnotation` and
226`VariantAnnotation` overlays. The Feather GTF uses capitalised column names
227(`Feature`, `Start`, `End`, `Strand`). Mouse annotations: GENCODE vM23 at the
228same bucket path with `mm10`.

Gene annotation and plots

import pandas as pd
gtf = pd.read_feather("https://storage.googleapis.com/alphagenome/reference/gencode/hg38/gencode.v46.annotation.gtf.gz.feather")
gtf = gene_annotation.filter_protein_coding(gtf)
gtf = gene_annotation.filter_to_mane_select_transcript(gtf)   # or filter_to_longest_transcript
# Extract annotations from the same locus as the earlier REF/ALT prediction.
plot_interval = variant.reference_interval.resize(20_000)
transcripts = transcript.TranscriptExtractor(gtf).extract(plot_interval)
# For a new gene-centred prediction window:
hbb_interval = gene_annotation.get_gene_interval(gtf, gene_symbol="HBB").resize(dna_client.SEQUENCE_LENGTH_1MB)

plot_components.plot(
    [
        plot_components.TranscriptAnnotation(transcripts),
        plot_components.OverlaidTracks({"REF": vo.reference.rna_seq, "ALT": vo.alternate.rna_seq},
                                       colors={"REF": "dimgrey", "ALT": "red"}),
    ],
    interval=plot_interval,
    annotations=[plot_components.VariantAnnotation([variant])],
)

Components: Tracks, OverlaidTracks, ContactMaps, ContactMapsDiff, TranscriptAnnotation, SeqLogo, Sashimi (splice junctions; filter by strand yourself, it has no strand argument), with IntervalAnnotation and VariantAnnotation overlays. The Feather GTF uses capitalised column names (Feature, Start, End, Strand). Mouse annotations: GENCODE vM23 at the same bucket path with mm10.

Raw lines 199 to 229
230## Errors, retries, quota
232`dna_client` wraps calls in `retry_rpc` (retries on `RESOURCE_EXHAUSTED` and
233`UNAVAILABLE`). gRPC errors surface as `grpc.RpcError`; `error.code()` tells you
234whether it is a bad key (`UNAUTHENTICATED` / `INVALID_ARGUMENT`), a quota stop
235(`RESOURCE_EXHAUSTED`), or a bad argument. The streaming RPC retry policy
236allows five attempts, starts at 1.25 s with jitter, and multiplies delay by 1.5.
237`create(timeout=30)` only limits channel readiness: the model client does not
238set a per-request deadline, and metadata retrieval is not decorated for retries. Quotas are per key and unpublished;
239the API is free for non-commercial use, and DeepMind states outputs may not be
240used to train other ML models. Commercial use goes through Google Cloud Model
241Garden.

Errors, retries, quota

dna_client wraps calls in retry_rpc (retries on RESOURCE_EXHAUSTED and UNAVAILABLE). gRPC errors surface as grpc.RpcError; error.code() tells you whether it is a bad key (UNAUTHENTICATED / INVALID_ARGUMENT), a quota stop (RESOURCE_EXHAUSTED), or a bad argument. The streaming RPC retry policy allows five attempts, starts at 1.25 s with jitter, and multiplies delay by 1.5. create(timeout=30) only limits channel readiness: the model client does not set a per-request deadline, and metadata retrieval is not decorated for retries. Quotas are per key and unpublished; the API is free for non-commercial use, and DeepMind states outputs may not be used to train other ML models. Commercial use goes through Google Cloud Model Garden.

Raw lines 230 to 242
243## Official material
245- Docs: https://www.alphagenomedocs.com/ (quick start, essential commands,
246 batch variant scoring, splicing variant scoring, PSI derivation, haplotype
247 workaround, tissue ontology mapping, visualisation tour, FAQ).
248- Code: https://github.com/google-deepmind/alphagenome (client) and
249 https://github.com/google-deepmind/alphagenome_research (model code).
250- DeepMind agent skills with worked variant reports:
251 https://github.com/google-deepmind/science-skills (Apache-2.0).
252- Paper: Avsec Ž. *et al.*, *Nature* 649, 1206-1218 (2026),
253 doi:10.1038/s41586-025-10014-0.

Official material

  • Docs: https://www.alphagenomedocs.com/ (quick start, essential commands, batch variant scoring, splicing variant scoring, PSI derivation, haplotype workaround, tissue ontology mapping, visualisation tour, FAQ).
  • Code: https://github.com/google-deepmind/alphagenome (client) and https://github.com/google-deepmind/alphagenome_research (model code).
  • DeepMind agent skills with worked variant reports: https://github.com/google-deepmind/science-skills (Apache-2.0).
  • Paper: Avsec Ž. et al., Nature 649, 1206-1218 (2026), doi:10.1038/s41586-025-10014-0.
Raw lines 243 to 254
255## Verified transport and source contracts
257Both clients open a TLS gRPC channel to `gdmscience.googleapis.com:443` and
258attach `x-goog-api-key` metadata; they are not REST/JSON clients. The model
259service is `google.gdm.gdmscience.alphagenome.v1main.DnaModelService`.
260`predict_sequence`, `predict_interval`, `predict_variant`, `score_variant`,
261and `score_ism_variants` use `PredictSequence`, `PredictInterval`,
262`PredictVariant`, `ScoreVariant`, and `ScoreIsmVariant` streaming RPCs;
263`output_metadata` uses `GetMetadata`. Protobuf tensors and track/junction
264metadata become `Output`, `VariantOutput`, or `list[AnnData]` in the SDK.
265Batch methods parallelize single calls; no page tokens apply to model calls.
267Sources: [SDK and protocol definitions](https://github.com/google-deepmind/alphagenome),
268[scoring definitions](https://www.alphagenomedocs.com/variant_scoring.html),
269[output metadata](https://www.alphagenomedocs.com/exploring_model_metadata.html),
270[FAQ](https://www.alphagenomedocs.com/faqs.html), and
271[RNA-seq scorer implementation](https://github.com/google-deepmind/alphagenome_research/blob/main/src/alphagenome_research/model/variant_scoring/gene_mask.py).

Verified transport and source contracts

Both clients open a TLS gRPC channel to gdmscience.googleapis.com:443 and attach x-goog-api-key metadata; they are not REST/JSON clients. The model service is google.gdm.gdmscience.alphagenome.v1main.DnaModelService. predict_sequence, predict_interval, predict_variant, score_variant, and score_ism_variants use PredictSequence, PredictInterval, PredictVariant, ScoreVariant, and ScoreIsmVariant streaming RPCs; output_metadata uses GetMetadata. Protobuf tensors and track/junction metadata become Output, VariantOutput, or list[AnnData] in the SDK. Batch methods parallelize single calls; no page tokens apply to model calls.

Sources: SDK and protocol definitions, scoring definitions, output metadata, FAQ, and RNA-seq scorer implementation.

Raw lines 255 to 271