Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/BDB-Genomics/AlphaGenomeR/llms.txt

Use this file to discover all available pages before exploring further.

The three-dimensional organization of the genome shapes gene regulation by bringing distal enhancers into proximity with their target promoters and partitioning chromosomes into structural domains. AlphaGenomeR exposes AlphaGenome’s 3D genome predictions through alphagenome_get_contact_maps(), returning a Hi-C-like contact frequency matrix for the queried 1 MB interval.

What contact maps represent

A contact map encodes the predicted interaction frequency between every pair of genomic loci within the queried window. High values indicate that two loci are frequently co-localized in 3D space — consistent with topologically associating domains (TADs), chromatin loops, or compartment boundaries. The predictions are analogous to Hi-C or Micro-C data but derived from DNA sequence alone. The $values matrix is square: each row and column corresponds to a genomic bin within the 1 MB window, and each cell contains the predicted contact frequency between that pair of bins.

How to request contact maps

Requested output token: "CONTACT_MAPS"
Extractor function: alphagenome_get_contact_maps(response_body)
Returns: list($values, $metadata) — a square numeric matrix of contact frequencies and a metadata data frame describing the prediction tracks.
library(AlphaGenomeR)

api_key <- Sys.getenv("ALPHAGENOME_API_KEY")
region  <- "chr17:42560601-43609177"

results <- alphagenome_query(
  access_token     = api_key,
  genomic_region   = region,
  ontology_terms   = c("UBERON:0002048"),  # Lung
  requested_outputs = c("CONTACT_MAPS")
)

contacts <- alphagenome_get_contact_maps(results)

# Inspect the contact matrix dimensions
dim(contacts$values)  # square matrix of contact frequencies

# View track metadata
print(contacts$metadata)

Visualizing contact maps

The square contact matrix can be plotted directly with base R graphics or with Bioconductor packages for richer annotation.
# Rotate and plot using image()
image(contacts$values,
      col  = colorRampPalette(c("white", "red"))(100),
      xlab = "Genomic position",
      ylab = "Genomic position",
      main = "Predicted contact map")
Apply a log transform (log1p(contacts$values)) before plotting to compress the dynamic range and make lower-frequency contacts visible alongside high-frequency diagonal interactions.

Combining contact maps with other modalities

Contact map predictions are most informative when overlaid with accessibility and expression data to identify enhancer–promoter loops and TAD boundaries.
results <- alphagenome_query(
  access_token     = api_key,
  genomic_region   = region,
  ontology_terms   = c("UBERON:0002048"),  # Lung
  requested_outputs = c("CONTACT_MAPS", "ATAC", "RNA_SEQ")
)

contacts  <- alphagenome_get_contact_maps(results)
atac_data <- alphagenome_get_atac(results)
rna_data  <- alphagenome_get_rna_seq(results)

# Contact matrix dimensions
dim(contacts$values)

# Number of genomic bins matches the position axis of other modalities
nrow(contacts$values) == nrow(atac_data$values)

Resolution and window size

Contact map predictions are returned at the model’s native resolution for a 1 MB genomic window. The bin size is determined by the AlphaGenome model architecture — inspect contacts$metadata for the resolution details associated with each prediction track.
alphagenome_query() requires a genomic region of exactly 1 MB (1,048,576 bp for hg38 intervals). Regions that are too short or too long will be rejected by the API. See the genomic regions guide for how to construct valid region strings.
If "CONTACT_MAPS" is not included in requested_outputs, alphagenome_get_contact_maps() returns NULL. Always check before accessing $values:
contacts <- alphagenome_get_contact_maps(results)
if (!is.null(contacts)) {
  image(log1p(contacts$values))
}

Build docs developers (and LLMs) love