bio-clinical-databases-pharmacogenomics

Query PharmGKB and CPIC for drug-gene interactions, pharmacogenomic annotations, and dosing guidelines. Use when predicting drug response from genetic variants or implementing clinical pharmacogenomics.

1,802 stars

Best use case

bio-clinical-databases-pharmacogenomics is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Query PharmGKB and CPIC for drug-gene interactions, pharmacogenomic annotations, and dosing guidelines. Use when predicting drug response from genetic variants or implementing clinical pharmacogenomics.

Teams using bio-clinical-databases-pharmacogenomics 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/bio-clinical-databases-pharmacogenomics/SKILL.md --create-dirs "https://raw.githubusercontent.com/FreedomIntelligence/OpenClaw-Medical-Skills/main/skills/bio-clinical-databases-pharmacogenomics/SKILL.md"

Manual Installation

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

How bio-clinical-databases-pharmacogenomics Compares

Feature / Agentbio-clinical-databases-pharmacogenomicsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Query PharmGKB and CPIC for drug-gene interactions, pharmacogenomic annotations, and dosing guidelines. Use when predicting drug response from genetic variants or implementing clinical pharmacogenomics.

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

## Version Compatibility

Reference examples tested with: pandas 2.2+

Before using code patterns, verify installed versions match. If versions differ:
- Python: `pip show <package>` then `help(module.function)` to check signatures

If code throws ImportError, AttributeError, or TypeError, introspect the installed
package and adapt the example to match the actual API rather than retrying.

# Pharmacogenomics

## PharmGKB REST API

**Goal:** Retrieve drug-gene clinical annotations and dosing guidelines from PharmGKB.

**Approach:** Query PharmGKB REST endpoints by gene symbol or drug name and parse JSON annotation records.

**"Find pharmacogenomic annotations for this gene"** → Query PharmGKB for clinical annotations linking genes to drug response.
- Python: `requests.get()` against PharmGKB API (requests)

### Query Drug-Gene Relationships

```python
import requests

def get_pharmgkb_annotations(gene_symbol):
    '''Get PharmGKB clinical annotations for a gene'''
    url = f'https://api.pharmgkb.org/v1/data/clinicalAnnotation'
    params = {'view': 'base', 'location.genes.symbol': gene_symbol}
    response = requests.get(url, params=params)
    return response.json()['data']

annotations = get_pharmgkb_annotations('CYP2D6')
for ann in annotations[:5]:
    print(f"{ann['location']['genes'][0]['symbol']}: {ann['chemicals'][0]['name']}")
```

### Query by Drug

```python
def get_drug_annotations(drug_name):
    '''Get pharmacogenomic annotations for a drug'''
    url = 'https://api.pharmgkb.org/v1/data/clinicalAnnotation'
    params = {'view': 'base', 'chemicals.name': drug_name}
    response = requests.get(url, params=params)
    return response.json()['data']

warfarin_annotations = get_drug_annotations('warfarin')
```

### Get Dosing Guidelines

```python
def get_cpic_guidelines(gene_symbol):
    '''Get CPIC dosing guidelines for a gene'''
    url = 'https://api.pharmgkb.org/v1/data/guideline'
    params = {'view': 'base', 'relatedGenes.symbol': gene_symbol, 'source': 'CPIC'}
    response = requests.get(url, params=params)
    return response.json()['data']

guidelines = get_cpic_guidelines('CYP2C19')
for g in guidelines:
    print(f"{g['name']}: {g['chemicals'][0]['name']}")
```

## Star Allele Interpretation

**Goal:** Determine metabolizer phenotype from CYP star allele diplotypes using CPIC activity scores.

**Approach:** Sum per-allele activity scores and classify into PM/IM/NM/UM categories based on CPIC thresholds.

### CYP2D6 Metabolizer Status

```python
# CYP2D6 activity scores for common alleles
# Based on CPIC guidelines
CYP2D6_ACTIVITY = {
    '*1': 1.0,   # Normal function
    '*2': 1.0,   # Normal function
    '*3': 0.0,   # No function
    '*4': 0.0,   # No function
    '*5': 0.0,   # Gene deletion
    '*6': 0.0,   # No function
    '*9': 0.5,   # Decreased function
    '*10': 0.25, # Decreased function (common in East Asian)
    '*17': 0.5,  # Decreased function
    '*41': 0.5,  # Decreased function
}

def calculate_activity_score(allele1, allele2):
    '''Calculate CYP2D6 activity score from diplotype'''
    score1 = CYP2D6_ACTIVITY.get(allele1, 1.0)
    score2 = CYP2D6_ACTIVITY.get(allele2, 1.0)
    return score1 + score2

def get_metabolizer_status(activity_score):
    '''Convert activity score to metabolizer phenotype

    CPIC thresholds:
    - PM: 0
    - IM: 0 < score <= 1.25
    - NM: 1.25 < score <= 2.25
    - UM: > 2.25 (gene duplications)
    '''
    if activity_score == 0:
        return 'Poor Metabolizer (PM)'
    elif activity_score <= 1.25:
        return 'Intermediate Metabolizer (IM)'
    elif activity_score <= 2.25:
        return 'Normal Metabolizer (NM)'
    else:
        return 'Ultrarapid Metabolizer (UM)'

score = calculate_activity_score('*1', '*4')
status = get_metabolizer_status(score)
print(f'Activity score: {score}, Status: {status}')
```

### CYP2C19 Interpretation

```python
CYP2C19_ACTIVITY = {
    '*1': 1.0,   # Normal function
    '*2': 0.0,   # No function (most common loss-of-function)
    '*3': 0.0,   # No function
    '*17': 1.5,  # Increased function
}

def cyp2c19_phenotype(allele1, allele2):
    '''Determine CYP2C19 metabolizer status'''
    score = CYP2C19_ACTIVITY.get(allele1, 1.0) + CYP2C19_ACTIVITY.get(allele2, 1.0)
    if score == 0:
        return 'Poor Metabolizer'
    elif score < 1.5:
        return 'Intermediate Metabolizer'
    elif score <= 2.0:
        return 'Normal Metabolizer'
    elif score <= 2.5:
        return 'Rapid Metabolizer'
    else:
        return 'Ultrarapid Metabolizer'
```

## Drug Interaction Lookup

**Goal:** Check whether a specific drug-gene-variant combination has a known pharmacogenomic interaction.

**Approach:** Query PharmGKB variant annotation endpoint filtered by drug and gene, then match to the target variant.

```python
def check_pgx_interaction(drug, gene, variant):
    '''Check for pharmacogenomic drug-gene-variant interaction'''
    url = 'https://api.pharmgkb.org/v1/data/variantAnnotation'
    params = {
        'chemicals.name': drug,
        'location.genes.symbol': gene
    }
    response = requests.get(url, params=params)
    annotations = response.json().get('data', [])

    for ann in annotations:
        if variant in str(ann.get('variant', {}).get('name', '')):
            return {
                'drug': drug,
                'gene': gene,
                'variant': variant,
                'phenotype': ann.get('phenotypes', []),
                'evidence': ann.get('evidenceLevel')
            }
    return None
```

## Common PGx Gene-Drug Pairs

| Gene | Drugs | Clinical Impact |
|------|-------|-----------------|
| CYP2D6 | Codeine, tamoxifen, ondansetron | Efficacy, toxicity |
| CYP2C19 | Clopidogrel, omeprazole, escitalopram | Efficacy, dosing |
| CYP2C9 | Warfarin, phenytoin, NSAIDs | Bleeding risk, dosing |
| VKORC1 | Warfarin | Dosing |
| TPMT | Azathioprine, mercaptopurine | Myelosuppression |
| DPYD | Fluorouracil, capecitabine | Severe toxicity |
| HLA-B*57:01 | Abacavir | Hypersensitivity |
| HLA-B*15:02 | Carbamazepine | SJS/TEN |
| SLCO1B1 | Simvastatin | Myopathy risk |
| UGT1A1 | Irinotecan | Neutropenia |

## Batch PGx Annotation

**Goal:** Annotate a cohort of variants across multiple pharmacogenes with drug interaction data.

**Approach:** Iterate over a list of pharmacogenes, fetch PharmGKB annotations for each, and collect results into a DataFrame.

```python
import pandas as pd

def annotate_pgx_variants(vcf_variants, pgx_genes):
    '''Annotate variants in pharmacogenes

    Args:
        vcf_variants: DataFrame with chrom, pos, ref, alt
        pgx_genes: List of pharmacogenes to check
    '''
    results = []
    for gene in pgx_genes:
        annotations = get_pharmgkb_annotations(gene)
        for ann in annotations:
            results.append({
                'gene': gene,
                'drug': ann['chemicals'][0]['name'] if ann.get('chemicals') else None,
                'phenotype': ann.get('phenotypes', []),
                'level': ann.get('levelOfEvidence')
            })
    return pd.DataFrame(results)

pgx_genes = ['CYP2D6', 'CYP2C19', 'CYP2C9', 'VKORC1', 'TPMT']
pgx_df = annotate_pgx_variants(vcf_df, pgx_genes)
```

## Related Skills

- clinical-databases/clinvar-lookup - Pathogenicity classification
- variant-calling/clinical-interpretation - ACMG guidelines
- clinical-databases/variant-prioritization - Clinical filtering

Related Skills

tooluniverse-clinical-trial-matching

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

AI-driven patient-to-trial matching for precision medicine and oncology. Given a patient profile (disease, molecular alterations, stage, prior treatments), discovers and ranks clinical trials from ClinicalTrials.gov using multi-dimensional matching across molecular eligibility, clinical criteria, drug-biomarker alignment, evidence strength, and geographic feasibility. Produces a quantitative Trial Match Score (0-100) per trial with tiered recommendations and a comprehensive markdown report. Use when oncologists, molecular tumor boards, or patients ask about clinical trial options for specific cancer types, biomarker profiles, or post-progression scenarios.

tooluniverse-clinical-trial-design

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Strategic clinical trial design feasibility assessment using ToolUniverse. Evaluates patient population sizing, biomarker prevalence, endpoint selection, comparator analysis, safety monitoring, and regulatory pathways. Creates comprehensive feasibility reports with evidence grading, enrollment projections, and trial design recommendations. Use when planning Phase 1/2 trials, assessing trial feasibility, or designing biomarker-driven studies.

tooluniverse-clinical-guidelines

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Search and retrieve clinical practice guidelines across 12+ authoritative sources including NICE, WHO, ADA, AHA/ACC, NCCN, SIGN, CPIC, CMA, CTFPHC, GIN, MAGICapp, PubMed, EuropePMC, TRIP, and OpenAlex. Covers disease management, cardiology, oncology, diabetes, pharmacogenomics, and more. Use when users ask about clinical guidelines, treatment recommendations, standard of care, evidence-based medicine, or drug-gene dosing recommendations.

clinicaltrials-database

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Query ClinicalTrials.gov via API v2. Search trials by condition, drug, location, status, or phase. Retrieve trial details by NCT ID, export data, for clinical research and patient matching.

clinical-trials-search

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Search ClinicalTrials.gov with natural language queries. Find clinical trials, enrollment, and outcomes using Valyu semantic search.

clinical-trial-protocol-skill

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Generate clinical trial protocols for medical devices or drugs. This skill should be used when users say "Create a clinical trial protocol", "Generate protocol for [device/drug]", "Help me design a clinical study", "Research similar trials for [intervention]", or when developing FDA submission documentation for investigational products.

clinical-reports

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Write comprehensive clinical reports including case reports (CARE guidelines), diagnostic reports (radiology/pathology/lab), clinical trial reports (ICH-E3, SAE, CSR), and patient documentation (SOAP, H&P, discharge summaries). Full support with templates, regulatory compliance (HIPAA, FDA, ICH-GCP), and validation tools.

clinical-diagnostic-reasoning

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Identify and counteract cognitive biases in medical decision-making through systematic error analysis and contextual algorithm application. For diagnostic reasoning, treatment decisions, and clinical judgment improvement. NOT for basic medical knowledge, technical procedures, or non-clinical healthcare domains.

clinical-decision-support

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Generate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.

bio-variant-calling-clinical-interpretation

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Clinical variant interpretation using ClinVar, ACMG guidelines, and pathogenicity predictors. Prioritize variants for diagnostic and research applications. Use when interpreting clinical significance of variants.

bio-clinical-databases-variant-prioritization

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Filter and prioritize variants by pathogenicity, population frequency, and clinical evidence for rare disease analysis. Use when identifying candidate disease-causing variants from exome or genome sequencing.

bio-clinical-databases-tumor-mutational-burden

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Calculate tumor mutational burden from panel or WES data with proper normalization and clinical thresholds. Use when assessing immunotherapy eligibility or characterizing tumor immunogenicity.