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.

AlphaGenomeR authenticates every request to the AlphaGenome API with a personal API key. You pass that key directly to alphagenome_query() via the access_token parameter — no OAuth flow, no session management. Without a valid key the package stops immediately with a clear error.

Get an API key

API keys are issued by Google DeepMind through the AlphaGenome Science Page. Access is free for non-commercial research.
1

Visit the AlphaGenome Science Page

Go to https://deepmind.google/science/alphagenome/ and click the link to request API access.
2

Complete the access request

Fill in your institution and intended research use. Google DeepMind reviews requests for non-commercial eligibility.
3

Receive your key

Once approved, you will receive an API key string. Store it somewhere safe — you will not be able to view it again.
The AlphaGenome API is available for non-commercial research purposes only. Commercial use is not permitted under the terms of access.

Use your API key

Pass the key as the access_token argument to alphagenome_query():
library(AlphaGenomeR)

results <- alphagenome_query(
  access_token = "YOUR_ALPHAGENOME_API_KEY",
  genomic_region = "chr17:42560601-43609177",
  requested_outputs = c("RNA_SEQ", "ATAC")
)
access_token is a required parameter. If it is missing, alphagenome_query() stops immediately:
Error in alphagenome_query(...) : API key is not provided.

Store the key securely

Hardcoding secrets in scripts is a security risk, especially when sharing code or committing to version control. Use an environment variable instead.
1

Set the environment variable

Add the following line to your ~/.Renviron file so R loads it automatically at startup:
ALPHAGENOME_API_KEY=your_key_here
Then restart your R session, or call readRenviron("~/.Renviron") to reload without restarting.
2

Read the key with Sys.getenv()

Retrieve the value at runtime rather than writing it into your script:
library(AlphaGenomeR)

api_key <- Sys.getenv("ALPHAGENOME_API_KEY")

results <- alphagenome_query(
  access_token = api_key,
  genomic_region = "chr17:42560601-43609177",
  requested_outputs = c("RNA_SEQ", "ATAC", "CAGE")
)
Add ~/.Renviron to your .gitignore if your home directory is under version control, and never commit a file that contains a raw API key.

Error handling

ConditionError message
access_token argument is missingAPI key is not provided.
genomic_region argument is missingGenomic region is not provided.
AlphaGenome Python package not installedThe 'alphagenome' Python package is not installed. Please run: pip install alphagenome
If Sys.getenv("ALPHAGENOME_API_KEY") returns an empty string because the variable was not set, alphagenome_query() will receive an empty access_token and the API itself will reject the request. Validate before calling if you want a cleaner error:
api_key <- Sys.getenv("ALPHAGENOME_API_KEY")

if (nchar(api_key) == 0) {
  stop("ALPHAGENOME_API_KEY environment variable is not set.")
}

results <- alphagenome_query(
  access_token = api_key,
  genomic_region = "chr17:42560601-43609177"
)

Build docs developers (and LLMs) love