| name | variant-population-frequency |
| description | Query gnomAD for variant allele frequency across populations. Uses FAVOR to convert rsID→variant_id first, then queries gnomAD. |
| license | MIT license |
| metadata | {"skill-author":"PJLab"} |
gnomAD Population Frequency
Usage
Tool Description
Step 1: Query FAVOR to convert rsID → chr-pos-ref-alt format.
API: GET https://api.genohub.org/v1/rsids/{rs_id}
Step 2: Query gnomAD GraphQL API with the variant_id.
API: POST https://gnomad.broadinstitute.org/api (GraphQL)
Args:
rs_id (str): dbSNP rsID (e.g. "rs7412")
Return:
Overall AF, population-specific AF (exome + genome), homozygote counts.
Query Example
import requests
rs_id = "rs7412"
favor_url = f"https://api.genohub.org/v1/rsids/{rs_id}"
favor_resp = requests.get(favor_url, timeout=30).json()
if not isinstance(favor_resp, list):
favor_resp = [favor_resp]
variant_ids = [item.get("variant_vcf", ) item favor_resp item.get()]
()
query =
variant_vcf variant_ids:
()
resp = requests.post(
,
json={: query, : {: variant_vcf}},
timeout=
).json()
v = resp.get(, {}).get(, {})
v:
()
()
source [, ]:
d = v.get(source, {})
d:
()
pop (d.get() []):
pop.get(, ) > :
af = pop[] / pop[]
()