alterlab-clinpgx

$npx mdskill add AlterLab-IEU/AlterLab-Academic-Skills/alterlab-clinpgx

Query ClinPGx pharmacogenomics data for gene-drug interactions and guidelines.

  • Interpret pharmacogenes like CYP2D6 and CYP2C19 for drug dosing.
  • Uses the keyless ClinPGx (PharmGKB) API via curl or Python.
  • Matches gene-drug pairs to CPIC/DPWG guidelines and drug labels.
  • Returns structured data on dosing recommendations and safety associations.

SKILL.md

.github/skills/alterlab-clinpgxView on GitHub ↗
---
name: alterlab-clinpgx
description: Access ClinPGx pharmacogenomics data (the successor to PharmGKB) to query gene-drug interactions, CPIC/DPWG dosing guidelines, drug labels, and pharmacogene records. Use when interpreting pharmacogenes (CYP2D6, CYP2C19, TPMT, DPYD, SLCO1B1), looking up genotype-guided drug dosing, checking PGx drug-safety associations (e.g. HLA-B*57:01 and abacavir), or supporting precision medicine and clinical pharmacogenomics decisions. For star-allele definitions/frequencies see PharmVar; for germline/somatic variant pathogenicity see alterlab-clinvar. Part of the AlterLab Academic Skills suite.
license: MIT
allowed-tools: Read WebFetch Bash(curl:*) Bash(python:*)
compatibility: Keyless ClinPGx (PharmGKB) API for basic access (no authentication required)
metadata:
    skill-author: AlterLab
    version: "1.0.0"
---

# ClinPGx Database

## Overview

ClinPGx (Clinical Pharmacogenomics Database) is a comprehensive resource for
clinical pharmacogenomics, the 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.

## When to Use This Skill

Use this skill for:

- **Gene-drug interactions** — how variants affect drug metabolism, efficacy, or toxicity
- **CPIC guidelines** — evidence-based clinical practice guidelines for pharmacogenetics
- **Allele information** — allele function, frequency, and phenotype data
- **Drug labels** — FDA and other regulatory pharmacogenomic labeling
- **Pharmacogenomic annotations** — curated literature on gene-drug-disease relationships
- **Clinical decision support** — PharmDOG for phenoconversion and custom genotype interpretation
- **Precision medicine / personalized dosing** — genotype-guided dosing recommendations
- **Drug metabolism** — CYP450 and other pharmacogene functions
- **Adverse drug reactions** — genetic risk factors for drug toxicity

## Setup and Access Essentials

Only `requests` is needed. Run the helper script (or any snippet) with an
ephemeral dependency — no venv to manage:

```bash
uv run --with requests python scripts/query_clinpgx.py
# or, inside an existing project venv: uv pip install requests
```

Base URL: `https://api.clinpgx.org/v1/data/`

- **Resource addressing**: ClinPGx resources are addressed by ClinPGx accession
  IDs in the path (e.g. gene CYP2D6 = `PA128`, CYP2C9 = `PA126`), **not** by gene
  symbols or rsIDs. To resolve a symbol or rsID, query the collection endpoint
  with parameters (e.g. `GET /v1/data/gene?symbol=CYP2D6`,
  `GET /v1/data/variant?symbol=rs4244285`) and read the accession ID from the
  response.
- **Response envelope** (verified): every response is a JSON object
  `{"status": "success"|"fail", "data": [...]}` — the payload is **never** a bare
  list. Read results from `response.json()["data"]`; on `status == "fail"`,
  `data` is `{"errors": [...]}` (e.g. "No results matching criteria").
- **Query-param convention** (verified): genes filter on `relatedGenes.symbol`
  (the `.name` form fails), while chemicals/drugs filter on
  `relatedChemicals.name` — `relatedChemicals.symbol` silently returns
  `status: "fail"` with zero results. The `gene` collection takes `?symbol=`, the
  `chemical` collection takes `?name=`, and `variant` accepts `?symbol=`/`?name=`.
- **Rate limits**: 2 requests per second maximum; excessive requests return HTTP
  429. Implement a ~500ms delay between requests.
- **Authentication**: Not required for basic access.
- **Data license**: Creative Commons Attribution-ShareAlike 4.0 International.
- For substantial API use, notify the ClinPGx team at **[email protected]**.

## Core Workflow

1. **Resolve identifiers** — Convert gene symbols / rsIDs to ClinPGx accession
   IDs via collection endpoints with `symbol=` parameters.
2. **Query the relevant resource** — `gene`, `chemical`, `guidelineAnnotation`,
   `summaryAnnotation`, `variantAnnotation`, `variant`, `label`, or `pathway`.
   There is no `/allele` resource — use **PharmVar** (https://www.pharmvar.org/)
   for star-allele definitions and population frequencies.
3. **Derive gene-drug relationships** — From guideline annotations
   (`relatedGenes.symbol` for genes, `relatedChemicals.name` for drugs), or the
   `/report/pair/{firstObjId}/{secondObjId}/{resultType}` endpoint.
4. **Filter by evidence level** — Prefer levels 1A/1B/2A for clinical use;
   confirm field names against the live OpenAPI spec.
5. **Respect rate limits** — Throttle, retry on 429 with backoff, and cache.

For ready-made functions with rate limiting and error handling, see
`scripts/query_clinpgx.py`.

## Routing Guidance

- **Need the exact code for a resource (gene, chemical, gene-drug pair, CPIC
  guideline, allele/PharmVar, variant, clinical annotation, label, pathway)?**
  Read `references/endpoints-and-capabilities.md`.
- **Doing an end-to-end task (clinical decision support, gene-panel analysis,
  drug-safety assessment, population pharmacogenomics, literature review) or a
  common use case?** Read `references/query-workflows.md`.
- **Need robust API plumbing (rate limiting, retries, caching)?** Read
  `references/rate-limiting-and-error-handling.md`.
- **Need full endpoint/parameter/schema details?** Read
  `references/api_reference.md`.

## References

- `references/api_reference.md` — Complete endpoint listing, request/response
  formats, filter operators, data schemas, rate-limit details, and
  troubleshooting.
- `references/endpoints-and-capabilities.md` — Worked code for all nine
  capability areas (gene, drug/chemical, gene-drug pair, CPIC guidelines,
  allele/PharmVar, variant, clinical annotations, drug labels, pathways),
  including key pharmacogenes and evidence-level definitions.
- `references/query-workflows.md` — Five end-to-end workflows (decision support,
  gene panel, drug safety, population pharmacogenomics, literature review) plus
  common use cases (pre-emptive testing, medication therapy management, trial
  eligibility).
- `references/rate-limiting-and-error-handling.md` — Reusable helpers for rate
  limiting, retries with exponential backoff, and result caching.

## PharmDOG Tool

PharmDOG (formerly DDRx) is ClinPGx's clinical decision support tool for
interpreting pharmacogenomic test results. Features: phenoconversion calculator
(adjusts phenotype for drug-drug interactions affecting CYP2D6), custom genotype
input, QR-code report sharing, selectable guidance sources (CPIC, DPWG, FDA), and
multi-drug analysis. Access:
https://www.clinpgx.org/pharmacogenomic-decision-support

## Important Notes

**Data sources** — ClinPGx consolidates PharmGKB (now part of ClinPGx), CPIC,
PharmCAT, DPWG, and FDA/EMA labels. As of July 2025, all PharmGKB URLs redirect
to corresponding ClinPGx pages.

**Clinical considerations** — Always check evidence strength before clinical
application; allele frequencies vary significantly across populations; account
for phenoconversion (drug-drug interactions) and multi-gene effects; non-genetic
factors (age, organ function) also affect response; not all clinically relevant
alleles are detected by all assays.

**Data updates / API stability** — ClinPGx updates continuously; check
publication dates and the ClinPGx Blog (https://blog.clinpgx.org/). API endpoints
are relatively stable but may change during development — pin versions and test
in development before production.

## Additional Resources

- **ClinPGx website**: https://www.clinpgx.org/
- **ClinPGx Blog**: https://blog.clinpgx.org/
- **API documentation**: https://api.clinpgx.org/
- **CPIC website**: https://cpicpgx.org/
- **PharmCAT**: https://pharmcat.clinpgx.org/
- **PharmVar** (star alleles): https://www.pharmvar.org/
- **ClinGen**: https://clinicalgenome.org/
- **Contact**: [email protected] (for substantial API use)

More from AlterLab-IEU/AlterLab-Academic-Skills

SkillDescription
alterlab-abm-mesaBuilds agent-based models of social systems with Mesa 3 — the current AgentSet API (model.agents.shuffle_do('step'), auto-assigned unique_id, mandatory super().__init__(seed=...)), cell spaces (mesa.discrete_space OrthogonalMooreGrid / classic mesa.space grids), the DataCollector, batch_run parameter sweeps, and SolaraViz — for emergence, segregation, diffusion, opinion dynamics, and cooperation models. It uses the Mesa 3.x API (the old mesa.time schedulers like RandomActivation are removed) and treats the model as a generative theory to be validated, not just run. Use when the request mentions an agent-based model, Mesa, simulating interacting agents, or emergent macro behavior from micro rules. For discrete-event (queueing/process) simulation prefer alterlab-simpy; for reinforcement learning prefer alterlab-stable-baselines3. Part of the AlterLab Academic Skills suite.
alterlab-academic-careerPrepares academic career documents and professional-development materials for faculty and researchers. Use when drafting academic CVs, research statements, teaching philosophies, diversity statements, faculty-position cover letters, tenure dossiers, promotion narratives, academic portfolios, or mentorship statements, and when planning conference-networking strategy, building academic web presence, setting up ORCID profiles, or understanding impact metrics. Part of the AlterLab Academic Skills suite.
alterlab-accreditation-aolScaffolds program-level Assurance-of-Learning (AoL) documentation for AACSB (2020 Standard 5) and ABET (Criterion 3 Student Outcomes, Criterion 4 Continuous Improvement) accreditation — program learning outcomes / competency goals, curriculum-to-outcome mapping matrices, direct- and indirect-assessment plans, rubric design, and closing-the-loop continuous-improvement narratives — and validates the structure of an outcome-mapping matrix with scripts/aol_matrix.py. Use when the user needs AACSB or ABET assurance-of-learning material, a program-learning-outcomes set, a curriculum/outcome map or coverage matrix, a direct/indirect assessment plan, a closing-the-loop report, or accreditation self-study text. For single-course design or course rubrics prefer alterlab-teaching-design; for post-award grant reports prefer alterlab-grant-reporting. Part of the AlterLab Academic Skills suite.
alterlab-adaptyvSubmits and tracks protein-testing experiments on the Adaptyv Bio Foundry cloud lab (wet-lab validation), and optimizes protein sequences before submission with computational tools (NetSolP, SoluProt, SolubleMPNN, ESM). Use when designing proteins that need wet-lab validation - binding/affinity screening, expression testing, thermostability, or fluorescence assays - or when submitting experiments to the Foundry API, browsing the target catalog, tracking experiment status, retrieving results, or pre-screening sequences for solubility/expression. Triggers on "Adaptyv", "Foundry API", "cloud lab", "biolayer interferometry / BLI", "wet-lab validation". Part of the AlterLab Academic Skills suite.
alterlab-aeonRuns time series machine learning with the aeon library — classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search via scikit-learn compatible APIs. Use when working with temporal data, sequential patterns, or time-indexed observations (univariate or multivariate) that need specialized algorithms beyond standard ML approaches. Part of the AlterLab Academic Skills suite.
alterlab-akademik-tesvikComputes the annual Turkish academic-incentive (akademik teşvik) score for Devlet (state) university öğretim elemanı (academic staff) from a classified activity list, applying the verified Akademik Teşvik Ödeneği Yönetmeliği (2018/11834) Faaliyet Hesaplama Tablosu headline puanları (Proje 20, Araştırma 15, Yayın 30, Patent 30, Atıf 30, Tebliğ 20, Ödül 20) with the k (author-count), p (Q1 1/Q2 0.8/Q3 0.5/Q4 0.25), and r (project-role) coefficients via türü puanı = Σ(faaliyet oranları) × headline (MADDE 8/2), then enforcing the per-type headline ceilings, the 100 cap (MADDE 8/3), and the net-30 payment gate (MADDE 10/3) in a deterministic scripts/tesvik_score.py. Use when the user wants to calculate akademik teşvik puanı, check the en az 30 (net-30) threshold, apply TABLO 4 ceilings, or estimate teşvik eligibility; keeps its coefficients separate from doçentlik scoring. For doçentlik point eligibility prefer alterlab-docentlik-eligibility. Part of the AlterLab Academic Skills suite.
alterlab-alpha-vantageAccesses real-time and historical stock market data, forex rates, cryptocurrency prices, commodities, economic indicators, and 50+ technical indicators via the Alpha Vantage API (requires a free API key from alphavantage.co). Use when fetching stock prices (OHLCV), company fundamentals (income statement, balance sheet, cash flow), earnings, options data, market news/sentiment, insider transactions, GDP, CPI, treasury yields, gold/silver/oil prices, Bitcoin/crypto prices, forex exchange rates, or calculating technical indicators (SMA, EMA, MACD, RSI, Bollinger Bands). Part of the AlterLab Academic Skills suite.
alterlab-alphafoldPredict protein 3D structures with AlphaFold2 via ColabFold — MMseqs2-accelerated MSAs, monomer and AlphaFold2-Multimer complex folding, and confidence-based validation (pLDDT, pTM/ipTM, PAE). Use when folding a protein sequence or complex from FASTA, generating a predicted structure with confidence metrics, ranking models, or checking self-consistency of a design. For co-folding a protein WITH a small-molecule ligand or predicting binding affinity prefer alterlab-boltz; for antibody–antigen or one-FASTA multi-entity complexes prefer alterlab-chai; to LOOK UP an already-computed structure prefer alterlab-alphafold-db; for ESM embeddings or inverse folding prefer alterlab-esm. Part of the AlterLab Academic Skills suite.
alterlab-alphafold-dbAccess the AlphaFold DB of 200M+ AI-PREDICTED protein structures — retrieve models by UniProt accession, download PDB/mmCIF files, and analyze prediction confidence metrics (pLDDT, PAE). Use when a UniProt ID needs a computationally predicted 3D structure or when no experimental structure exists, for homology modeling, protein engineering, or structure-based drug discovery; for EXPERIMENTALLY determined structures (X-ray, cryo-EM, NMR) prefer alterlab-pdb, and for protein sequences, annotations, or accession ID mapping prefer alterlab-uniprot instead. Part of the AlterLab Academic Skills suite.
alterlab-anndataBuild, slice, concatenate, read, and write AnnData annotated data matrices (obs, var, X, layers, obsm, uns) — the scverse data STRUCTURE, not an analysis pipeline. Use when creating or wrangling .h5ad/zarr files, managing cell and gene annotations, concatenating batches, or handling layers/obsm/backed-mode; for the QC, normalization, clustering, UMAP, and differential-expression analysis pipeline prefer alterlab-scanpy instead, and for RNA velocity from spliced/unspliced layers prefer alterlab-scvelo instead. Part of the AlterLab Academic Skills suite.