[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EASF3B3VKPYKQM3HM93WMP":3,"skill-same:01M6EASF3B3VKPYKQM3HM93WMP":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":29,"linkOnly":30,"markdownContent":31,"markdownBody":32,"frontMatter":33,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":6,"ownerDescription":43,"updatedAt":44,"install":45,"resources":58},"01M6EASF3B3VKPYKQM3HM93WMP","gnomad-database",null,"Query gnomAD (Genome Aggregation Database) for population allele frequencies, variant constraint scores (pLI, LOEUF), and loss-of-function intolerance. Essential for variant pathogenicity interpretation, rare disease genetics, and identifying loss-of-function intolerant genes.","luokai0\u002Fai-agent-skills-by-luo-kai","luokai0","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F266954973?v=4","01M6E16VNT42JB8B3X3254QWJ7","luo kai","01M6E16VTFVP6S5XJF1V1MPV90",14,"CC0-1.0","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F18-ai-agents-and-automation (by Luo Kai)\u002F16-other-agents\u002Fgnomad-database\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28],"database","gnomad database","gnomad","interpretation","aggregation","query","genetics","essential","rare disease genetics","variant pathogenicity","2026-11-10 10:12:30",false,"---\nauthor: luo-kai\nname: gnomad-database\ndescription: Query gnomAD (Genome Aggregation Database) for population allele frequencies, variant constraint scores (pLI, LOEUF), and loss-of-function intolerance. Essential for variant pathogenicity interpretation, rare disease genetics, and identifying loss-of-function intolerant genes.\nlicense: CC0-1.0\nmetadata:\n    skill-author: Kuan-lin Huang\n---\n\n# gnomAD Database\n\n## Overview\n\nThe Genome Aggregation Database (gnomAD) is the largest publicly available collection of human genetic variation, aggregated from large-scale sequencing projects. gnomAD v4 contains exome sequences from 730,947 individuals and genome sequences from 76,215 individuals across diverse ancestries. It provides population allele frequencies, variant consequence annotations, and gene-level constraint metrics that are essential for interpreting the clinical significance of genetic variants.\n\n**Key resources:**\n- gnomAD browser: https:\u002F\u002Fgnomad.broadinstitute.org\u002F\n- GraphQL API: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi\n- Data downloads: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fdownloads\n- Documentation: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fhelp\n\n## When to Use This Skill\n\nUse gnomAD when:\n\n- **Variant frequency lookup**: Checking if a variant is rare, common, or absent in the general population\n- **Pathogenicity assessment**: Rare variants (MAF \u003C 1%) are candidates for disease causation; gnomAD helps filter benign common variants\n- **Loss-of-function intolerance**: Using pLI and LOEUF scores to assess whether a gene tolerates protein-truncating variants\n- **Population-stratified frequencies**: Comparing allele frequencies across ancestries (African\u002FAfrican American, Admixed American, Ashkenazi Jewish, East Asian, Finnish, Middle Eastern, Non-Finnish European, South Asian)\n- **ClinVar\u002FACMG variant classification**: gnomAD frequency data feeds into BA1\u002FBS1 evidence codes for variant classification\n- **Constraint analysis**: Identifying genes depleted of missense or loss-of-function variation (z-scores, pLI, LOEUF)\n\n## Core Capabilities\n\n### 1. gnomAD GraphQL API\n\ngnomAD uses a GraphQL API accessible at `https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi`. Most queries fetch variants by gene or specific genomic position.\n\n**Datasets available:**\n- `gnomad_r4` — gnomAD v4 exomes (recommended default, GRCh38)\n- `gnomad_r4_genomes` — gnomAD v4 genomes (GRCh38)\n- `gnomad_r3` — gnomAD v3 genomes (GRCh38)\n- `gnomad_r2_1` — gnomAD v2 exomes (GRCh37)\n\n**Reference genomes:**\n- `GRCh38` — default for v3\u002Fv4\n- `GRCh37` — for v2\n\n### 2. Querying Variants by Gene\n\n```python\nimport requests\n\ndef query_gnomad_gene(gene_symbol, dataset=\"gnomad_r4\", reference_genome=\"GRCh38\"):\n    \"\"\"Fetch variants in a gene from gnomAD.\"\"\"\n    url = \"https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi\"\n\n    query = \"\"\"\n    query GeneVariants($gene_symbol: String!, $dataset: DatasetId!, $reference_genome: ReferenceGenomeId!) {\n      gene(gene_symbol: $gene_symbol, reference_genome: $reference_genome) {\n        gene_id\n        gene_symbol\n        variants(dataset: $dataset) {\n          variant_id\n          pos\n          ref\n          alt\n          consequence\n          genome {\n            af\n            ac\n            an\n            ac_hom\n            populations {\n              id\n              ac\n              an\n              af\n            }\n          }\n          exome {\n            af\n            ac\n            an\n            ac_hom\n          }\n          lof\n          lof_flags\n          lof_filter\n        }\n      }\n    }\n    \"\"\"\n\n    variables = {\n        \"gene_symbol\": gene_symbol,\n        \"dataset\": dataset,\n        \"reference_genome\": reference_genome\n    }\n\n    response = requests.post(url, json={\"query\": query, \"variables\": variables})\n    return response.json()\n\n# Example\nresult = query_gnomad_gene(\"BRCA1\")\ngene_data = result[\"data\"][\"gene\"]\nvariants = gene_data[\"variants\"]\n\n# Filter to rare PTVs\nrare_ptvs = [\n    v for v in variants\n    if v.get(\"lof\") == \"LC\" or v.get(\"consequence\") in [\"stop_gained\", \"frameshift_variant\"]\n    and v.get(\"genome\", {}).get(\"af\", 1) \u003C 0.001\n]\nprint(f\"Found {len(rare_ptvs)} rare PTVs in {gene_data['gene_symbol']}\")\n```\n\n### 3. Querying a Specific Variant\n\n```python\nimport requests\n\ndef query_gnomad_variant(variant_id, dataset=\"gnomad_r4\"):\n    \"\"\"Fetch details for a specific variant (e.g., '1-55516888-G-GA').\"\"\"\n    url = \"https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi\"\n\n    query = \"\"\"\n    query VariantDetails($variantId: String!, $dataset: DatasetId!) {\n      variant(variantId: $variantId, dataset: $dataset) {\n        variant_id\n        chrom\n        pos\n        ref\n        alt\n        genome {\n          af\n          ac\n          an\n          ac_hom\n          populations {\n            id\n            ac\n            an\n            af\n          }\n        }\n        exome {\n          af\n          ac\n          an\n          ac_hom\n          populations {\n            id\n            ac\n            an\n            af\n          }\n        }\n        consequence\n        lof\n        rsids\n        in_silico_predictors {\n          id\n          value\n          flags\n        }\n        clinvar_variation_id\n      }\n    }\n    \"\"\"\n\n    response = requests.post(\n        url,\n        json={\"query\": query, \"variables\": {\"variantId\": variant_id, \"dataset\": dataset}}\n    )\n    return response.json()\n\n# Example: query a specific variant\nresult = query_gnomad_variant(\"17-43094692-G-A\")  # BRCA1 missense\nvariant = result[\"data\"][\"variant\"]\n\nif variant:\n    genome_af = variant.get(\"genome\", {}).get(\"af\", \"N\u002FA\")\n    exome_af = variant.get(\"exome\", {}).get(\"af\", \"N\u002FA\")\n    print(f\"Variant: {variant['variant_id']}\")\n    print(f\"  Consequence: {variant['consequence']}\")\n    print(f\"  Genome AF: {genome_af}\")\n    print(f\"  Exome AF: {exome_af}\")\n    print(f\"  LoF: {variant.get('lof')}\")\n```\n\n### 4. Gene Constraint Scores\n\ngnomAD constraint scores assess how tolerant a gene is to variation relative to expectation:\n\n```python\nimport requests\n\ndef query_gnomad_constraint(gene_symbol, reference_genome=\"GRCh38\"):\n    \"\"\"Fetch constraint scores for a gene.\"\"\"\n    url = \"https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi\"\n\n    query = \"\"\"\n    query GeneConstraint($gene_symbol: String!, $reference_genome: ReferenceGenomeId!) {\n      gene(gene_symbol: $gene_symbol, reference_genome: $reference_genome) {\n        gene_id\n        gene_symbol\n        gnomad_constraint {\n          exp_lof\n          exp_mis\n          exp_syn\n          obs_lof\n          obs_mis\n          obs_syn\n          oe_lof\n          oe_mis\n          oe_syn\n          oe_lof_lower\n          oe_lof_upper\n          lof_z\n          mis_z\n          syn_z\n          pLI\n        }\n      }\n    }\n    \"\"\"\n\n    response = requests.post(\n        url,\n        json={\"query\": query, \"variables\": {\"gene_symbol\": gene_symbol, \"reference_genome\": reference_genome}}\n    )\n    return response.json()\n\n# Example\nresult = query_gnomad_constraint(\"KCNQ2\")\ngene = result[\"data\"][\"gene\"]\nconstraint = gene[\"gnomad_constraint\"]\n\nprint(f\"Gene: {gene['gene_symbol']}\")\nprint(f\"  pLI:   {constraint['pLI']:.3f}  (>0.9 = LoF intolerant)\")\nprint(f\"  LOEUF: {constraint['oe_lof_upper']:.3f}  (\u003C0.35 = highly constrained)\")\nprint(f\"  Obs\u002FExp LoF: {constraint['oe_lof']:.3f}\")\nprint(f\"  Missense Z:  {constraint['mis_z']:.3f}\")\n```\n\n**Constraint score interpretation:**\n| Score | Range | Meaning |\n|-------|-------|---------|\n| `pLI` | 0–1 | Probability of LoF intolerance; >0.9 = highly intolerant |\n| `LOEUF` | 0–∞ | LoF observed\u002Fexpected upper bound; \u003C0.35 = constrained |\n| `oe_lof` | 0–∞ | Observed\u002Fexpected ratio for LoF variants |\n| `mis_z` | −∞ to ∞ | Missense constraint z-score; >3.09 = constrained |\n| `syn_z` | −∞ to ∞ | Synonymous z-score (control; should be near 0) |\n\n### 5. Population Frequency Analysis\n\n```python\nimport requests\nimport pandas as pd\n\ndef get_population_frequencies(variant_id, dataset=\"gnomad_r4\"):\n    \"\"\"Extract per-population allele frequencies for a variant.\"\"\"\n    url = \"https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi\"\n\n    query = \"\"\"\n    query PopFreqs($variantId: String!, $dataset: DatasetId!) {\n      variant(variantId: $variantId, dataset: $dataset) {\n        variant_id\n        genome {\n          populations {\n            id\n            ac\n            an\n            af\n            ac_hom\n          }\n        }\n      }\n    }\n    \"\"\"\n\n    response = requests.post(\n        url,\n        json={\"query\": query, \"variables\": {\"variantId\": variant_id, \"dataset\": dataset}}\n    )\n    data = response.json()\n    populations = data[\"data\"][\"variant\"][\"genome\"][\"populations\"]\n\n    df = pd.DataFrame(populations)\n    df = df[df[\"an\"] > 0].copy()\n    df[\"af\"] = df[\"ac\"] \u002F df[\"an\"]\n    df = df.sort_values(\"af\", ascending=False)\n    return df\n\n# Population IDs in gnomAD v4:\n# afr = African\u002FAfrican American\n# ami = Amish\n# amr = Admixed American\n# asj = Ashkenazi Jewish\n# eas = East Asian\n# fin = Finnish\n# mid = Middle Eastern\n# nfe = Non-Finnish European\n# sas = South Asian\n# remaining = Other\n```\n\n### 6. Structural Variants (gnomAD-SV)\n\ngnomAD also contains a structural variant dataset:\n\n```python\nimport requests\n\ndef query_gnomad_sv(gene_symbol):\n    \"\"\"Query structural variants overlapping a gene.\"\"\"\n    url = \"https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi\"\n\n    query = \"\"\"\n    query SVsByGene($gene_symbol: String!) {\n      gene(gene_symbol: $gene_symbol, reference_genome: GRCh38) {\n        structural_variants {\n          variant_id\n          type\n          chrom\n          pos\n          end\n          af\n          ac\n          an\n        }\n      }\n    }\n    \"\"\"\n\n    response = requests.post(url, json={\"query\": query, \"variables\": {\"gene_symbol\": gene_symbol}})\n    return response.json()\n```\n\n## Query Workflows\n\n### Workflow 1: Variant Pathogenicity Assessment\n\n1. **Check population frequency** — Is the variant rare enough to be pathogenic?\n   - Use gnomAD AF \u003C 1% for recessive, \u003C 0.1% for dominant conditions\n   - Check ancestry-specific frequencies (a variant rare overall may be common in one population)\n\n2. **Assess functional impact** — LoF variants have highest prior probability\n   - Check `lof` field: `HC` = high-confidence LoF, `LC` = low-confidence\n   - Check `lof_flags` for issues like \"NAGNAG_SITE\", \"PHYLOCSF_WEAK\"\n\n3. **Apply ACMG criteria:**\n   - BA1: AF > 5% → Benign Stand-Alone\n   - BS1: AF > disease prevalence threshold → Benign Supporting\n   - PM2: Absent or very rare in gnomAD → Pathogenic Moderate\n\n### Workflow 2: Gene Prioritization in Rare Disease\n\n1. Query constraint scores for candidate genes\n2. Filter for pLI > 0.9 (haploinsufficient) or LOEUF \u003C 0.35\n3. Cross-reference with observed LoF variants in the gene\n4. Integrate with ClinVar and disease databases\n\n### Workflow 3: Population Genetics Research\n\n1. Identify variant of interest from GWAS or clinical data\n2. Query per-population frequencies\n3. Compare frequency differences across ancestries\n4. Test for enrichment in specific founder populations\n\n## Best Practices\n\n- **Use gnomAD v4 (gnomad_r4)** for the most current data; use v2 (gnomad_r2_1) only for GRCh37 compatibility\n- **Handle null responses**: Variants not observed in gnomAD are not necessarily pathogenic — absence is informative\n- **Distinguish exome vs. genome data**: Genome data has more uniform coverage; exome data is larger but may have coverage gaps\n- **Rate limit GraphQL queries**: Add delays between requests; batch queries when possible\n- **Homozygous counts** (`ac_hom`) are relevant for recessive disease analysis\n- **LOEUF is preferred over pLI** for gene constraint (less sensitive to sample size)\n\n## Data Access\n\n- **Browser**: https:\u002F\u002Fgnomad.broadinstitute.org\u002F — interactive variant and gene browsing\n- **GraphQL API**: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi — programmatic access\n- **Downloads**: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fdownloads — VCF, Hail tables, constraint tables\n- **Google Cloud**: gs:\u002F\u002Fgcp-public-data--gnomad\u002F\n\n## Additional Resources\n\n- **gnomAD website**: https:\u002F\u002Fgnomad.broadinstitute.org\u002F\n- **gnomAD blog**: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fnews\n- **Downloads**: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fdownloads\n- **API explorer**: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi (interactive GraphiQL)\n- **Constraint documentation**: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fhelp\u002Fconstraint\n- **Citation**: Karczewski KJ et al. (2020) Nature. PMID: 32461654; Chen S et al. (2024) Nature. PMID: 38conservation\n- **GitHub**: https:\u002F\u002Fgithub.com\u002Fbroadinstitute\u002Fgnomad-browser\n","# gnomAD Database\n\n## Overview\n\nThe Genome Aggregation Database (gnomAD) is the largest publicly available collection of human genetic variation, aggregated from large-scale sequencing projects. gnomAD v4 contains exome sequences from 730,947 individuals and genome sequences from 76,215 individuals across diverse ancestries. It provides population allele frequencies, variant consequence annotations, and gene-level constraint metrics that are essential for interpreting the clinical significance of genetic variants.\n\n**Key resources:**\n- gnomAD browser: https:\u002F\u002Fgnomad.broadinstitute.org\u002F\n- GraphQL API: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi\n- Data downloads: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fdownloads\n- Documentation: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fhelp\n\n## When to Use This Skill\n\nUse gnomAD when:\n\n- **Variant frequency lookup**: Checking if a variant is rare, common, or absent in the general population\n- **Pathogenicity assessment**: Rare variants (MAF \u003C 1%) are candidates for disease causation; gnomAD helps filter benign common variants\n- **Loss-of-function intolerance**: Using pLI and LOEUF scores to assess whether a gene tolerates protein-truncating variants\n- **Population-stratified frequencies**: Comparing allele frequencies across ancestries (African\u002FAfrican American, Admixed American, Ashkenazi Jewish, East Asian, Finnish, Middle Eastern, Non-Finnish European, South Asian)\n- **ClinVar\u002FACMG variant classification**: gnomAD frequency data feeds into BA1\u002FBS1 evidence codes for variant classification\n- **Constraint analysis**: Identifying genes depleted of missense or loss-of-function variation (z-scores, pLI, LOEUF)\n\n## Core Capabilities\n\n### 1. gnomAD GraphQL API\n\ngnomAD uses a GraphQL API accessible at `https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi`. Most queries fetch variants by gene or specific genomic position.\n\n**Datasets available:**\n- `gnomad_r4` — gnomAD v4 exomes (recommended default, GRCh38)\n- `gnomad_r4_genomes` — gnomAD v4 genomes (GRCh38)\n- `gnomad_r3` — gnomAD v3 genomes (GRCh38)\n- `gnomad_r2_1` — gnomAD v2 exomes (GRCh37)\n\n**Reference genomes:**\n- `GRCh38` — default for v3\u002Fv4\n- `GRCh37` — for v2\n\n### 2. Querying Variants by Gene\n\n```python\nimport requests\n\ndef query_gnomad_gene(gene_symbol, dataset=\"gnomad_r4\", reference_genome=\"GRCh38\"):\n    \"\"\"Fetch variants in a gene from gnomAD.\"\"\"\n    url = \"https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi\"\n\n    query = \"\"\"\n    query GeneVariants($gene_symbol: String!, $dataset: DatasetId!, $reference_genome: ReferenceGenomeId!) {\n      gene(gene_symbol: $gene_symbol, reference_genome: $reference_genome) {\n        gene_id\n        gene_symbol\n        variants(dataset: $dataset) {\n          variant_id\n          pos\n          ref\n          alt\n          consequence\n          genome {\n            af\n            ac\n            an\n            ac_hom\n            populations {\n              id\n              ac\n              an\n              af\n            }\n          }\n          exome {\n            af\n            ac\n            an\n            ac_hom\n          }\n          lof\n          lof_flags\n          lof_filter\n        }\n      }\n    }\n    \"\"\"\n\n    variables = {\n        \"gene_symbol\": gene_symbol,\n        \"dataset\": dataset,\n        \"reference_genome\": reference_genome\n    }\n\n    response = requests.post(url, json={\"query\": query, \"variables\": variables})\n    return response.json()\n\n# Example\nresult = query_gnomad_gene(\"BRCA1\")\ngene_data = result[\"data\"][\"gene\"]\nvariants = gene_data[\"variants\"]\n\n# Filter to rare PTVs\nrare_ptvs = [\n    v for v in variants\n    if v.get(\"lof\") == \"LC\" or v.get(\"consequence\") in [\"stop_gained\", \"frameshift_variant\"]\n    and v.get(\"genome\", {}).get(\"af\", 1) \u003C 0.001\n]\nprint(f\"Found {len(rare_ptvs)} rare PTVs in {gene_data['gene_symbol']}\")\n```\n\n### 3. Querying a Specific Variant\n\n```python\nimport requests\n\ndef query_gnomad_variant(variant_id, dataset=\"gnomad_r4\"):\n    \"\"\"Fetch details for a specific variant (e.g., '1-55516888-G-GA').\"\"\"\n    url = \"https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi\"\n\n    query = \"\"\"\n    query VariantDetails($variantId: String!, $dataset: DatasetId!) {\n      variant(variantId: $variantId, dataset: $dataset) {\n        variant_id\n        chrom\n        pos\n        ref\n        alt\n        genome {\n          af\n          ac\n          an\n          ac_hom\n          populations {\n            id\n            ac\n            an\n            af\n          }\n        }\n        exome {\n          af\n          ac\n          an\n          ac_hom\n          populations {\n            id\n            ac\n            an\n            af\n          }\n        }\n        consequence\n        lof\n        rsids\n        in_silico_predictors {\n          id\n          value\n          flags\n        }\n        clinvar_variation_id\n      }\n    }\n    \"\"\"\n\n    response = requests.post(\n        url,\n        json={\"query\": query, \"variables\": {\"variantId\": variant_id, \"dataset\": dataset}}\n    )\n    return response.json()\n\n# Example: query a specific variant\nresult = query_gnomad_variant(\"17-43094692-G-A\")  # BRCA1 missense\nvariant = result[\"data\"][\"variant\"]\n\nif variant:\n    genome_af = variant.get(\"genome\", {}).get(\"af\", \"N\u002FA\")\n    exome_af = variant.get(\"exome\", {}).get(\"af\", \"N\u002FA\")\n    print(f\"Variant: {variant['variant_id']}\")\n    print(f\"  Consequence: {variant['consequence']}\")\n    print(f\"  Genome AF: {genome_af}\")\n    print(f\"  Exome AF: {exome_af}\")\n    print(f\"  LoF: {variant.get('lof')}\")\n```\n\n### 4. Gene Constraint Scores\n\ngnomAD constraint scores assess how tolerant a gene is to variation relative to expectation:\n\n```python\nimport requests\n\ndef query_gnomad_constraint(gene_symbol, reference_genome=\"GRCh38\"):\n    \"\"\"Fetch constraint scores for a gene.\"\"\"\n    url = \"https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi\"\n\n    query = \"\"\"\n    query GeneConstraint($gene_symbol: String!, $reference_genome: ReferenceGenomeId!) {\n      gene(gene_symbol: $gene_symbol, reference_genome: $reference_genome) {\n        gene_id\n        gene_symbol\n        gnomad_constraint {\n          exp_lof\n          exp_mis\n          exp_syn\n          obs_lof\n          obs_mis\n          obs_syn\n          oe_lof\n          oe_mis\n          oe_syn\n          oe_lof_lower\n          oe_lof_upper\n          lof_z\n          mis_z\n          syn_z\n          pLI\n        }\n      }\n    }\n    \"\"\"\n\n    response = requests.post(\n        url,\n        json={\"query\": query, \"variables\": {\"gene_symbol\": gene_symbol, \"reference_genome\": reference_genome}}\n    )\n    return response.json()\n\n# Example\nresult = query_gnomad_constraint(\"KCNQ2\")\ngene = result[\"data\"][\"gene\"]\nconstraint = gene[\"gnomad_constraint\"]\n\nprint(f\"Gene: {gene['gene_symbol']}\")\nprint(f\"  pLI:   {constraint['pLI']:.3f}  (>0.9 = LoF intolerant)\")\nprint(f\"  LOEUF: {constraint['oe_lof_upper']:.3f}  (\u003C0.35 = highly constrained)\")\nprint(f\"  Obs\u002FExp LoF: {constraint['oe_lof']:.3f}\")\nprint(f\"  Missense Z:  {constraint['mis_z']:.3f}\")\n```\n\n**Constraint score interpretation:**\n| Score | Range | Meaning |\n|-------|-------|---------|\n| `pLI` | 0–1 | Probability of LoF intolerance; >0.9 = highly intolerant |\n| `LOEUF` | 0–∞ | LoF observed\u002Fexpected upper bound; \u003C0.35 = constrained |\n| `oe_lof` | 0–∞ | Observed\u002Fexpected ratio for LoF variants |\n| `mis_z` | −∞ to ∞ | Missense constraint z-score; >3.09 = constrained |\n| `syn_z` | −∞ to ∞ | Synonymous z-score (control; should be near 0) |\n\n### 5. Population Frequency Analysis\n\n```python\nimport requests\nimport pandas as pd\n\ndef get_population_frequencies(variant_id, dataset=\"gnomad_r4\"):\n    \"\"\"Extract per-population allele frequencies for a variant.\"\"\"\n    url = \"https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi\"\n\n    query = \"\"\"\n    query PopFreqs($variantId: String!, $dataset: DatasetId!) {\n      variant(variantId: $variantId, dataset: $dataset) {\n        variant_id\n        genome {\n          populations {\n            id\n            ac\n            an\n            af\n            ac_hom\n          }\n        }\n      }\n    }\n    \"\"\"\n\n    response = requests.post(\n        url,\n        json={\"query\": query, \"variables\": {\"variantId\": variant_id, \"dataset\": dataset}}\n    )\n    data = response.json()\n    populations = data[\"data\"][\"variant\"][\"genome\"][\"populations\"]\n\n    df = pd.DataFrame(populations)\n    df = df[df[\"an\"] > 0].copy()\n    df[\"af\"] = df[\"ac\"] \u002F df[\"an\"]\n    df = df.sort_values(\"af\", ascending=False)\n    return df\n\n# Population IDs in gnomAD v4:\n# afr = African\u002FAfrican American\n# ami = Amish\n# amr = Admixed American\n# asj = Ashkenazi Jewish\n# eas = East Asian\n# fin = Finnish\n# mid = Middle Eastern\n# nfe = Non-Finnish European\n# sas = South Asian\n# remaining = Other\n```\n\n### 6. Structural Variants (gnomAD-SV)\n\ngnomAD also contains a structural variant dataset:\n\n```python\nimport requests\n\ndef query_gnomad_sv(gene_symbol):\n    \"\"\"Query structural variants overlapping a gene.\"\"\"\n    url = \"https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi\"\n\n    query = \"\"\"\n    query SVsByGene($gene_symbol: String!) {\n      gene(gene_symbol: $gene_symbol, reference_genome: GRCh38) {\n        structural_variants {\n          variant_id\n          type\n          chrom\n          pos\n          end\n          af\n          ac\n          an\n        }\n      }\n    }\n    \"\"\"\n\n    response = requests.post(url, json={\"query\": query, \"variables\": {\"gene_symbol\": gene_symbol}})\n    return response.json()\n```\n\n## Query Workflows\n\n### Workflow 1: Variant Pathogenicity Assessment\n\n1. **Check population frequency** — Is the variant rare enough to be pathogenic?\n   - Use gnomAD AF \u003C 1% for recessive, \u003C 0.1% for dominant conditions\n   - Check ancestry-specific frequencies (a variant rare overall may be common in one population)\n\n2. **Assess functional impact** — LoF variants have highest prior probability\n   - Check `lof` field: `HC` = high-confidence LoF, `LC` = low-confidence\n   - Check `lof_flags` for issues like \"NAGNAG_SITE\", \"PHYLOCSF_WEAK\"\n\n3. **Apply ACMG criteria:**\n   - BA1: AF > 5% → Benign Stand-Alone\n   - BS1: AF > disease prevalence threshold → Benign Supporting\n   - PM2: Absent or very rare in gnomAD → Pathogenic Moderate\n\n### Workflow 2: Gene Prioritization in Rare Disease\n\n1. Query constraint scores for candidate genes\n2. Filter for pLI > 0.9 (haploinsufficient) or LOEUF \u003C 0.35\n3. Cross-reference with observed LoF variants in the gene\n4. Integrate with ClinVar and disease databases\n\n### Workflow 3: Population Genetics Research\n\n1. Identify variant of interest from GWAS or clinical data\n2. Query per-population frequencies\n3. Compare frequency differences across ancestries\n4. Test for enrichment in specific founder populations\n\n## Best Practices\n\n- **Use gnomAD v4 (gnomad_r4)** for the most current data; use v2 (gnomad_r2_1) only for GRCh37 compatibility\n- **Handle null responses**: Variants not observed in gnomAD are not necessarily pathogenic — absence is informative\n- **Distinguish exome vs. genome data**: Genome data has more uniform coverage; exome data is larger but may have coverage gaps\n- **Rate limit GraphQL queries**: Add delays between requests; batch queries when possible\n- **Homozygous counts** (`ac_hom`) are relevant for recessive disease analysis\n- **LOEUF is preferred over pLI** for gene constraint (less sensitive to sample size)\n\n## Data Access\n\n- **Browser**: https:\u002F\u002Fgnomad.broadinstitute.org\u002F — interactive variant and gene browsing\n- **GraphQL API**: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi — programmatic access\n- **Downloads**: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fdownloads — VCF, Hail tables, constraint tables\n- **Google Cloud**: gs:\u002F\u002Fgcp-public-data--gnomad\u002F\n\n## Additional Resources\n\n- **gnomAD website**: https:\u002F\u002Fgnomad.broadinstitute.org\u002F\n- **gnomAD blog**: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fnews\n- **Downloads**: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fdownloads\n- **API explorer**: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fapi (interactive GraphiQL)\n- **Constraint documentation**: https:\u002F\u002Fgnomad.broadinstitute.org\u002Fhelp\u002Fconstraint\n- **Citation**: Karczewski KJ et al. (2020) Nature. PMID: 32461654; Chen S et al. (2024) Nature. PMID: 38conservation\n- **GitHub**: https:\u002F\u002Fgithub.com\u002Fbroadinstitute\u002Fgnomad-browser\n",{"name":5,"author":34,"license":15,"metadata":35,"description":7},"luo-kai",{"skill-author":36},"Kuan-lin Huang","main","4d2fb89cdfb75f3f6fd3c6c5ec9ad90ea129eb3c","ai-agent-skills\u002F18-ai-agents-and-automation (by Luo Kai)\u002F16-other-agents\u002Fgnomad-database",2,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai","https:\u002F\u002Fgithub.com\u002Fluokai0","a solo builder.","2026-05-06 04:29:04",{"source":8,"skillName":5,"commands":46,"prompt":56,"zipAvailable":57},[47,50,53],{"tool":48,"command":49},"npx","npx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill gnomad-database",{"tool":51,"command":52},"bunx","bunx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill gnomad-database",{"tool":54,"command":55},"pnpm","pnpm dlx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill gnomad-database","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F18-ai-agents-and-automation (by Luo Kai)\u002F16-other-agents\u002Fgnomad-database\u002FSKILL.md",true,[59,65],{"path":60,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":63,"sourceHtmlUrl":64},"references\u002Fgraphql_queries.md","REFERENCE","参考文档",5340,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F18-ai-agents-and-automation (by Luo Kai)\u002F16-other-agents\u002Fgnomad-database\u002Freferences\u002Fgraphql_queries.md",{"path":66,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":67,"sourceHtmlUrl":68},"references\u002Fvariant_interpretation.md",3551,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F18-ai-agents-and-automation (by Luo Kai)\u002F16-other-agents\u002Fgnomad-database\u002Freferences\u002Fvariant_interpretation.md",[70,98,115,139,166,191],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":74,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":29},"01M6F2SKTE208174C7S7JJCZC7","write-contracts","Generates secure Aptos Move V2 smart contracts with Object model, Digital Asset integration, security patterns, and storage type guidance. Includes comprehensive storage decision framework for optimal data structure selection. Triggers on: 'write contract', 'create NFT collection', 'build marketplace', 'implement minting', 'generate Move module', 'create token contract', 'build DAO', 'implement staking'. Ask storage questions when: 'store', 'track', 'registry', 'mapping', 'list', 'collection'.","MIT","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fwrite-contracts\u002FSKILL.md",[],[78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97],"write","contracts","write contracts","storage","secure","create","generate","collection","model","decision","ask","smart-contracts","selection","objects","structure","nft","token","aptos","critical","move",{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":74,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":29},"01M6F2RFXJ6T9MKW0A7N7GM45B","web-search","通用网络搜索技能，支持多引擎搜索（百度、必应、DuckDuckGo），无需API密钥即可获取实时信息","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fweb-search-ex-skill\u002FSKILL.md",[],[105,106,107,108,109,110,111,112,113,114],"web","search","web search","搜索","baidu","bing","duckduckgo","百度","多引擎","internet",{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":74,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":29},"01M6F2K968G1FZEZFPW2E6B222","solo-build","Execute implementation plan tasks with TDD workflow, auto-commit, and phase gates. Use when user says \"build it\", \"start building\", \"execute plan\", \"implement tasks\", \"ship it\", or references a track ID. Do NOT use for planning (use \u002Fplan) or scaffolding (use \u002Fscaffold).","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fsolo-build\u002FSKILL.md",[],[122,123,124,125,126,127,128,129,106,130,131,132,78,133,134,135,24,136,137,138],"build","solo","solo build","MCP","workflow","commit","tasks","code","Bash","plan","read","auto","references","context7","scaffolding","ship it","project",{"skillNo":140,"name":141,"nameZh":6,"description":142,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":74,"licenseFileUrl":6,"sourceHtmlUrl":143,"categories":144,"keywords":145,"publishedAt":29},"01M6F2GKN39SGHSPWYB3662YC8","react-email","Use when building HTML email templates with React components, adding a visual email editor to an application using the React Email visual editor, rendering emails to HTML, or sending emails with Resend. Covers welcome emails, password resets, notifications, order confirmations, newsletters, transactional emails, and the embeddable email editor component.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Freact-email-skills\u002FSKILL.md",[],[146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165],"react","email","react email","github","editor","components","react components","component","welcome","https","notifications","password","node","use","html","resend","visual","emails","rendering","with",{"skillNo":167,"name":168,"nameZh":6,"description":169,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":74,"licenseFileUrl":6,"sourceHtmlUrl":170,"categories":171,"keywords":172,"publishedAt":29},"01M6F2FBVGVDFSG8SSFJGXA40C","APITester Agent-Driven API Testing","Test API endpoints and document responses. Define tests in plain English, run them, get formatted results. Agent-driven Postman alternative.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fopenclaw-api-tester\u002FSKILL.md",[],[173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190],"testing","api","api testing","driven","APITester Agent Driven API Testing","test","run","postman","results","plain english","tester","endpoints","document","get","define","tests","english","api-tester",{"skillNo":192,"name":193,"nameZh":6,"description":194,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":74,"licenseFileUrl":6,"sourceHtmlUrl":195,"categories":196,"keywords":197,"publishedAt":29},"01M6F273Y3NGAPVJZ608BC0G9G","hubspot-implementation-plan","Generate a phased implementation plan from a HubSpot audit report. Creates prioritized, sequenced cleanup processes with effort estimates, dependencies, and automation feasibility. Use after running \u002Fhubspot-audit.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fhubspot-implementation-plan\u002FSKILL.md",[],[131,198,199,200,201,202,203,84,204,205,206,207,208,159,209,210,165,211],"implementation","hubspot","hubspot implementation plan","automation","feasibility","cleanup","planning","report","audit","audit report","phased implementation","dependencies","processes","hubspot audit"]