Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Access ClinPGx pharmacogenomics data (successor to PharmGKB). Query gene-drug interactions, CPIC guidelines, allele functions, for precision medicine and genotype-guided dosing decisions.
.claude/skills/clinpgx-database/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-11 | ✗→✓ | ▲ Improved | — | — |
| case-07 | ✗→✓ | ▲ Improved | — | — |
| case-09 | ✗→✓ | ▲ Improved | — | — |
| case-13 | ✗→✓ | ▲ Improved | — | — |
| case-23 | ✗→✓ | ▲ Improved | — | — |
ClinPGx (Clinical Pharmacogenomics Database) is a comprehensive resource for clinical pharmacogenomics information, successor to PharmGKB. It consolidates data from PharmGKB, CPIC, and PharmCAT, providing curated information on how genetic variation affects medication response. Access gene-drug pairs, clinical guidelines, allele functions, and drug labels for precision medicine applications.
This skill should be used when:
The ClinPGx REST API provides programmatic access to all database resources. Basic setup:
bashuv pip install requests
pythonBASE_URL = "https://api.clinpgx.org/v1/"
Rate Limits:
Authentication: Not required for basic access
Data License: Creative Commons Attribution-ShareAlike 4.0 International License
For substantial API use, notify the ClinPGx team at api@clinpgx.org
Retrieve gene information including function, clinical annotations, and pharmacogenomic significance:
pythonimport requests # Get gene details response = requests.get("https://api.clinpgx.org/v1/gene/CYP2D6") gene_data = response.json() # Search for genes by name response = requests.get("https://api.clinpgx.org/v1/gene", params={"q": "CYP"}) genes = response.json()
Key pharmacogenes:
Retrieve drug information including pharmacogenomic annotations and mechanisms:
python# Get drug details response = requests.get("https://api.clinpgx.org/v1/chemical/PA448515") # Warfarin drug_data = response.json() # Search drugs by name response = requests.get("https://api.clinpgx.org/v1/chemical", params={"name": "warfarin"}) drugs = response.json()
Drug categories with pharmacogenomic significance:
Access curated gene-drug relationships with clinical annotations:
python# Get gene-drug pair information response = requests.get("https://api.clinpgx.org/v1/geneDrugPair", params={"gene": "CYP2D6", "drug": "codeine"}) pair_data = response.json() # Get all pairs for a gene response = requests.get("https://api.clinpgx.org/v1/geneDrugPair", params={"gene": "CYP2C19"}) all_pairs = response.json()
Clinical annotation sources:
Access evidence-based clinical practice guidelines:
python# Get CPIC guideline response = requests.get("https://api.clinpgx.org/v1/guideline/PA166104939") guideline = response.json() # List all CPIC guidelines response = requests.get("https://api.clinpgx.org/v1/guideline", params={"source": "CPIC"}) guidelines = response.json()
CPIC guideline components:
Example guidelines:
Query allele function and frequency data:
python# Get allele information response = requests.get("https://api.clinpgx.org/v1/allele/CYP2D6*4") allele_data = response.json() # Get all alleles for a gene response = requests.get("https://api.clinpgx.org/v1/allele", params={"gene": "CYP2D6"}) alleles = response.json()
Allele information includes:
Phenotype categories:
Access clinical annotations for specific genetic variants:
python# Get variant information response = requests.get("https://api.clinpgx.org/v1/variant/rs4244285") variant_data = response.json() # Search variants by position (if supported) response = requests.get("https://api.clinpgx.org/v1/variant", params={"chromosome": "10", "position": "94781859"}) variants = response.json()
Variant data includes:
Retrieve curated literature annotations (formerly PharmGKB clinical annotations):
python# Get clinical annotations response = requests.get("https://api.clinpgx.org/v1/clinicalAnnotation", params={"gene": "CYP2D6"}) annotations = response.json() # Filter by evidence level response = requests.get("https://api.clinpgx.org/v1/clinicalAnnotation", params={"evidenceLevel": "1A"}) high_evidence = response.json()
Evidence levels (from highest to lowest):
Access pharmacogenomic information from drug labels:
python# Get drug labels with PGx information response = requests.get("https://api.clinpgx.org/v1/drugLabel", params={"drug": "warfarin"}) labels = response.json() # Filter by regulatory source response = requests.get("https://api.clinpgx.org/v1/drugLabel", params={"source": "FDA"}) fda_labels = response.json()
Label information includes:
Explore pharmacokinetic and pharmacodynamic pathways:
python# Get pathway information response = requests.get("https://api.clinpgx.org/v1/pathway/PA146123006") # Warfarin pathway pathway_data = response.json() # Search pathways by drug response = requests.get("https://api.clinpgx.org/v1/pathway", params={"drug": "warfarin"}) pathways = response.json()
Pathway diagrams show:
python # Example: Patient is CYP2C19 *1/*2 (intermediate metabolizer) response = requests.get("https://api.clinpgx.org/v1/allele/CYP2C19*2") allele_function = response.json()
python response = requests.get("https://api.clinpgx.org/v1/geneDrugPair", params={"gene": "CYP2C19", "drug": "clopidogrel"}) pair_info = response.json()
python response = requests.get("https://api.clinpgx.org/v1/guideline", params={"gene": "CYP2C19", "drug": "clopidogrel"}) guideline = response.json() # Recommendation: Alternative antiplatelet therapy for IM/PM
python response = requests.get("https://api.clinpgx.org/v1/drugLabel", params={"drug": "clopidogrel"}) label = response.json()
python pgx_panel = ["CYP2C19", "CYP2D6", "CYP2C9", "TPMT", "DPYD", "SLCO1B1"]
python all_interactions = {} for gene in pgx_panel: response = requests.get("https://api.clinpgx.org/v1/geneDrugPair", params={"gene": gene}) all_interactions[gene] = response.json()
python for gene, pairs in all_interactions.items(): for pair in pairs: if pair.get('cpicLevel'): # Has CPIC guideline print(f"{gene} - {pair['drug']}: {pair['cpicLevel']}")
python response = requests.get("https://api.clinpgx.org/v1/chemical", params={"name": "abacavir"}) drug_id = response.json()[0]['id']
python response = requests.get("https://api.clinpgx.org/v1/clinicalAnnotation", params={"drug": drug_id}) annotations = response.json()
python for annotation in annotations: if 'HLA' in annotation.get('genes', []): print(f"Toxicity risk: {annotation['phenotype']}") print(f"Evidence level: {annotation['evidenceLevel']}")
python response = requests.get("https://api.clinpgx.org/v1/allele", params={"gene": "CYP2D6"}) alleles = response.json()
python populations = ['European', 'African', 'East Asian', 'Latino'] frequency_data = {} for allele in alleles: allele_name = allele['name'] frequency_data[allele_name] = { pop: allele.get(f'{pop}_frequency', 'N/A') for pop in populations }
python # Combine allele frequencies with function to predict phenotypes phenotype_dist = calculate_phenotype_frequencies(frequency_data)
python response = requests.get("https://api.clinpgx.org/v1/geneDrugPair", params={"gene": "TPMT", "drug": "azathioprine"}) pair = response.json()
python response = requests.get("https://api.clinpgx.org/v1/clinicalAnnotation", params={"gene": "TPMT", "drug": "azathioprine"}) annotations = response.json()
python high_quality = [a for a in annotations if a['evidenceLevel'] in ['1A', '1B', '2A']]
python pmids = [a['pmid'] for a in high_quality if 'pmid' in a] # Use PubMed skill to retrieve full citations
pythonimport time def rate_limited_request(url, params=None, delay=0.5): """Make API request with rate limiting (2 req/sec max)""" response = requests.get(url, params=params) time.sleep(delay) # Wait 0.5 seconds between requests return response # Use in loops genes = ["CYP2D6", "CYP2C19", "CYP2C9"] for gene in genes: response = rate_limited_request( "https://api.clinpgx.org/v1/gene/" + gene ) data = response.json()
pythondef safe_api_call(url, params=None, max_retries=3): """API call with error handling and retries""" for attempt in range(max_retries): try: response = requests.get(url, params=params, timeout=10) if response.status_code == 200: return response.json() elif response.status_code == 429: # Rate limit exceeded wait_time = 2 ** attempt # Exponential backoff print(f"Rate limit hit. Waiting {wait_time}s...") time.sleep(wait_time) else: response.raise_for_status() except requests.exceptions.RequestException as e: print(f"Attempt {attempt + 1} failed: {e}") if attempt == max_retries - 1: raise time.sleep(1)
pythonimport json from pathlib import Path def cached_query(cache_file, api_func, *args, **kwargs): """Cache API results to avoid repeated queries""" cache_path = Path(cache_file) if cache_path.exists(): with open(cache_path) as f: return json.load(f) result = api_func(*args, **kwargs) with open(cache_path, 'w') as f: json.dump(result, f, indent=2) return result # Usage gene_data = cached_query( 'cyp2d6_cache.json', rate_limited_request, "https://api.clinpgx.org/v1/gene/CYP2D6" )
PharmDOG (formerly DDRx) is ClinPGx's clinical decision support tool for interpreting pharmacogenomic test results:
Key features:
Access: Available at https://www.clinpgx.org/pharmacogenomic-decision-support
Use cases:
Python script with ready-to-use functions for common ClinPGx queries:
get_gene_info(gene_symbol) - Retrieve gene detailsget_drug_info(drug_name) - Get drug informationget_gene_drug_pairs(gene, drug) - Query gene-drug interactionsget_cpic_guidelines(gene, drug) - Retrieve CPIC guidelinesget_alleles(gene) - Get all alleles for a geneget_clinical_annotations(gene, drug, evidence_level) - Query literature annotationsget_drug_labels(drug) - Retrieve pharmacogenomic drug labelssearch_variants(rsid) - Search by variant rsIDexport_to_dataframe(data) - Convert results to pandas DataFrameConsult this script for implementation examples with proper rate limiting and error handling.
Comprehensive API documentation including:
Refer to this document when detailed API information is needed or when constructing complex queries.
ClinPGx consolidates multiple authoritative sources:
As of July 2025, all PharmGKB URLs redirect to corresponding ClinPGx pages.
Query all clinically actionable gene-drug pairs to guide panel selection:
python# Get all CPIC guideline pairs response = requests.get("https://api.clinpgx.org/v1/geneDrugPair", params={"cpicLevel": "A"}) # Level A recommendations actionable_pairs = response.json()
Review patient medications against known genotypes:
pythonpatient_genes = {"CYP2C19": "*1/*2", "CYP2D6": "*1/*1", "SLCO1B1": "*1/*5"} medications = ["clopidogrel", "simvastatin", "escitalopram"] for med in medications: for gene in patient_genes: response = requests.get("https://api.clinpgx.org/v1/geneDrugPair", params={"gene": gene, "drug": med}) # Check for interactions and dosing guidance
Screen for pharmacogenomic contraindications:
python# Check for HLA-B*57:01 before abacavir trial response = requests.get("https://api.clinpgx.org/v1/geneDrugPair", params={"gene": "HLA-B", "drug": "abacavir"}) pair_info = response.json() # CPIC: Do not use if HLA-B*57:01 positive
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-11 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-23 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-19 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +74 percentage points is the difference between those two pass rates over the 23 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.