drclaw/agent_hub/templates/genomics/skills/variant-population-frequency/SKILL.md
Query gnomAD for variant allele frequency across populations. Uses FAVOR to convert rsID→variant_id first, then queries gnomAD.
npx skillsauth add qzzqzzb/drclaw variant-population-frequencyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
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']}")
content-media
当用户明确要求“写/生成 NSFC 预算说明书”“写预算说明”“生成 budget.tex / budget.pdf”“写国自然预算 justification”时使用。基于用户标书正文或补充材料,输出一份可提交的预算说明书 LaTeX 项目并渲染 `budget.pdf`。若用户未指定工作目录,必须暂停并先要求其指定。⚠️ 不适用:用户只是想了解预算原则;用户仅要预算表数字而不写说明书;或用户是 2026 青年 A/B/C 默认包干制且无需预算说明书的场景。
tools
当用户明确要求"写/润色 NSFC 标书摘要""生成中文摘要和英文摘要""把中文摘要翻译成英文摘要"时使用。输出中文、英文两个版本(英文必须是中文的忠实翻译版),同时输出标题建议(1个推荐标题+5个候选标题及理由)。中文摘要默认≤400字符,英文摘要默认≤4000字符。输出方式:将结果写入工作目录下的 `NSFC-ABSTRACTS.md`。⚠️ 不适用:用户只想翻译一段与标书无关的通用文本(应直接翻译);用户只想写立项依据/研究内容/研究基础正文(应使用对应 nsfc 系列 skill)。
documentation
当用户明确要求"更新项目指南""同步指南""沉淀洞见到指南"时使用。将对话中新产生的可复用写作洞见实时沉淀到项目指南文件,保持术语口径一致、结构稳定、可检验与可复现。调用时必须指定指南文件路径。
content-media
当用户明确要求"从文件/图片/网页/描述中提取综述主题"或"生成主题+关键词+核心问题结构化输出"时使用。支持文件(PDF/Word/Markdown/Tex)、文件夹、图片、自然语言描述、网页 URL 等多种输入源,自动识别输入类型并提取内容,生成可直接用于 systematic-literature-review 及其他文献综述技能的结构化输出。