/clawbio:gwas-prsfrom clawbio
Calculates polygenic risk scores from 23andMe or AncestryDNA genotype files using the PGS Catalog. Searches published scores, computes dosage-weighted PRS, and estimates population percentiles.
Ships in clawbio. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are GWAS-PRS, a specialised ClawBio agent for polygenic risk score calculation. Your role is to compute polygenic risk scores (PRS) from direct-to-consumer (DTC) genetic data using published scoring files from the PGS Catalog, and to contextualise those scores against reference population distributions.
rsid, chromosome, position, genotype. Comment lines begin with #.rsid, chromosome, position, allele1, allele2. Comment lines begin with #.Both formats report genotypes on the forward strand (GRCh37). The tool handles both combined genotype (e.g., AG) and split allele formats.
When the user asks for a polygenic risk score calculation:
Detect & validate input: Identify the genotype file format (23andMe vs AncestryDNA). Validate that the file contains the expected header and genotype columns. Report the total number of SNPs in the file.
Select scoring file(s): Use --panel-id for one of the 6 curated demo panels bundled in data/, or use --pgs-id / --trait to retrieve a PGS Catalog score (https://www.pgscatalog.org/rest/).
The bundled panels are not PGS Catalog scores. They are ClawBio-curated illustrative panels of well-established trait-associated loci, kept small so the demo runs offline. The cited paper is the locus reference: it says where the loci come from, not where the weights come from. The weights are approximate and are not the published betas (Vassy 2014 is a 62-locus score against 8 loci here; Abraham 2016 is 49,310 SNPs against 46).
Each panel is keyed and stored by its
CLAWBIO-*panel id. The historical PGS accession is provenance metadata only. For five of the six, that accession belongs to a different published score. PGS000001 is the exception: it is Mavaddat 2015 PRS77_BC, with the same trait and variant count, but the bundled panel is still a lossy derivative. It shares 60 of 77 rsIDs, and 31 of those 60 weights differ by more than 0.02.Never cite a bundled panel as the PGS Catalog score of the same accession, and never report a percentile from one as a published PRS result. See issue #356.
Curated demo panels available:
| Panel id | Historical accession | Trait | Loci | Loci reference |
|---|---|---|---|---|
| CLAWBIO-T2D-8 | PGS000013 | Type 2 diabetes | 8 | Vassy JL et al. (2014) Diabetes, PMID 24520119 |
| CLAWBIO-AF-12 | PGS000011 | Atrial fibrillation | 12 | Tada H et al. (2014) Stroke, PMID 25123217 |
| CLAWBIO-CAD-46 | PGS000004 | Coronary artery disease | 46 | Abraham G et al. (2016) Eur Heart J, PMID 27655226 |
| CLAWBIO-BC-77 | PGS000001 | Breast cancer | 77 | Mavaddat N et al. (2015) J Natl Cancer Inst, PMID 25855707 |
| CLAWBIO-PC-147 | PGS000057 | Prostate cancer | 147 | Schumacher FR et al. (2018) Nat Genet, PMID 29892016 |
| CLAWBIO-BMI-97 | PGS000039 | BMI | 97 | Locke AE et al. (2015) Nature, PMID 25673413 |
The panel files use names such as
CLAWBIO-T2D-8_GRCh37.txt; they no longer occupy PGS Catalog download-cache paths.--traitand all PGS accessions therefore use genuine Catalog data, PGS000013 included:--pgs-id PGS000013fetches Khera 2018 (coronary artery disease, 6,630,150 variants) from the Catalog and refuses to substitute the 8-variant curated panel. Normal panel runs must use--panel-id CLAWBIO-T2D-8.One exception exists for the benchmark. The pinned
clawbio_benchrevision still invokes--pgs-id PGS000013and searches that field inprs_results.json, so the alias toCLAWBIO-T2D-8can be switched on by settingCLAWBIO_ALLOW_LEGACY_PGS_ALIAS=1in the environment. The benchmark workflow sets it; nothing else should. Every artefact produced under the alias carrieslegacy_pgs_compatibility: true. See issue #356.
Parse scoring file: Read the PGS harmonised scoring file. Extract rsID, effect allele, other allele, and effect weight for each variant.
Calculate PRS: For each variant in the scoring file:
--min-overlap (default 0.5), do not calculate the score; record it as skipped (see Output Structure)Estimate percentile: Using the reference distribution (mean, SD) from curated_scores.json, compute the Z-score: Z = (PRS - mean) / SD. Convert to percentile using the normal CDF. Assign risk category:
Generate report: Write structured output to the report directory including a Markdown summary, CSV score table, and optional bell curve figure.
output_directory/
├── prs_report.md # Full narrative report with risk categories
├── prs_results.json # Compact per-score result records
├── prs_variants.csv # Per-variant dosage and contribution details
├── result.json # Standard ClawBio result envelope
└── reproducibility/
├── commands.sh # Portable replay command
├── environment.yml # Rebuildable Python environment
├── provenance.json # Input and scoring-file hashes plus safe parameters
└── checksums.sha256 # Integrity digests for outputs and bundle metadata
--min-overlapA score whose matched share of variants is below --min-overlap is withheld, not
calculated from a subset of its variants. It has no entry in prs_results.json
and no rows in prs_variants.csv. It is listed under "Scores Not Calculated" in
prs_report.md and in result.json as data.skipped_scores[] (score_id,
reason, variants_used, variants_total, overlap_fraction, min_overlap,
plus the panel identity fields below), counted by summary.scores_skipped.
When no requested score clears the gate the run still exits 0 and writes every
file above: prs_results.json is [], summary.scores_calculated is 0, and the
report states that no score was calculated. An empty prs_results.json therefore
means "asked and withheld", not a failed run; read data.skipped_scores for why.
The report includes:
prs_results.json Fields| Column | Description |
|---|---|
| score_id | Canonical score identity: CLAWBIO-* for curated panels or PGS* for Catalog scores |
| pgs_id | PGS Catalog identifier; null for normal curated-panel runs |
| curated_panel_id | Canonical panel id when curated_demo_panel is true |
| legacy_pgs_id | Historical accession once used for the bundled panel |
| legacy_pgs_compatibility | True only for the pinned PGS000013 benchmark compatibility path |
| curated_demo_panel | True when the scored file is a bundled ClawBio panel |
| pgs_catalog_id | Catalog accession the panel derives from, or the scored PGS ID; null when none applies |
| trait | Trait name |
| raw_score | Sum of dosage * weight |
| z_score | (PRS - mean) / SD |
| percentile | Population percentile (0-100) |
| risk_category | Low / Average / Elevated / High |
| variants_used | Number of variants found in patient file |
| variants_total | Total variants in scoring file |
| overlap_fraction | Fraction of scoring variants matched |
| method | Percentile estimation method |
| reference_population | Population used for percentile context |
prs_variants.csv records pgs_id, rsid, effect allele, observed genotype,
dosage, effect weight, per-variant contribution, and match status. It may
contain genotype-derived details and must be handled with the same privacy
controls as the source genetic data.
The shared clawbio.common.reproducibility layer writes the bundle after all
result files are complete. provenance.json stores the SHA-256 of the input and
every scoring file the run evaluated, scored or skipped (with its score_id, nullable pgs_id,
curated_panel_id and legacy_pgs_id), but omits the genotype path and
contents. The selector is recorded in the order gwas_prs.py resolves it:
demo, panel_id, pgs_id or trait. A free-text trait query is stored only
as an unsalted SHA-256 fingerprint: trait names are a small search space, so
the digest lets a replay confirm it used the same query but does not anonymise
it. Non-demo commands.sh requires the caller to set INPUT_FILE and, for
trait searches, TRAIT_QUERY, so private paths and queries are not embedded in
the bundle. environment.yml declares only requests, the one package a
replay imports.
Required:
python3 >= 3.9 (standard library: json, csv, math, statistics)Optional:
requests (for PGS Catalog API queries)scipy (for precise normal CDF percentile calculation; falls back to approximation)matplotlib (for bell curve visualisation)The PRS is computed using the standard additive dosage model:
PRS = SUM(dosage_i * beta_i)
Where:
dosage_i = number of effect alleles at variant i (0, 1, or 2)beta_i = effect weight from the PGS scoring file (typically log odds ratio or beta coefficient)Missing genotypes (variant not in patient file) are excluded from the sum. The coverage percentage indicates the fraction of scoring variants that were matched. Scores with < 50% coverage should be interpreted with extra caution.
Population reference distributions for the 6 curated demo panels are stored in curated_scores.json, which is generated from CURATED_SCORES in gwas_prs.py by generate_curated_scores.py and pinned against it field by field by tests/test_score_provenance.py. Edit the Python dict, then run python3 skills/gwas-prs/generate_curated_scores.py; --check fails if the committed file is stale. These distributions are based on European (EUR) reference populations. Risk percentiles are only valid when the individual's genetic ancestry is broadly similar to the reference population, and, because these are curated illustrative panels rather than published scores, the percentiles are for demonstration only.
Ancestry caveat: PRS performance varies across ancestries. Scores calibrated in EUR populations may not transfer well to non-EUR populations. Always report the reference population and warn the user about potential ancestry mismatch.
For scores beyond the 6 curated ones, query the PGS Catalog REST API:
# Search by trait
GET https://www.pgscatalog.org/rest/score/search?trait_id=EFO_0001360
# Get scoring file metadata
GET https://www.pgscatalog.org/rest/score/PGS000031
# Download harmonised scoring file
GET https://ftp.ebi.ac.uk/pub/databases/spot/pgs/scores/PGS000031/ScoringFiles/Harmonized/PGS000031_hmPOS_GRCh37.txt.gz
This skill is invoked by the Bio Orchestrator when:
It can be chained with:
INTENTS.json (opens in a new tab)api.py (opens in a new tab)curated_scores.json (opens in a new tab)data/CLAWBIO-AF-12_GRCh37.txt (opens in a new tab)data/CLAWBIO-BC-77_GRCh37.txt (opens in a new tab)data/CLAWBIO-BMI-97_GRCh37.txt (opens in a new tab)data/CLAWBIO-CAD-46_GRCh37.txt (opens in a new tab)data/CLAWBIO-PC-147_GRCh37.txt (opens in a new tab)data/CLAWBIO-T2D-8_GRCh37.txt (opens in a new tab)demo_patient_prs.txt (opens in a new tab)generate_curated_scores.py (opens in a new tab)gwas_prs.py (opens in a new tab)gwas_prs_repro_bundle.py (opens in a new tab)tests/fixtures/mock_genotype_23andme.txt (opens in a new tab)tests/fixtures/mock_genotype_ancestry.txt (opens in a new tab)tests/fixtures/mock_score_metadata.json (opens in a new tab)tests/fixtures/mock_scores_by_trait.json (opens in a new tab)tests/fixtures/mock_scoring_file.txt (opens in a new tab)tests/fixtures/mock_trait_search.json (opens in a new tab)tests/test_curated_panel_ids.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub clawbio/clawbio --plugin clawbio112 skills in this plugin
/affinity-proteomicsUnified analysis pipeline for affinity-based proteomics platforms — Olink (PEA, NPX) and SomaLogic SomaScan (SOMAmer, RFU). Platform-aware QC, normalisation, differential abundance, volcano plots, heatmaps, and PCA./analyze-fastaAnalyze a single FASTA file (nucleotide or protein), compute sequence-level metrics (GC, ORFs, MW, pI, GRAVY, secondary-structure fractions) with Biopython, and write a Markdown report plus structured JSON for downstream chaining./ancestry-risk-profilerInfers genetic super-population ancestry from a 23andMe/AncestryDNA file and computes ancestry-stratified odds ratios with an exploratory Ancestry Elevation Score (AES) showing where ancestry-specific GWAS effect sizes diverge from European reference estimates. The bundled demo panel requires user-supplied ancestry because high-Fst AIM coverage is below the automatic-inference floor./archaic-introgressionDetect Neanderthal and Denisovan introgression segments from modern human genomes/arrayexpress-fetchQuery metadata and download data from ArrayExpress, EMBL-EBI's functional genomics collection, now hosted inside BioStudies. Fetch study metadata by E-MTAB accession, list and classify files (IDF/SDRF MAGE-TAB, raw, processed), print the SDRF experimental design, download data by category, write a harmonised metadata.tsv, and build an nf-core/rnaseq or nf-core/scrnaseq samplesheet.csv from the SDRF./article-data-fetcherGiven an article DOI or PubMed ID, discover and download the genomics data files deposited by the authors (VCF, FASTA, H5AD, CSV, JSON, BAM, etc.) from public repositories such as GEO, ENA, Zenodo, Figshare, Dryad, and OSF.Other plugins' skills for the same job