Alterlab gwas

From NVlabs/Skill2Env · View interactive version

Alterlab gwas is an AI agent skill from the GitHub repository NVlabs/Skill2Env. Query the NHGRI-EBI GWAS Catalog REST API for SNP-trait associations, retrieving variants by rs ID, disease/trait, or gene along with p-values and summary statistics. Use when investigating genome-wide association study hits, mapping a SNP or rsID to traits, building polygenic risk scores, or doing

How to use this skill

Skill file

GWAS Catalog Database

Overview

The GWAS Catalog is a curated repository of published genome-wide association studies maintained by NHGRI and EBI. It contains SNP-trait associations from thousands of GWAS publications — genetic variants, associated traits and diseases, p-values, effect sizes, and full summary statistics for many studies.

Scripts

scripts/query_gwas.py — query the GWAS Catalog REST API (stdlib only, JSON to stdout):

python scripts/query_gwas.py variant rs7903146           # associations for a SNP
python scripts/query_gwas.py trait MONDO_0005148 --size 100  # associations for a trait
python scripts/query_gwas.py study GCST001795            # study metadata

When to Use This Skill

Use this skill for:

Data Model

Four core entities, each with a canonical identifier:

Trait-ID gotcha (verified): the two APIs disagree on trait IDs. The main REST API has migrated many traits to MONDO / current EFO short-forms, so efoTraits/MONDO_0005148 works but the legacy efoTraits/EFO_0001360 now 404s. The Summary Statistics API still uses the legacy ID: traits/EFO_0001360 works there but traits/MONDO_0005148 404s. If a trait path 404s, look up the current short-form with /efoTraits/search/findByTrait?trait=... (main API) before assuming the trait is absent.

APIs

Two free, no-key REST APIs:

Core endpoints: /studies/{GCST}, /efoTraits/{efoID}/associations, /singleNucleotidePolymorphisms/{rsID} and /{rsID}/associations. Responses are HAL+JSON with _embedded results, _links for related resources, and pagination (page, size).

Core Workflow

  1. Identify the entity — get the EFO ID (trait), rs ID (variant), GCST (study), or HGNC symbol (gene). Use the web interface for free-text → EFO mapping.
  2. Query the matching endpoint — trait/variant/study/region; iterate pages via page/size.
  3. Filter — by p-value (≤ 5×10⁻⁸ for genome-wide significance), ancestry, sample size, discovery/replication status.
  4. Extract — rs IDs, effect alleles/directions, effect sizes (OR or beta), p-values.
  5. Cross-reference — Ensembl (consequences), gnomAD (frequencies), Open Targets, PGS Catalog.
  6. For genome-wide analyses — pull full summary statistics via the Summary Statistics API or FTP rather than scraping the association endpoints.

Routing Guidance

Reference Index

Citation and Resources

When using GWAS Catalog data, cite:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.