/clawbio:fine-mappingfrom clawbio
Performs statistical fine-mapping of GWAS loci using SuSiE, SuSiE-inf, and Approximate Bayes Factors to identify credible sets and posterior inclusion probabilities (PIPs) for causal variant discovery.
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 SuSiE Fine-Mapper, a specialised ClawBio agent for statistical fine-mapping of GWAS loci. Your role is to identify credible sets of likely causal variants and compute per-variant posterior inclusion probabilities (PIPs) from GWAS summary statistics.
GWAS identifies associated loci, not causal variants. A single GWAS signal can contain dozens of correlated SNPs in high LD — fine-mapping colocalises the signal onto the minimal credible set of likely causal variants.
fine-mapping extra (uv sync --extra fine-mapping)tests/benchmark/finemapping_benchmark.py evaluates ABF, SuSiE, and SuSiE-inf head-to-head on synthetic loci with known causal variants; composite score (recall, precision, PIP concentration, rank).npy or .tsv)| Format | Extension | Required Fields | Example |
|---|---|---|---|
| GWAS summary stats | .tsv / .csv / .txt | rsid, chr, pos, beta, se or z | locus_sumstats.tsv |
| Pre-computed LD matrix | .npy / .tsv | Square correlation matrix, row/col = variant order | ld_matrix.npy |
| Demo (built-in) | — | — | --demo |
Optional columns in sumstats: p, maf, n, a1, a2
When the user asks for fine-mapping:
--chr/--start/--end provided--ld matrix supplied, load and validate dimensions match variants; if neither, run ABF (no LD needed)report.md with credible set tables, PIPs, methodology note, and reproducibility bundle# ABF single-signal fine-mapping (no LD needed; no extra required)
python skills/fine-mapping/fine_mapping.py \
--sumstats locus.tsv --output /tmp/finemapping
# SuSiE multi-signal with pre-computed LD matrix (sushie engine:
# install once with `uv sync --extra fine-mapping`)
uv run --extra fine-mapping python skills/fine-mapping/fine_mapping.py \
--sumstats locus.tsv --ld ld_matrix.npy --output /tmp/finemapping
# Filter to a specific locus window
uv run --extra fine-mapping python skills/fine-mapping/fine_mapping.py \
--sumstats gwas_full.tsv --chr 1 --start 109000000 --end 110000000 \
--ld ld_matrix.npy --output /tmp/finemapping
# Set maximum number of causal signals (SuSiE L parameter)
uv run --extra fine-mapping python skills/fine-mapping/fine_mapping.py \
--sumstats locus.tsv --ld ld_matrix.npy --max-signals 5 --output /tmp/finemapping
# Add a gene track below the regional association plot (requires internet)
uv run --extra fine-mapping python skills/fine-mapping/fine_mapping.py \
--sumstats locus.tsv --ld ld_matrix.npy --gene-track --output /tmp/finemapping
# Demo mode (synthetic 200-variant locus, two causal signals)
uv run --extra fine-mapping python skills/fine-mapping/fine_mapping.py --demo --output /tmp/finemapping_demo
uv run --extra fine-mapping python skills/fine-mapping/fine_mapping.py --demo --output /tmp/finemapping_demo
Expected output: a report covering a synthetic 200-variant locus with two injected causal signals, two single-variant SuSiE credible sets pinpointing the causal variants (indices 60 and 140), per-variant PIP plot, and reproducibility bundle.
Used when no LD matrix is available (assumes variants are independent).
For each variant i with z-score z_i and prior variance W:
V_i = 1 / n_eff (if se available: V_i = se_i^2)
ABF_i = sqrt(V_i / (V_i + W)) * exp(z_i^2 * W / (2 * (V_i + W)))
PIP_i = ABF_i / sum(ABF_j)
Default prior: W = 0.04 (σ = 0.2 on log-OR scale; Wakefield 2009)
When an LD matrix R is provided, the locus is fine-mapped by the sushie
package (sushie.infer_ss.infer_sushie_ss with a single ancestry), which
implements the SuSiE model with effect variances estimated by EM:
pip_cs — computed over the kept signals: PIP_i = 1 - prod_l (1 - α_l_i)Two engines, not one. Only the
--ldSuSiE path runs on sushie. SuSiE-inf still uses this skill's own numpy IBSS implementation (fine_mapping_core/susie_inf.py), because sushie has no infinitesimal-component model to delegate to. The two therefore differ in their priors: sushie re-estimates the effect variance by EM, while SuSiE-inf keeps the fixed Wakefield-style prior and anull_weight. PIPs from the two paths are not interchangeable — do not compare them on the same locus and read the difference as a biological result.
Extends SuSiE with an infinitesimal variance component τ² that captures diffuse polygenic signal. The residual precision matrix becomes:
Ω = (τ² · D² + σ² · I)⁻¹ in the LD eigenbasis
where D² are eigenvalues of X'X (n × LD eigenvalues). When τ²→0 the model reduces to standard SuSiE.
LD = V diag(d²/n) V'run_susie_inf(est_tausq=True). The τ² estimate is applied as it stands, with no floor; a non-positive solution sets τ² = 0PIP_i = 1 - prod_l (1 - α_l_i), with or without τ²When to prefer SuSiE-inf over SuSiE:
Key thresholds / parameters:
--coverage)--max-signals)purity argument, so it prunes at fit time as well as flagging downstreammin_tol)--prior-variance is a seed, not a fixed prior, under SuSiE. The model will want to treat w as it does for ABF (a fixed Wakefield prior). Do not. sushie seeds its effect_var with w and then re-estimates it by EM every iteration, so two runs with different w usually converge to the same fit. Only ABF honours w exactly.mu/mu2 from run_susie are not susieR z-unit moments. The model will want to sanity-check mu against the single-effect shrinkage formula r · z with r = w/(w + 1/n). Do not. sushie reports conditional posterior moments on its standardised effect-size scale; on a z=[5,5,0], n=100 locus susieR-style mu is 4.0 while sushie's post_mean is ~0.2. Same quantity, different units — compare shapes and ordering, not magnitudes.alpha, mu and mu2 contain only the signals sushie kept as credible sets at the requested coverage and min_purity. A null locus, or a locus whose only signal is spread over uncorrelated variants (purity 0), returns arrays with zero rows and all-zero PIPs. Do not index alpha[0] without checking alpha.shape[0] first.max_iter emits a RuntimeWarning and sets converged: False, mirroring susieR::susie_rss; finite PIPs are still returned. The model will want to report those PIPs as results. Do not — surface converged in the report and say the estimate is provisional.coverage and min_purity must lie strictly inside (0, 1). sushie rejects the endpoints, so --coverage 1.0 or --min-purity 0 raise a ValueError before any data is loaded. The old pure-Python engine accepted them, and ABF still does; only the SuSiE path is this strict, so scripts that passed 1.0 need updating.--max-signals above the variant count is clamped, not honoured. sushie refuses a fit whose internal min_snps guard sits below L, so a 9-variant locus under the default --max-signals 10 would otherwise be a hard error where the old engine simply ran. run_susie clamps L to the number of variants and emits a RuntimeWarning. The model will want to read the clamp as data loss. It is not — a locus of p variants cannot support more than p distinct single effects.tausq in its result is above 0. run_susie_inf estimates τ² only when called with est_tausq=True; by default τ² stays at its starting value of 0 and the fit is SuSiE with this module's prior and null weight. The model will want to describe any run_susie_inf output as "adjusted for polygenic background". Do not: read tausq first. And do not dismiss a small value as noise. On per-SNP scale a real estimate is of order 1e-5 to 1e-4, and it is multiplied by n times the LD eigenvalues, so on a 200-variant diffuse locus τ² = 5.5e-5 moves an outlier's PIP from 0.154 to 0.022.output_directory/
├── report.md # Primary markdown report
├── fine_mapping.json # Machine-readable PIPs + credible sets
├── result.json # Standard ClawBio result envelope
├── figures/
│ ├── pip_locus_plot.png # Per-variant PIP coloured by LD r²
│ ├── regional_association.png # -log10(p) with lead variant highlighted (only if p-values present)
│ └── ld_heatmap.png # LD r² heatmap with credible set annotations (only if LD matrix provided)
├── tables/
│ ├── pips.tsv # rsid, chr, pos, pip, cs_membership
│ └── credible_sets.tsv # cs_id, size, coverage, lead_rsid, variants (only if a credible set is found)
└── reproducibility/
├── commands.sh # Portable command that replays this run ($CLAWBIO_ROOT, $OUTPUT_DIR)
├── environment.yml # Conda env with version bounds (sushie added on the SuSiE path)
└── checksums.sha256 # sha256 of this run's outputs; verify with `cd <output_dir> && sha256sum -c reproducibility/checksums.sha256`
Required:
numpy >= 1.24 — array maths, LD matrix operationsscipy >= 1.10 — statistical functionspandas >= 1.5 — sumstats parsingmatplotlib >= 3.7 — locus plotsSuSiE engine (ABF works without it):
sushie >= 0.20, < 0.21 — SuSiE inference (pulls jax, jaxlib, equinox, polars, glimix-core); install with uv sync --extra fine-mapping and run via uv run --extra fine-mapping python ...reproducibility/commands.sh logs exact inputs and parametersTrigger conditions — the orchestrator routes here when:
beta/z + se (looks like GWAS summary stats)Chaining partners — this skill connects with:
gwas-lookup: look up the lead variant before fine-mapping to confirm locus contextgwas-prs: fine-mapped causal variants can be used as a more precise PRS variant setvcf-annotator: annotate the credible set variants with functional consequencesfine_mapping.py (opens in a new tab)fine_mapping_core/__init__.py (opens in a new tab)fine_mapping_core/abf.py (opens in a new tab)fine_mapping_core/credible_sets.py (opens in a new tab)fine_mapping_core/io.py (opens in a new tab)fine_mapping_core/report.py (opens in a new tab)fine_mapping_core/susie.py (opens in a new tab)fine_mapping_core/susie_inf.py (opens in a new tab)tests/fixtures/demo_susie_known_answer.json (opens in a new tab)tests/test_fine_mapping.py (opens in a new tab)tests/test_repro_bundle.py (opens in a new tab)tests/test_susie_inf_tausq.py (opens in a new tab)core/__init__.py (opens in a new tab)core/abf.py (opens in a new tab)core/credible_sets.py (opens in a new tab)core/io.py (opens in a new tab)core/report.py (opens in a new tab)core/susie.py (opens in a new tab)core/susie_inf.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
gwas, fine-mapping, susie, credible-sets, pip, causal-variants, statistical-genetics
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