variant-genomic-location

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

157 stars

Best use case

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

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

Teams using variant-genomic-location 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-genomic-location/SKILL.md --create-dirs "https://raw.githubusercontent.com/InternScience/DrClaw/main/drclaw/agent_hub/templates/genomics/skills/variant-genomic-location/SKILL.md"

Manual Installation

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

How variant-genomic-location Compares

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

Frequently Asked Questions

What does this skill do?

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

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

# dbSNP Variant Query

## Usage

### Tool Description

```tex
Step 1: Query NCBI dbSNP REST API to get variant position, ref/alt alleles, gene association.
API: GET https://api.ncbi.nlm.nih.gov/variation/v0/refsnp/{rsid_number}

Step 2: Query NCBI Gene API to get the full coordinate range of the associated gene.
API: GET https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=gene&id={gene_id}&retmode=json

Args:
    rs_id (str): dbSNP rsID (e.g. "rs7412")
Return:
    染色体, 突变位置(0-based start/end), 突变类型(SNV/insertion/deletion),
    ref/alt等位基因, 关联基因名称及其完整坐标范围.
```

### Query Example

```python
import requests

rs_id = "rs7412"

# ── Step 1: dbSNP 查询变异信息 ──
url = f"https://api.ncbi.nlm.nih.gov/variation/v0/refsnp/{rs_id.replace('rs','')}"
resp = requests.get(url, timeout=30).json()
snapshot = resp.get("primary_snapshot_data", {})
variant_type = snapshot.get("variant_type", "unknown")  # snv, ins, del 等

# 提取 GRCh38 坐标
chrom, start, end, ref, alt, hgvs = "", 0, 0, "", "", ""
for p in snapshot.get("placements_with_allele", []):
    for trait in p.get("placement_annot", {}).get("seq_id_traits_by_assembly", []):
        if "GRCh38" in trait.get("assembly_name", ""):
            for allele in p.get("alleles", []):
                spdi = allele.get("allele", {}).get("spdi", {})
                r = spdi.get("deleted_sequence", "")
                a = spdi.get("inserted_sequence", "")
                if r != a:
                    chrom = spdi.get("seq_id", "")
                    start = spdi.get("position", 0)
                    ref, alt = r, a
                    end = start + len(ref)
                    hgvs = allele.get("hgvs", "")

# 判断突变类型
if len(ref) == 1 and len(alt) == 1:
    mut_type = f"SNV (替换: {ref}→{alt})"
elif len(ref) > len(alt):
    mut_type = f"Deletion (缺失: 丢失{len(ref)-len(alt)}个碱基)"
elif len(ref) < len(alt):
    mut_type = f"Insertion (插入: 增加{len(alt)-len(ref)}个碱基)"
else:
    mut_type = f"MNV (多核苷酸替换: {ref}→{alt})"

print(f"[dbSNP] rsID: {rs_id}")
print(f"[dbSNP] 染色体: {chrom}")
print(f"[dbSNP] 突变位置: start={start}, end={end} (0-based)")
print(f"[dbSNP] 突变类型: {mut_type}")
print(f"[dbSNP] HGVS: {hgvs}")

# 提取关联基因 ID 和名称
gene_id, gene_name = None, ""
for ann in snapshot.get("allele_annotations", []):
    for asm in ann.get("assembly_annotation", []):
        for gene in asm.get("genes", []):
            gene_id = gene.get("id")
            gene_name = gene.get("locus", "")
            print(f"[dbSNP] 关联基因: {gene_name} ({gene.get('name','')}), NCBI Gene ID: {gene_id}")
            break
    if gene_id:
        break

# ── Step 2: NCBI Gene 查询基因完整坐标范围 ──
if gene_id:
    gene_url = f"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=gene&id={gene_id}&retmode=json"
    gene_resp = requests.get(gene_url, timeout=30).json()
    gene_info = gene_resp.get("result", {}).get(str(gene_id), {})
    for g in gene_info.get("genomicinfo", []):
        g_chr = g.get("chraccver", "")
        g_start = g.get("chrstart", 0)
        g_stop = g.get("chrstop", 0)
        exon_count = g.get("exoncount", 0)
        print(f"[Gene] {gene_name} 完整坐标: {g_chr}:{g_start}-{g_stop} (0-based)")
        print(f"[Gene] 基因长度: {abs(g_stop - g_start) + 1} bp, 外显子数: {exon_count}")
```

Related Skills

virus_genomics

157
from InternScience/DrClaw

Virus Genomics Analysis - Analyze virus genomics: NCBI virus dataset, annotation, taxonomy, and literature search. Use this skill for virology tasks involving get virus dataset report get virus annotation report get taxonomy search literature. Combines 4 tools from 2 SCP server(s).

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).

microbiome_genomics

157
from InternScience/DrClaw

Microbiome Genomics Analysis - Analyze microbial genome: NCBI genome data, taxonomy, KEGG metabolic pathways, and annotation. Use this skill for metagenomics tasks involving get genome dataset report by taxon get taxonomy kegg find get genome annotation report. Combines 4 tools from 2 SCP server(s).

epigenomic_landscape

157
from InternScience/DrClaw

Epigenomic Landscape Mapping - Map epigenomic landscape: overlapping features, regulatory elements, binding matrices, and phenotype links. Use this skill for epigenomics tasks involving get overlap region get phenotype region get species binding matrix get track data. Combines 4 tools from 2 SCP server(s).

cross_species_genomics

157
from InternScience/DrClaw

Cross-Species Comparative Genomics - Compare genomes across species: Ensembl compara, alignment, gene trees, and NCBI taxonomy. Use this skill for comparative genomics tasks involving get info compara species sets get alignment region get genetree member symbol get taxonomy. Combines 4 tools from 2 SCP server(s).

biosample_genomics

157
from InternScience/DrClaw

BioSample & Genome Cross-Reference - Cross-reference biosample and genome data: NCBI biosample, genome report, sequence reports, and taxonomy. Use this skill for genomics tasks involving get biosample report get genome dataset report by accession get genome sequence reports get taxonomy. Combines 4 tools from 1 SCP server(s).

structural_pharmacogenomics

157
from InternScience/DrClaw

Structural Pharmacogenomics - Link structure to pharmacogenomics: variant effect, protein structure change, drug binding, and clinical data. Use this skill for pharmacogenomics tasks involving get vep hgvs pred protein structure esmfold boltz binding affinity get pharmacogenomics info by drug name. Combines 4 tools from 3 SCP server(s).

pharmacogenomics_analysis

157
from InternScience/DrClaw

Pharmacogenomics Analysis - Pharmacogenomics analysis: FDA pharmacogenomics info, variant effects, ClinVar pathogenicity, and gene expression. Use this skill for pharmacogenomics tasks involving get pharmacogenomics info by drug name get vep hgvs clinvar search get gene expression across cancers. Combines 4 tools from 4 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).

variant-pharmacogenomics

157
from InternScience/DrClaw

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

variant-population-frequency

157
from InternScience/DrClaw

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

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.