Opentargets Database
Google DeepMindOfficialPublished by Google DeepMind
- Skill
- Tool integration
- Science and research
- Apache-2.0
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The Open Targets Database skill provides a structured interface to the Open Targets Platform GraphQL API. It enables researchers to retrieve aggregated evidence from genetics, pathways, animal models, and clinical trials. By using the provided Python wrapper, users can perform complex queries to rank target-disease associations, identify druggable genes, and explore clinical trial data while adhering to API best practices and fair-use policies.
What it does
- Fetches target-disease associations and ranks them based on multi-modal evidence.
- Retrieves druggability, tractability, and clinical safety data for specific gene targets.
- Identifies drugs and clinical candidates associated with specific diseases.
- Performs Locus-to-Gene (L2G) predictions to identify causal genes at genomic loci.
- Searches for disease metadata using standard identifiers like MONDO or EFO.
- Executes custom GraphQL queries for advanced data retrieval beyond built-in commands.
When to use it
- When identifying potential therapeutic targets for a specific disease.
- When exploring the druggability of a gene or protein.
- When investigating the genetic evidence supporting a target-disease association.
- When looking for clinical trial information for drugs related to a specific condition.
- When performing fine-mapping analysis using credible sets from GWAS studies.
Advantages
- Simplifies complex GraphQL API interactions into easy-to-use command-line subcommands.
- Includes built-in retry logic and fair-use rate limiting.
- Automatically handles response truncation to manage context window usage.
- Provides standardized tools for genomic range searches and L2G analysis.
- Ensures consistent output formatting via JSON files.
Usage examples
- “Find all target genes associated with Rheumatoid Arthritis.”
- The agent uses the get-associated-targets command with the appropriate disease ID to return a list of associated genes and their evidence scores.
- “What is the druggability status of the gene ENSG00000169083?”
- The agent executes the get-target-druggability command to retrieve tractability data and clinical trial safety information for the specified Ensembl ID.
- “Find all drugs in Phase III or higher for a specific disease.”
- The agent uses the get-disease-drugs command with the --min-stage PHASE_3 flag to filter and return relevant clinical candidates.
- “Identify the most likely causal gene for a specific variant.”
- The agent runs the get-l2g command for the given variant ID to retrieve Locus-to-Gene predictions.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/google-deepmind/opentargets-database/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip opentargets-database.zip -d .agents/skills
Documentation by Google DeepMind
Open Targets Database Skill
Overview
This skill provides access to the Open Targets Platform GraphQL API. It aggregates multi-modal evidence from genetics (GWAS/eQTL), pathways, animal models, and clinical trials to rank target-disease associations and identify druggable genes.
Prerequisites
uv: Read theuvskill and follow its Setup instructions to ensureuvis installed and on PATH.User Notification: If .licenses/opentargets_database_LICENSE.txt does not already exist in the workspace root directory then (1) prominently notify the user to check the terms at https://platform-docs.opentargets.org/licence, then (2) create the file recording the notification text and timestamp.
Core Rules
Use the Wrapper: ALWAYS execute the provided helper scripts to query the database rather than accessing the database directly. The scripts automatically enforce fair use and implement retry logic.
Output Flag: The
--outputflag is always required as output can be very large. Usejqor write your own code to process this JSON file.Notification: If this skill is used, ensure this is mentioned in the output.
Quick Reference
Always use the provided Python script scripts/query_opentargets.py to quickly
query the database. It handles API communication, retries, formatting, and
automatically truncates overly large responses. NEVER write your own curl or
similar requests.
Usage:
uv run scripts/query_opentargets.py --output /tmp/opentargets_results.json [OPTIONS] COMMAND [ARGS]...Common Options:
--output PATH: Required. Path to write the JSON output file.--limit N: Limit the number of items returned in arrays (default is 50). Use a smaller number like 10 when doing preliminary exploration.--page-size N: Set the API pagination size (default is 200). Increase if you need more results (e.g., a study with many credible sets).
Available Commands:
get-gwas-studiesdisease_id: Fetches all GWAS studies associated with a specific disease ID (e.g.MONDO_0008383for Rheumatoid Arthritis).get-study-credible-setsstudy_id: Fetches all credible sets for a given study ID (e.g.FINNGEN_R12_RX_CROHN_2NDLINE). Returns confidence, finemapping method, variant, and p-value info.get-qtl-credible-setsvariant_id: Retrieves QTL credible sets for a specific variant ID (e.g.19_44908822_C_T).get-l2gvariant_id [--study-id ID]: Returns Locus-to-Gene (L2G) predictions/scores for a locus to identify the most likely causal gene. Onlyvariant_idis required; use--study-idto filter to a specific study. Acceptschrprefix (e.g.chr1_113834946_A_G).get-target-druggabilityensembl_id: Provides tractability data (small molecule, antibody, etc.) and clinical trial safety info for a gene/target.get-associated-targetsdisease_id: Find all target genes associated with a specific disease ID (EFO or MONDO).get-disease-drugsdisease_id [--min-stage STAGE]: Find all drugs and clinical candidates associated with a disease. Use--min-stageto filter (e.g.,PHASE_3for Phase III or Approved).get-associated-diseasesensembl_id: Find all diseases associated with a specific target Ensembl ID.search-diseasequery_string: Search for a disease by name to find its ID and other metadata.get-credible-sets-near-targetensembl_id [--window N]: Fetches credible sets for a target and filters them to those within a genomic window around the target. Useful for finding variants "nearby" a gene.custom-queryquery [--variables '{}']: Run a raw GraphQL query for any other Open Targets data.
L2G Query Usage
The get-l2g command has two modes:
Variant only (
get-l2g <variant_id>): Returns L2G predictions from all credible sets across all studies where that variant is the lead variant. This can return a large number of results (e.g., hundreds). Use this when the user wants a broad view of which gene is most likely causal at a locus, or when no specific study is mentioned.Variant + study (
get-l2g <variant_id> --study-id <study_id>): Returns L2G predictions only for credible sets from that specific study. Use this when the user asks about a specific GWAS study or when you need to narrow down the results.
Incomplete results warning: The variant-only mode can return hundreds of credible sets. The default
--page-sizeis 200, so if the API reports acounthigher than the number ofrowsreturned, you are seeing incomplete results. Always comparecountto the actual number of rows. If they differ, either increase--page-sizeor inform the user that only a subset was retrieved.
Querying by Region
To find studies with variants "nearby" a gene, use
get-credible-sets-near-target, which improves upon the base API by performing
a flexible search based on genomic position: uv run scripts/query_opentargets.py --output /tmp/results.json get-credible-sets-near-target ENSG00000156515 --window 500000
Note that the Open Targets GraphQL schema includes a regions parameter for
credibleSets, however it performs an exact match against pre-computed region
strings (e.g., chr10:68769984-69903496) and there is some missing data. Use
get-credible-sets-near-target as it allows a genomic range overlap search.
This fetches credible sets associated with the target and filters them in Python based on the variant's genomic position.
Advanced GraphQL Queries
If you need to query endpoints or fields not exposed by the built-in
subcommands, use the custom-query subcommand.
Before writing a custom query: Read the reference documentation to understand the API schema, types, and see example queries. See references/OpenTargets_GraphQL_Guide.md for full schema details, endpoints, and examples.
Example: Finding drugs for a disease
uv run scripts/query_opentargets.py custom-query \
query drugsForDisease($id: String!) {
disease(efoId: $id) {
name
drugAndClinicalCandidates {
count
rows {
maxClinicalStage
drug {
id
name
}
}
}
}
}' \
--variables '{"id": "EFO_1001006"}'
--output '/tmp/opentargets_result.json'Confidence Star Ratings
The Open Targets Platform assigns a confidence level to each credible set based on the fine-mapping method and quality checks. These correspond to star ratings displayed in the platform UI:
| Stars | Confidence String (API value) |
|---|---|
| ★★★★ (4 stars) | SuSiE fine-mapped credible set with in-sample LD |
| ★★★ (3 stars) | SuSiE fine-mapped credible set with out-of-sample LD |
| ★★ (2 stars) | `PICS fine-mapped credible set extracted from summary |
| : : statistics` : | |
| ★ (1 star) | PICS fine-mapped credible set based on reported top hit |
| None | Unknown confidence |
When users ask about "N-star confidence", match their request to the
corresponding string in the confidence field of the API response.
Tips and Common Mistakes
ID Formats:
Disease IDs are typically MONDO IDs (e.g.
MONDO_0008383for Rheumatoid Arthritis) or EFO IDs (e.g.EFO_0009460). Use thesearch-diseasecommand to find the correct ID.Target IDs must be Ensembl IDs (e.g.
ENSG00000169083), not HGNC symbols. If you only have a gene symbol, you may need to map it first using a custom GraphQLsearchquery.Variant IDs are formatted as
chromosome_position_ref_alt(e.g.,1_154426264_C_T). Achrprefix (e.g.chr1_154426264_C_T) is automatically stripped by the tool.Study IDs can be GWAS Catalog IDs (e.g.
GCST90204201) or project-specific IDs (e.g.FINNGEN_R12_RX_CROHN_2NDLINE).
Truncation: The tool truncates arrays longer than
--limitto protect the context window. If you see"_truncated", you can run the query again with a higher limit if you specifically need more data, but be cautious with large limit values. Always use the--outputflag to save the result to a file and avoid terminal output truncation.Pagination and incomplete results: The
--page-sizeoption (default: 200) controls how many items are fetched from the API. Always check thecountfield in the response and compare it to the number ofrowsactually returned. Ifcount> number of rows, you have incomplete data — either increase--page-sizeto fetch more, or inform the user that only a partial result set was returned. This is especially important forget-l2gwithout--study-id, which can return hundreds of credible sets.
Files
- ATTRIBUTION.mdAdded by AutoGineer922 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md9.3 KiB
- references/OpenTargets_GraphQL_Guide.md7.7 KiB
- references/citation.bib2.4 KiB
- scripts/query_opentargets.pyScript18.2 KiB
references/OpenTargets_GraphQL_Guide.md
Open Targets GraphQL API Guide
Overview
The Open Targets Platform GraphQL API provides access to aggregated multi-modal evidence from genetics (GWAS/eQTL), pathways, animal models, and clinical trials. This data is used to rank target-disease associations, identify druggable genes, and discover known drugs.
Querying the API
To interact with the Open Targets API, use the provided Python script
scripts/query_opentargets.py. This script handles API communication,
formatting, and automatically truncates large responses to save context window
tokens.
Built-in Commands
For common tasks, use the specialized subcommands provided by the script:
get-gwas-studies <disease_id>: Fetch GWAS studies for a disease.get-study-credible-sets <study_id>: Fetch 95% credible sets for a study.get-qtl-credible-sets <variant_id>: Fetch QTL credible sets for a variant.get-l2g <variant_id> [--study-id <study_id>]: Get Locus-to-Gene (L2G) predictions.get-target-druggability <ensembl_id>: Get tractability and safety data for a target.get-associated-targets <disease_id>: Find target genes associated with a disease.get-disease-drugs <disease_id> [--min-stage <stage>]: Find drugs and clinical candidates associated with a disease, optionally filtering by minimum clinical stage (e.g.,PHASE_3,APPROVAL).get-associated-diseases <ensembl_id>: Find diseases associated with a target.search-disease <query_string>: Search for a disease to find its ID.
Global Options:
--limit N: Limits the number of items returned in arrays (default: 50).--page-size N: Sets API pagination size (default: 200).
Custom GraphQL Queries
For complex queries or fields not covered by the built-in commands, use the
custom-query subcommand:
uv run scripts/query_opentargets.py custom-query \
'query targetInfo($id: String!) {
target(ensemblId: $id) {
approvedSymbol
biotype
}
}' \
--variables '{"id": "ENSG00000169083"}'Core Entities & Identifiers
When writing custom GraphQL queries, you will primarily interact with the following core entities defined in the schema:
1. Target (Gene/Protein)
Identifier: Ensembl ID (e.g.,
ENSG00000169083). Do not use HGNC symbols directly; you must map them to Ensembl IDs first.Root Queries:
target(ensemblId: String!),targets(ensemblIds: [String!]!)Key Fields:
id: Ensembl ID.approvedSymbol,approvedName: Standard HGNC symbol and name.biotype: Type of gene (e.g., protein_coding).associatedDiseases(...): Target-disease associations with scores.knownDrugs(...): Approved/investigational drugs targeting this gene.tractability: Feasibility of targeting with therapeutic modalities.
2. Disease (or Phenotype)
Identifier: Disease ID, typically MONDO ID (e.g.,
MONDO_0008383for Rheumatoid Arthritis) or EFO ID (e.g.,EFO_0009460).Root Queries:
disease(efoId: String!)(accepts MONDO/EFO IDs),diseases(efoIds: [String!]!)Key Fields:
id: Disease ID.name,description: Disease name and summary.synonyms: Alternative names.associatedTargets(...): Targets associated with this disease, sortable by score.knownDrugs(...): Drugs indicated for this disease or currently in clinical trials.evidences(...): Specific pieces of evidence supporting target-disease associations.
3. Drug (or Clinical Candidate)
Identifier: ChEMBL ID (e.g.,
CHEMBL112).Root Queries:
drug(chemblId: String!),drugs(chemblIds: [String!]!)Key Fields:
id: ChEMBL ID.name,drugType: Generic name and molecule type.maximumClinicalStage: Highest clinical stage reached (values are enums, e.g., "APPROVAL", "PHASE_3", "PHASE_2", "PHASE_1", "PHASE_0").mechanismsOfAction: How the drug interacts with its target.indications: Diseases the drug is indicated for.adverseEvents(...): Significant adverse events from FAERS.
4. Variant
Identifier: Format
CHROM_POS_REF_ALT(e.g.,1_154426264_C_T). Note: Achrprefix is automatically stripped by the CLI tool, but standard queries expect it without the prefix.Root Query:
variant(variantId: String!)Key Fields:
id: Variant ID.chromosome,position,referenceAllele,alternateAllele: Genomic coordinates.rsIds: dbSNP identifiers.credibleSets(...): GWAS/molQTL credible sets containing this variant.
5. Study (GWAS/molQTL)
Identifier: Study ID (e.g., GWAS Catalog ID
GCST90204201or project ID).Root Query:
study(studyId: String)Key Fields:
id: Study ID.studyType: Type of study (gwas,eqtl,pqtl, etc.).traitFromSource: The trait analysed in the study.credibleSets(...): 95% credible sets for this study.
Common Query Patterns
Finding Drugs for a Disease
To find drugs associated with a specific disease, use the knownDrugs field on
the disease entity. This is more direct than searching for evidence records.
query diseaseDrugs($id: String!) {
disease(efoId: $id) {
name
drugAndClinicalCandidates {
count
rows {
maxClinicalStage
drug {
id
name
}
}
}
}
}Pagination
Many relation fields (like associatedDiseases, evidences, credibleSets)
require a page argument to handle large datasets.
query getAssocDiseases($id: String!) {
target(ensemblId: $id) {
associatedDiseases(page: {index: 0, size: 10}) {
count
rows {
score
disease {
id
name
}
}
}
}
}Search and ID Mapping
If you only have a string (like a gene symbol or disease name), use the search
or mapIds queries to find the correct canonical IDs.
query searchEntity($query: String!) {
search(
queryString: $query,
entityNames: ["target", "disease"],
page: {index: 0, size: 5}
) {
hits {
id
entity
name
description
}
}
}Best Practices & Tips for Agents
Check the
count: Always check thecountfield when querying paginated lists (rows). If the totalcountis larger than the number ofrowsreturned, you are only seeing a partial result. Increase--page-sizeor adjust your query'ssizeparameter if more data is needed.Locus-to-Gene (L2G) Nuances: When querying L2G predictions for a variant without specifying a study ID, you will get predictions across all credible sets where the variant is the lead. This often returns hundreds of rows. Use
--study-idto narrow it down if the user is interested in a specific GWAS study.Confidence Ratings: Open Targets assigns "star ratings" based on the fine-mapping method used for credible sets (e.g., 4 stars =
SuSiE fine-mapped credible set with in-sample LD). Match these exact strings when users ask for specific confidence tiers.Avoid Excessive Limits: The CLI tool defaults to a limit of 50 to protect context windows. Start with small limits or sizes (e.g.,
size: 10) when exploring the schema or doing preliminary searches, then increase if needed.Use Subcommands First: Whenever possible, use the specialized subcommands (e.g.,
get-l2g,get-associated-targets) instead of writing custom raw GraphQL queries, as they are pre-optimized and easier to invoke.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Python
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Google DeepMind
- Publisher
- Google DeepMind (Official)
- Source
- google-deepmind/science-skills · skills/opentargets_database · commit 4de6786
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Google DeepMind.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download opentargets-database.zip