Access ClinPGx pharmacogenomics data (successor to PharmGKB) when you need to query gene-drug interactions, CPIC guidelines, allele functions, and drug-label PGx content for precision medicine and genotype-guided dosing.
64
78%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./scientific-skills/Evidence Insight/clinpgx-database/SKILL.mdClinPGx (Clinical Pharmacogenomics Database) is a curated pharmacogenomics resource and successor to PharmGKB. It integrates content from sources such as CPIC, DPWG, PharmCAT, and regulatory drug labels to support genotype-informed prescribing, safety screening, and evidence review via a REST API.
scripts/query_clinpgx.py.references/ for task-specific guidance.Python: 3.10+. Repository baseline for current packaged skills.Third-party packages: not explicitly version-pinned in this skill package. Add pinned versions if this skill needs stricter environment control.cd "20260316/scientific-skills/Evidence Insight/clinpgx-database"
python -m py_compile scripts/query_clinpgx.py
python scripts/query_clinpgx.py --helpExample run plan:
CONFIG block or documented parameters if the script uses fixed settings.python scripts/query_clinpgx.py with the validated inputs.scripts/query_clinpgx.py.references/ contains supporting rules, prompts, or checklists.Use this skill when you need to:
requests >=2.31.0Install:
python -m pip install "requests>=2.31.0"The following script is a complete, runnable example that:
import time
import requests
BASE_URL = "https://api.clinpgx.org/v1"
MAX_RPS_DELAY_SEC = 0.5 # 2 requests/sec
session = requests.Session()
def get_json(path, params=None, timeout=20, max_retries=4):
"""
Safe GET with exponential backoff for HTTP 429 and transient failures.
"""
url = f"{BASE_URL}{path}"
for attempt in range(max_retries):
try:
resp = session.get(url, params=params, timeout=timeout)
if resp.status_code == 200:
time.sleep(MAX_RPS_DELAY_SEC)
return resp.json()
if resp.status_code == 429:
backoff = 2 ** attempt
time.sleep(backoff)
continue
resp.raise_for_status()
except requests.RequestException:
if attempt == max_retries - 1:
raise
time.sleep(1 + attempt)
def main():
gene = "CYP2C19"
drug_name = "clopidogrel"
# 1) Gene details
gene_data = get_json(f"/gene/{gene}")
print("Gene:", gene_data.get("symbol", gene))
# 2) Drug search by name (API may return a list)
drugs = get_json("/chemical", params={"name": drug_name})
if not drugs:
raise RuntimeError(f"No drug found for name={drug_name!r}")
drug = drugs[0]
drug_id = drug.get("id")
print("Drug:", drug.get("name", drug_name), "| id:", drug_id)
# 3) Gene-drug pair query
pair = get_json("/geneDrugPair", params={"gene": gene, "drug": drug_name})
print("Gene-drug pair results:", len(pair) if isinstance(pair, list) else "1")
# 4) CPIC guideline query (by gene+drug filter)
guidelines = get_json("/guideline", params={"source": "CPIC", "gene": gene, "drug": drug_name})
print("CPIC guidelines:", len(guidelines) if isinstance(guidelines, list) else "1")
# 5) Drug labels (optional)
labels = get_json("/drugLabel", params={"drug": drug_name, "source": "FDA"})
print("FDA labels:", len(labels) if isinstance(labels, list) else "1")
if __name__ == "__main__":
main()https://api.clinpgx.org/v1/GET /gene/{symbol} (e.g., /gene/CYP2D6)GET /gene?q=... (search)GET /chemical?name=... or GET /chemical/{id}GET /geneDrugPair?gene=...&drug=...GET /guideline?source=CPIC&gene=...&drug=... or GET /guideline/{id}GET /allele/{star_allele} (e.g., /allele/CYP2D6*4)GET /variant/{rsid} (e.g., /variant/rs4244285)GET /clinicalAnnotation?... (filters such as gene, drug, evidenceLevel)GET /drugLabel?drug=...&source=FDAGET /pathway/{id} or GET /pathway?drug=...Clinical annotations may be graded from higher to lower strength, commonly:
Use evidence filters (e.g., evidenceLevel=1A) when building clinical decision support or prioritizing literature review.
For many pharmacogenes, phenotype groupings may include:
clinpgx_database_result.md unless the skill documentation defines a better convention.Run this minimal verification path before full execution when possible:
python scripts/query_clinpgx.py --helpExpected output format:
Result file: clinpgx_database_result.md
Validation summary: PASS/FAIL with brief notes
Assumptions: explicit list if any63c61d3
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.