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:
- Genetic variant associations — SNPs associated with diseases or traits
- SNP lookups — information about specific variants (rs IDs)
- Trait/disease searches — genetic associations for phenotypes
- Gene associations — variants in or near specific genes
- GWAS summary statistics — complete genome-wide association data
- Study metadata — publication and cohort information
- Population genetics — ancestry-specific associations
- Polygenic risk scores — variants for risk prediction models
- Functional genomics / systematic reviews — variant effects, literature synthesis
Data Model
Four core entities, each with a canonical identifier:
- Studies →
GCST accessions (e.g., GCST001234)
- Associations → SNP-trait links with p-values (genome-wide significant: p ≤ 5×10⁻⁸)
- Variants →
rs numbers (e.g., rs7903146)
- Traits → trait ontology short-forms (e.g., MONDO_0005148 = type 2 diabetes on the main REST API); genes use HGNC symbols (e.g., TCF7L2)
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:
- GWAS Catalog API:
https://www.ebi.ac.uk/gwas/rest/api (curated associations, studies, variants, traits)
- Summary Statistics API:
https://www.ebi.ac.uk/gwas/summary-statistics/api (all tested variants, not just significant hits)
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
- 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.
- Query the matching endpoint — trait/variant/study/region; iterate pages via
page/size.
- Filter — by p-value (≤ 5×10⁻⁸ for genome-wide significance), ancestry, sample size, discovery/replication status.
- Extract — rs IDs, effect alleles/directions, effect sizes (OR or beta), p-values.
- Cross-reference — Ensembl (consequences), gnomAD (frequencies), Open Targets, PGS Catalog.
- For genome-wide analyses — pull full summary statistics via the Summary Statistics API or FTP rather than scraping the association endpoints.
Routing Guidance
- Writing API calls / want copy-paste code (endpoints, the four worked examples, summary-stats access, cross-referencing, full paginated Python helper) →
references/query_examples.md.
- Following a multi-step task (disease-, variant-, gene-centric, systematic review, summary-stats analysis) or web-interface search syntax →
references/query_workflows.md.
- Need response field names, pagination details, or best-practice / data-quality guidance →
references/data_fields_and_best_practices.md.
- Deep endpoint specs, all query params, error handling, advanced filtering →
references/api_reference.md.
Reference Index
references/query_examples.md — REST endpoint code, four canonical query examples (disease, variant, summary stats, chromosomal region), summary-statistics access, cross-referencing, and a complete paginated Python integration returning a DataFrame.
references/query_workflows.md — Five step-by-step query workflows (disease, variant, gene, systematic review, summary statistics) plus web-interface search modes.
references/data_fields_and_best_practices.md — Association/study response fields, pagination, query and interpretation best practices, rate-limiting ethics, and data-quality considerations.
references/api_reference.md — Comprehensive endpoint specifications, query parameters/filters, response formats, error handling, and integration with external databases.
Citation and Resources
When using GWAS Catalog data, cite:
1---2name: alterlab-gwas3description: 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 genetic epidemiology lookups. Part of the AlterLab Academic Skills suite.4license: MIT5---67# GWAS Catalog Database89## Overview1011The 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.1213## Scripts1415`scripts/query_gwas.py` — query the GWAS Catalog REST API (stdlib only, JSON to stdout):1617```bash18python scripts/query_gwas.py variant rs7903146 # associations for a SNP19python scripts/query_gwas.py trait MONDO_0005148 --size 100 # associations for a trait20python scripts/query_gwas.py study GCST001795 # study metadata21```2223## When to Use This Skill2425Use this skill for:26- **Genetic variant associations** — SNPs associated with diseases or traits27- **SNP lookups** — information about specific variants (rs IDs)28- **Trait/disease searches** — genetic associations for phenotypes29- **Gene associations** — variants in or near specific genes30- **GWAS summary statistics** — complete genome-wide association data31- **Study metadata** — publication and cohort information32- **Population genetics** — ancestry-specific associations33- **Polygenic risk scores** — variants for risk prediction models34- **Functional genomics** / **systematic reviews** — variant effects, literature synthesis3536## Data Model3738Four core entities, each with a canonical identifier:39- **Studies** → `GCST` accessions (e.g., GCST001234)40- **Associations** → SNP-trait links with p-values (genome-wide significant: p ≤ 5×10⁻⁸)41- **Variants** → `rs` numbers (e.g., rs7903146)42- **Traits** → trait ontology short-forms (e.g., MONDO_0005148 = type 2 diabetes on the main REST API); genes use HGNC symbols (e.g., TCF7L2)4344> **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.4546## APIs4748Two free, no-key REST APIs:49- **GWAS Catalog API**: `https://www.ebi.ac.uk/gwas/rest/api` (curated associations, studies, variants, traits)50- **Summary Statistics API**: `https://www.ebi.ac.uk/gwas/summary-statistics/api` (all tested variants, not just significant hits)5152Core 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`).5354## Core Workflow55561. **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.572. **Query the matching endpoint** — trait/variant/study/region; iterate pages via `page`/`size`.583. **Filter** — by p-value (≤ 5×10⁻⁸ for genome-wide significance), ancestry, sample size, discovery/replication status.594. **Extract** — rs IDs, effect alleles/directions, effect sizes (OR or beta), p-values.605. **Cross-reference** — Ensembl (consequences), gnomAD (frequencies), Open Targets, PGS Catalog.616. **For genome-wide analyses** — pull full summary statistics via the Summary Statistics API or FTP rather than scraping the association endpoints.6263## Routing Guidance6465- **Writing API calls / want copy-paste code** (endpoints, the four worked examples, summary-stats access, cross-referencing, full paginated Python helper) → `references/query_examples.md`.66- **Following a multi-step task** (disease-, variant-, gene-centric, systematic review, summary-stats analysis) or **web-interface search syntax** → `references/query_workflows.md`.67- **Need response field names, pagination details, or best-practice / data-quality guidance** → `references/data_fields_and_best_practices.md`.68- **Deep endpoint specs, all query params, error handling, advanced filtering** → `references/api_reference.md`.6970## Reference Index7172- **`references/query_examples.md`** — REST endpoint code, four canonical query examples (disease, variant, summary stats, chromosomal region), summary-statistics access, cross-referencing, and a complete paginated Python integration returning a DataFrame.73- **`references/query_workflows.md`** — Five step-by-step query workflows (disease, variant, gene, systematic review, summary statistics) plus web-interface search modes.74- **`references/data_fields_and_best_practices.md`** — Association/study response fields, pagination, query and interpretation best practices, rate-limiting ethics, and data-quality considerations.75- **`references/api_reference.md`** — Comprehensive endpoint specifications, query parameters/filters, response formats, error handling, and integration with external databases.7677## Citation and Resources7879When using GWAS Catalog data, cite:80- Sollis E, et al. (2023) The NHGRI-EBI GWAS Catalog: knowledgebase and deposition resource. Nucleic Acids Research 51:D977-D985. PMID: 36350656. DOI: 10.1093/nar/gkac101081- Include access date and version when available; cite original studies when discussing specific findings.8283- **Website**: https://www.ebi.ac.uk/gwas/84- **Documentation**: https://www.ebi.ac.uk/gwas/docs85- **API docs**: https://www.ebi.ac.uk/gwas/rest/docs/api86- **Summary Statistics API**: https://www.ebi.ac.uk/gwas/summary-statistics/docs/87- **FTP site**: http://ftp.ebi.ac.uk/pub/databases/gwas/88- **Training materials**: https://github.com/EBISPOT/GWAS_Catalog-workshop (Jupyter notebooks, Colab)89- **PGS Catalog** (polygenic scores): https://www.pgscatalog.org/90- **Help and support**: gwas-info@ebi.ac.uk