Skip to content
Data
Skill

/mendelian-randomisation

30 synthetic BMI->T2D instruments for offline demo

From plugin
clawbio
1.2k112 skills4 commands

Claude Code

$ npx -y skills add ClawBio/ClawBio --skill mendelian-randomisation --agent claude-code

SKILL.md

mendelian-randomisation.SKILL.md
name: mendelian-randomisation
description: Two-sample Mendelian Randomisation from GWAS summary statistics with IVW, MR-Egger, weighted median/mode, and
  full sensitivity analysis (Cochran Q, Egger intercept, Steiger, F-statistic, leave-one-out).
license: MIT
metadata:
  version: 0.1.0
  author: Reza
  domain: genetic-epidemiology
  tags:
  - mendelian-randomisation
  - causal-inference
  - two-sample-mr
  - ivw
  - mr-egger
  - gwas
  - genetic-epidemiology
  - drug-target-validation
  inputs:
  - name: instruments
    type: file
    format:
    - json
    description: Harmonised instrument JSON with exposure/outcome effect sizes
    required: true
  outputs:
  - name: report
    type: file
    format: md
    description: STROBE-MR aligned interpretation report
  - name: result
    type: file
    format: json
    description: Machine-readable MR estimates and sensitivity results
  dependencies:
    python: '>=3.10'
    packages:
    - numpy>=1.24
    - scipy>=1.10
    - matplotlib>=3.7
  demo_data:
  - path: example_data/demo_instruments.json
    description: 30 synthetic BMI->T2D instruments for offline demo
  endpoints:
    cli: python skills/mendelian-randomisation/mendelian_randomisation.py --instruments {input_file} --output {output_dir}
  openclaw:
    requires:
      bins:
      - python3
    always: false
    emoji: ๐Ÿซ›
    homepage: https://github.com/ClawBio/ClawBio
    os:
    - darwin
    - linux
    install:
    - kind: pip
      package: numpy
    - kind: pip
      package: scipy
    - kind: pip
      package: matplotlib
    trigger_keywords:
    - mendelian randomisation
    - mendelian randomization
    - MR analysis
    - two-sample MR
    - causal inference genetics
    - IVW
    - MR-Egger
    - instrumental variable
    - drug target validation MR
    - GWAS causal

๐Ÿงฌ Mendelian Randomisation

You are **Mendelian Randomisation**, a specialised ClawBio agent for causal inference from GWAS summary statistics. Your role is to run two-sample MR with multiple estimators and a complete sensitivity analysis panel.

Trigger

**Fire this skill when the user says any of:**

  • "Run mendelian randomisation on these GWAS results"
  • "Is there a causal effect of X on Y?"
  • "Two-sample MR analysis"
  • "MR-Egger / IVW / weighted median"
  • "Causal inference from GWAS summary statistics"
  • "Drug target validation with genetic instruments"
  • "MR sensitivity analysis"

**Do NOT fire when:**

  • User wants a GWAS association study (route to `gwas-pipeline`)
  • User wants to look up a single variant (route to `gwas-lookup`)
  • User wants polygenic risk scores (route to `gwas-prs`)
  • User wants colocalization analysis (different method, different skill)

Why This Exists

  • **Without it**: Running best-practice MR requires hundreds of lines of R code across TwoSampleMR, MendelianRandomization, and MR-PRESSO packages, with manual orchestration of instrument selection, harmonisation, four+ estimators, and six+ sensitivity tests
  • **With it**: A single command produces all estimators, the full sensitivity battery, four publication-ready plots, and a STROBE-MR aligned report
  • **Why ClawBio**: Grounded in Burgess et al. (2013), Bowden et al. (2015/2016), Verbanck et al. (2018) โ€” every threshold and method traces to a published paper, not ad hoc parameter choices

Core Capabilities

1. **Four MR estimators**: IVW (random effects), MR-Egger, weighted median, weighted mode 2. **Full sensitivity battery**: Cochran's Q, Egger intercept, Steiger directionality, F-statistic, Iยฒ_GX, leave-one-out 3. **Instrument diagnostics**: F-statistic per SNP (warning when F < 10), palindromic SNP flagging, weak instrument detection 4. **Publication plots**: Scatter, forest, funnel, leave-one-out (four .png files) 5. **STROBE-MR report**: Assumptions stated, all methods and sensitivity results tabulated, caveats explicit

Scope

**One skill, one task.** This skill performs two-sample MR from pre-harmonised or raw GWAS summary statistics and produces causal effect estimates with sensitivity diagnostics. It does not perform GWAS, LD score regression, colocalization, or multi-trait analysis.

Input Formats

| Format | Extension | Required Fields | Example | |--------|-----------|-----------------|---------| | Harmonised instruments JSON | `.json` | SNP, effect_allele, other_allele, eaf, beta_exposure, se_exposure, pval_exposure, beta_outcome, se_outcome, pval_outcome; optional `n_exposure` / `n_outcome` (sample sizes, needed for a Steiger p-value) | `demo_instruments.json` |

Workflow

1. **Load**: Read harmonised instruments from JSON (or from IEU OpenGWAS in live mode) 2. **Validate**: Check F-statistics, flag weak instruments (F < 10), flag palindromic SNPs with ambiguous EAF 3. **Estimate**: Run IVW, MR-Egger, weighted median, weighted mode 4. **Sensitivity**: Cochran's Q, Egger intercept, Steiger test, Iยฒ_GX, leave-one-out 5. **Visualise**: Scatter, forest, funnel, leave-one-out plots 6. **Report**: STROBE-MR aligned markdown with all results, warnings, and disclaimer

CLI Reference

# Demo mode (cached BMI->T2D, completely offline)
python skills/mendelian-randomisation/mendelian_randomisation.py \
  --demo --output /tmp/mr_demo

# User-provided instruments
python skills/mendelian-randomisation/mendelian_randomisation.py \
  --instruments instruments.json --output results/

# Via ClawBio runner
python clawbio.py run mr --demo

Demo

python clawbio.py run mr --demo

Expected output: A full MR report for 30 synthetic BMI โ†’ T2D instruments showing a positive causal effect (IVW beta โ‰ˆ 0.60), consistent across all four methods, with no heterogeneity, no pleiotropy, strong instruments, and correct Steiger direction. Four plots generated.

Algorithm / Methodology

1. **IVW**: beta = sum(w * bx * by) / sum(w * bxยฒ), with multiplicative random-effects variance inflation (Burgess et al., 2013) 2. **MR-Egger**: Weighted linear regression of by on bx with intercept; slope

Read more
@clawbio
Ships withclawbio

๐Ÿฆ– ClawBio - The first bioinformatics-native AI agent skill library. Local-first. Reproducible. Open. Free.

1.2k112 skills
Get the whole plugin

Stars on GitHub

Momentum

stars in total
1.2k
Star history of ClawBio/ClawBio on GitHub, a chart by star-history.com

Other skills on clawbio.

affinity-proteomics

affinity-proteomics

Unified analysis pipeline for affinity-based proteomics platforms โ€” Olink (PEA, NPX) and SomaLogic SomaScan (SOMAmer,

@clawbio@clawbioInstall Skill
arrayexpress-fetch

arrayexpress-fetch

The study's MAGE-TAB SDRF, 6 samples, recorded verbatim. Drives the sdrf, metadata-table and samplesheet demo paths.

@clawbio@clawbioInstall Skill

More skills from other plugins.

paddleocr-doc-parsing

paddleocr-doc-parsing

Use this skill to extract structured Markdown/JSON from PDFs and document imagesโ€”tables with cell-level precision, formulas asโ€ฆ

@paddlepaddle@paddlepaddleInstall Skill
context-loader
Auto-invoked

context-loader

Search memories from earlier Pi sessions in this repository. Use it when earlier work may already explain the code, error,โ€ฆ

mem05d69k
@mem0ai@mem0aiInstall Skill
analyzing-ai-citations

analyzing-ai-citations

Answer AI citation and answer engine optimization (AEO) questions in PostHog: whether AI answer engines (ChatGPT, Claude, and anโ€ฆ

posthog12d41k
@posthog@posthogInstall Skill

Questions about mendelian-randomisation.

Which coding agents can use mendelian-randomisation?
mendelian-randomisation installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.