variant-population-frequency

Query gnomAD for variant allele frequency across populations. Uses FAVOR to convert rsID→variant_id first, then queries gnomAD.

157 stars

Best use case

variant-population-frequency is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Query gnomAD for variant allele frequency across populations. Uses FAVOR to convert rsID→variant_id first, then queries gnomAD.

Teams using variant-population-frequency should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/variant-population-frequency/SKILL.md --create-dirs "https://raw.githubusercontent.com/InternScience/DrClaw/main/drclaw/agent_hub/templates/genomics/skills/variant-population-frequency/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/variant-population-frequency/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How variant-population-frequency Compares

Feature / Agentvariant-population-frequencyStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Query gnomAD for variant allele frequency across populations. Uses FAVOR to convert rsID→variant_id first, then queries gnomAD.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# gnomAD Population Frequency

## Usage

### Tool Description

```tex
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

```python
import requests

rs_id = "rs7412"

# ── Step 1: FAVOR 获取 variant_id (chr-pos-ref-alt) ──
# 注意:FAVOR 可能返回多个变异(多等位基因位点),需遍历所有结果
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", "") for item in favor_resp if item.get("variant_vcf")]
print(f"[FAVOR] 该rsID对应 {len(variant_ids)} 个变异: {variant_ids}")

# ── Step 2: gnomAD 查询人群频率(遍历所有变异) ──
query = """
query VariantQuery($variantId: String!) {
  variant(variantId: $variantId, dataset: gnomad_r4) {
    variant_id
    rsid
    exome {
      ac
      an
      af
      ac_hom
      populations { id ac an ac_hom }
    }
    genome {
      ac
      an
      af
      ac_hom
      populations { id ac an ac_hom }
    }
  }
}
"""

for variant_vcf in variant_ids:
    print(f"\n── 查询 {variant_vcf} ──")
    resp = requests.post(
        "https://gnomad.broadinstitute.org/api",
        json={"query": query, "variables": {"variantId": variant_vcf}},
        timeout=30
    ).json()

    v = resp.get("data", {}).get("variant", {})
    if not v:
        print(f"[gnomAD] {variant_vcf}: 未找到数据")
        continue
    print(f"[gnomAD] variant: {v.get('variant_id')}, rsid: {v.get('rsid')}")

    for source in ["exome", "genome"]:
        d = v.get(source, {})
        if d:
            print(f"[gnomAD] {source}: AF={d.get('af')}, AC={d.get('ac')}, AN={d.get('an')}, Hom={d.get('ac_hom')}")
            for pop in (d.get("populations") or []):
                if pop.get("an", 0) > 0:
                    af = pop["ac"] / pop["an"]
                    print(f"  {pop['id']}: AF={af:.6f}, AC={pop['ac']}, AN={pop['an']}")
```

Related Skills

variant_pathogenicity

157
from InternScience/DrClaw

Variant Pathogenicity Assessment - Assess variant pathogenicity: Ensembl VEP prediction, ClinVar lookup, variation details, and gene phenotype associations. Use this skill for clinical genetics tasks involving get vep hgvs clinvar search get variation get phenotype gene. Combines 4 tools from 2 SCP server(s).

population_genetics

157
from InternScience/DrClaw

Population Genetics Analysis - Analyze population genetics: Ensembl variation populations, linkage disequilibrium, and variant frequency data. Use this skill for population genetics tasks involving get info variation populations get ld get variation get variant recoder. Combines 4 tools from 1 SCP server(s).

gene_variant_drug_nexus

157
from InternScience/DrClaw

Gene-Variant-Drug Nexus - Connect gene variants to drugs: variant effect, gene-disease link, drug associations, and clinical evidence. Use this skill for translational genomics tasks involving get vep hgvs get associated targets by disease efoId get associated drugs by target name clinvar search. Combines 4 tools from 3 SCP server(s).

optical-frequency-calculation

157
from InternScience/DrClaw

Calculate optical frequency and wavelength relationships for photonics and electromagnetic analysis.

variant-pharmacogenomics

157
from InternScience/DrClaw

Query PharmGKB (clinPGx) for pharmacogenomic clinical annotations — how a variant affects drug response, dosing, and adverse reactions.

variant-gwas-associations

157
from InternScience/DrClaw

Query EBI GWAS Catalog for GWAS statistical associations (p-value, effect size, risk allele) between a variant and traits/diseases.

variant-genomic-location

157
from InternScience/DrClaw

Query dbSNP + NCBI Gene to get variant genomic position (chromosome, coordinates, ref/alt alleles, mutation type) and associated gene coordinates.

variant-functional-prediction

157
from InternScience/DrClaw

Query FAVOR API for variant functional prediction scores (CADD, SIFT, PolyPhen, REVEL, etc.) and gene annotation.

variant-cross-database-ids

157
from InternScience/DrClaw

Query ClinGen Allele Registry to map variant rsID to identifiers in other databases (ClinVar, gnomAD, COSMIC, UniProtKB, OMIM, etc.).

variant-clinical-significance

157
from InternScience/DrClaw

Query NCBI ClinVar for variant clinical pathogenicity classification (Pathogenic/Benign/VUS), review status and associated diseases.

comprehensive-variant-annotation

157
from InternScience/DrClaw

Given an rsID, query multiple databases (dbSNP, FAVOR, GWAS Catalog, ClinVar, gnomAD, PharmGKB, ClinGen) for comprehensive annotation. Use when user asks a general question about a variant without specifying which aspect.

acpx

157
from InternScience/DrClaw

Use the ACPX CLI through DrClaw's existing exec/long_exec tools to run Codex in the current project workspace.