[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75MQWHMMPB60T769Z04VWBD":3,"skill-same:01M75MQWHMMPB60T769Z04VWBD":131},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":91,"commitSha":92,"skillDirectory":93,"forksCount":94,"repositoryHtmlUrl":95,"repositoryHomepageUrl":6,"ownerHtmlUrl":96,"ownerBlogUrl":97,"ownerDescription":6,"updatedAt":98,"install":99,"resources":111},"01M75MQWHMMPB60T769Z04VWBD","mendelian-randomisation",null,"Two-sample Mendelian Randomisation from GWAS summary statistics with IVW, MR-Egger, weighted median\u002Fmode, and full sensitivity analysis (Cochran Q, Egger intercept, Steiger, F-statistic, leave-one-out).","stanfish06\u002Fskillquarium","stanfish06","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F93099613?v=4","01M75F1CK4ZW109ZK3T26VN52F","Zhiyuan","01M75F1CM53VH6F79DZ8GXKKES",12,"MIT","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fmendelian-randomisation\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: mendelian-randomisation\ndescription: Two-sample Mendelian Randomisation from GWAS summary statistics with IVW, MR-Egger, weighted median\u002Fmode, and\n  full sensitivity analysis (Cochran Q, Egger intercept, Steiger, F-statistic, leave-one-out).\nlicense: MIT\nmetadata:\n  version: 0.1.0\n  author: Reza\n  domain: genetic-epidemiology\n  tags:\n  - mendelian-randomisation\n  - causal-inference\n  - two-sample-mr\n  - ivw\n  - mr-egger\n  - gwas\n  - genetic-epidemiology\n  - drug-target-validation\n  inputs:\n  - name: instruments\n    type: file\n    format:\n    - json\n    description: Harmonised instrument JSON with exposure\u002Foutcome effect sizes\n    required: true\n  outputs:\n  - name: report\n    type: file\n    format: md\n    description: STROBE-MR aligned interpretation report\n  - name: result\n    type: file\n    format: json\n    description: Machine-readable MR estimates and sensitivity results\n  dependencies:\n    python: '>=3.10'\n    packages:\n    - numpy>=1.24\n    - scipy>=1.10\n    - matplotlib>=3.7\n  demo_data:\n  - path: example_data\u002Fdemo_instruments.json\n    description: 30 synthetic BMI->T2D instruments for offline demo\n  endpoints:\n    cli: python skills\u002Fmendelian-randomisation\u002Fmendelian_randomisation.py --instruments {input_file} --output {output_dir}\n  openclaw:\n    requires:\n      bins:\n      - python3\n    always: false\n    emoji: 🫛\n    homepage: https:\u002F\u002Fgithub.com\u002FClawBio\u002FClawBio\n    os:\n    - darwin\n    - linux\n    install:\n    - kind: pip\n      package: numpy\n    - kind: pip\n      package: scipy\n    - kind: pip\n      package: matplotlib\n    trigger_keywords:\n    - mendelian randomisation\n    - mendelian randomization\n    - MR analysis\n    - two-sample MR\n    - causal inference genetics\n    - IVW\n    - MR-Egger\n    - instrumental variable\n    - drug target validation MR\n    - GWAS causal\n---\n\n# 🧬 Mendelian Randomisation\n\nYou 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.\n\n## Trigger\n\n**Fire this skill when the user says any of:**\n- \"Run mendelian randomisation on these GWAS results\"\n- \"Is there a causal effect of X on Y?\"\n- \"Two-sample MR analysis\"\n- \"MR-Egger \u002F IVW \u002F weighted median\"\n- \"Causal inference from GWAS summary statistics\"\n- \"Drug target validation with genetic instruments\"\n- \"MR sensitivity analysis\"\n\n**Do NOT fire when:**\n- User wants a GWAS association study (route to `gwas-pipeline`)\n- User wants to look up a single variant (route to `gwas-lookup`)\n- User wants polygenic risk scores (route to `gwas-prs`)\n- User wants colocalization analysis (different method, different skill)\n\n## Why This Exists\n\n- **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\n- **With it**: A single command produces all estimators, the full sensitivity battery, four publication-ready plots, and a STROBE-MR aligned report\n- **Why ClawBio**: Grounded in Burgess et al. (2013), Bowden et al. (2015\u002F2016), Verbanck et al. (2018) — every threshold and method traces to a published paper, not ad hoc parameter choices\n\n## Core Capabilities\n\n1. **Four MR estimators**: IVW (random effects), MR-Egger, weighted median, weighted mode\n2. **Full sensitivity battery**: Cochran's Q, Egger intercept, Steiger directionality (direction only — the correlated-correlations significance test needs exposure and outcome GWAS sample sizes, which the input contract does not carry), F-statistic, I²_GX, leave-one-out\n3. **Instrument diagnostics**: F-statistic per SNP (warning when F \u003C 10), palindromic SNP flagging, weak instrument detection\n4. **Publication plots**: Scatter, forest, funnel, leave-one-out (four .png files)\n5. **STROBE-MR report**: Assumptions stated, all methods and sensitivity results tabulated, caveats explicit\n\n## Scope\n\n**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.\n\n## Input Formats\n\n| Format | Extension | Required Fields | Example |\n|--------|-----------|-----------------|---------|\n| Harmonised instruments JSON | `.json` | SNP, effect_allele, other_allele, eaf, beta_exposure, se_exposure, pval_exposure, beta_outcome, se_outcome, pval_outcome | `demo_instruments.json` |\n\n## Workflow\n\n1. **Load**: Read harmonised instruments from JSON (or from IEU OpenGWAS in live mode)\n2. **Validate**: Check F-statistics, flag weak instruments (F \u003C 10), flag palindromic SNPs with ambiguous EAF\n3. **Estimate**: Run IVW, MR-Egger, weighted median, weighted mode\n4. **Sensitivity**: Cochran's Q, Egger intercept, Steiger test, I²_GX, leave-one-out\n5. **Visualise**: Scatter, forest, funnel, leave-one-out plots\n6. **Report**: STROBE-MR aligned markdown with all results, warnings, and disclaimer\n\n## CLI Reference\n\n```bash\n# Demo mode (cached BMI->T2D, completely offline)\npython skills\u002Fmendelian-randomisation\u002Fmendelian_randomisation.py \\\n  --demo --output \u002Ftmp\u002Fmr_demo\n\n# User-provided instruments\npython skills\u002Fmendelian-randomisation\u002Fmendelian_randomisation.py \\\n  --instruments instruments.json --output results\u002F\n\n# Via ClawBio runner\npython clawbio.py run mr --demo\n```\n\n## Demo\n\n```bash\npython clawbio.py run mr --demo\n```\n\nExpected 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 exposure → outcome Steiger direction. Four plots generated.\n\n## Algorithm \u002F Methodology\n\n1. **IVW**: beta = sum(w * bx * by) \u002F sum(w * bx²), with multiplicative random-effects variance inflation (Burgess et al., 2013)\n2. **MR-Egger**: Weighted linear regression of by on bx with intercept; slope = causal estimate, intercept = pleiotropy (Bowden et al., 2015)\n3. **Weighted Median**: Median of Wald ratios weighted by inverse-variance; consistent when ≥50% weight from valid instruments (Bowden et al., 2016)\n4. **Weighted Mode**: Kernel density mode of weighted Wald ratios (Hartwig et al., 2017), with the modified Silverman\u002FBickel bandwidth `0.9 * min(sd, mad) \u002F k^(1\u002F5)`. The mode SE has no closed form: it is the MAD over a 1000-draw parametric bootstrap of the ratio estimates, and the P-value is t on k-1 df, matching MRCIEU\u002FTwoSampleMR `R\u002Fmr_mode.R`. The mode is strictly less efficient than IVW, so its SE should always exceed the IVW SE.\n\n**Key thresholds**:\n- F-statistic > 10 for instrument strength (Staiger & Stock, 1997)\n- I²_GX > 0.9 for MR-Egger validity; SIMEX recommended below (Bowden et al., 2016)\n- Cochran's Q P \u003C 0.05 indicates heterogeneity\n- Egger intercept P \u003C 0.05 indicates directional pleiotropy\n\n## Example Output\n\n```markdown\n# Mendelian Randomisation Report\n\n**Exposure**: Body mass index (BMI)\n**Outcome**: Type 2 diabetes (T2D)\n**Instruments**: 30 SNPs\n\n## MR Estimates\n\n| Method | Estimate | SE | 95% CI | P-value |\n|--------|----------|----|--------|---------|\n| IVW | 0.5979 | 0.0369 | [0.5255, 0.6702] | 5.17e-59 |\n| MR-Egger | 0.5989 | 0.0391 | [0.5223, 0.6756] | 6.62e-53 |\n| Weighted Median | 0.6001 | 0.0469 | [0.5081, 0.6921] | 2.07e-37 |\n| Weighted Mode | 0.6032 | 0.0757 | [0.4548, 0.7516] | 8.68e-09 |\n\n## Sensitivity Analysis\n\n| Test | Result | Interpretation |\n|------|--------|----------------|\n| Cochran's Q | 0.73 (P=1.00) | No heterogeneity |\n| Egger intercept | 0.0001 (P=0.93) | No pleiotropy |\n| Mean F-statistic | 70.6 | Strong instruments |\n| Steiger direction | Exposure → Outcome | Direction only; no P-value |\n\n*ClawBio is a research tool. Not a medical device.*\n```\n\n## Output Structure\n\n```\noutput_directory\u002F\n├── report.md                              # STROBE-MR aligned report\n├── result.json                            # Machine-readable estimates + sensitivity\n├── tables\u002F\n│   ├── mr_results.tsv                     # Per-method estimates\n│   ├── sensitivity.tsv                    # All sensitivity test results\n│   └── harmonised_instruments.tsv         # Per-SNP instrument details + F-stat\n├── figures\u002F\n│   ├── scatter.png                        # Exposure vs outcome effects\n│   ├── forest.png                         # Per-SNP Wald ratios\n│   ├── funnel.png                         # Precision vs effect\n│   └── leave_one_out.png                  # IVW after removing each SNP\n└── reproducibility\u002F\n    ├── commands.sh\n    └── software_versions.json\n```\n\n## Dependencies\n\n**Required**:\n- `numpy` >= 1.24 — numerical computation\n- `scipy` >= 1.10 — statistical tests (t-test, chi2, norm)\n- `matplotlib` >= 3.7 — scatter, forest, funnel, leave-one-out plots\n\n## Gotchas\n\n- **Palindromic SNPs**: You will want to silently resolve A\u002FT and C\u002FG SNPs using the EAF threshold of 0.42. Do not. When EAF is between 0.42 and 0.58, the correct strand is ambiguous. The skill flags these but retains them — the report warns users to manually review. Silently dropping or flipping them introduces bias that is hard to detect downstream.\n\n- **Weak instruments**: You will want to report F \u003C 10 as a table entry and move on. Do not. Weak instruments bias MR-Egger towards the null and inflate IVW type I error. The skill prints a stderr WARNING for every instrument with F \u003C 10 and highlights it in the report narrative, not just the sensitivity table. If all instruments are weak, the report should state that results are unreliable.\n\n- **Winner's curse**: You will want to select instruments from the same GWAS used as the exposure dataset. Do not, when possible. Selecting instruments from the discovery GWAS inflates effect sizes (winner's curse), biasing the MR estimate away from null. The skill documents this caveat in the report. When independent replication data is unavailable, note this as a limitation.\n\n- **Ignoring MR-Egger intercept**: You will want to report a significant Egger intercept alongside a significant IVW and claim \"robust causal evidence.\" Do not. A significant intercept means directional pleiotropy is present. If Egger intercept P \u003C 0.05, the IVW estimate is biased and the Egger slope should be preferred. The report narrative reads `egger_intercept_pvalue`, `cochran_q_pvalue` and the weak-instrument count directly, so it flags this rather than inferring agreement from point estimates — a pleiotropy-inflated IVW SE widens any across-method tolerance enough to hide the gap.\n\n## Safety\n\n- **Local-first**: Demo mode is fully offline with cached data. Live mode contacts IEU OpenGWAS API (public, unauthenticated) for summary statistics only — no patient data uploaded\n- **Network dependency**: Live mode requires `gwas-api.mrcieu.ac.uk`. Demo mode requires no network access\n- **Disclaimer**: Every report includes the ClawBio medical disclaimer\n- **No hallucinated science**: All thresholds trace to cited publications\n- **Audit trail**: Full command log and software versions in reproducibility bundle\n\n## Agent Boundary\n\nThe agent dispatches and explains. The skill (Python) executes. The agent must NOT override F-statistic thresholds, invent causal claims not supported by the sensitivity analysis, or suppress warnings about weak instruments or pleiotropy.\n\n## Integration with Bio Orchestrator\n\n**Trigger conditions** — the orchestrator routes here when:\n- User mentions Mendelian randomisation, causal inference from GWAS, or two-sample MR\n- User provides GWAS summary statistics and asks about causal effects\n\n**Chaining partners**:\n- `gwas-pipeline` (upstream): Produces GWAS summary statistics (TSV with SNP, beta, se, pval, eaf) that feed into this skill as exposure or outcome data\n- `gwas-lookup` (upstream): Provides variant-level context for instruments (trait associations, eQTLs)\n- `gwas-prs` (parallel): PRS and MR are complementary — PRS predicts individual risk, MR estimates population-level causal effects\n\n**Chaining contract**:\n- **Input**: JSON with `instruments` array; each instrument has `SNP`, `beta_exposure`, `se_exposure`, `pval_exposure`, `beta_outcome`, `se_outcome`, `pval_outcome`, `effect_allele`, `other_allele`, `eaf`, `f_statistic`\n- **Output**: `result.json` with `estimates` array (method, estimate, se, pvalue) and `sensitivity` object; `tables\u002Fmr_results.tsv` for downstream consumption\n\n## Maintenance\n\n- **Review cadence**: Re-evaluate when new MR methods are published or IEU OpenGWAS API changes\n- **Staleness signals**: New MR-PRESSO version, changes to STROBE-MR checklist, IEU API deprecation\n- **Deprecation**: If superseded by a more comprehensive causal inference skill\n\n## Citations\n\n- [Burgess et al. (2013)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F23569189\u002F) — IVW method. *Genet Epidemiol* 37:658–665\n- [Bowden et al. (2015)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F26050253\u002F) — MR-Egger. *Int J Epidemiol* 44:512–525\n- [Bowden et al. (2016)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F26892547\u002F) — Weighted median. *Genet Epidemiol* 40:304–314\n- [Hartwig et al. (2017)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F29040600\u002F) — Weighted mode. *Int J Epidemiol* 46:1985–1998\n- [Verbanck et al. (2018)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F29686387\u002F) — MR-PRESSO. *Nature Genetics* 50:693–698\n- [Hemani et al. (2017)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F28877894\u002F) — Steiger test. *PLOS Genetics* 13:e1007081\n- [Skrivankova et al. (2021)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F34698778\u002F) — STROBE-MR. *BMJ* 375:n2233\n- [Staiger & Stock (1997)](https:\u002F\u002Fdoi.org\u002F10.2307\u002F2171753) — Weak instruments. *Econometrica* 65:557–586\n","# 🧬 Mendelian Randomisation\n\nYou 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.\n\n## Trigger\n\n**Fire this skill when the user says any of:**\n- \"Run mendelian randomisation on these GWAS results\"\n- \"Is there a causal effect of X on Y?\"\n- \"Two-sample MR analysis\"\n- \"MR-Egger \u002F IVW \u002F weighted median\"\n- \"Causal inference from GWAS summary statistics\"\n- \"Drug target validation with genetic instruments\"\n- \"MR sensitivity analysis\"\n\n**Do NOT fire when:**\n- User wants a GWAS association study (route to `gwas-pipeline`)\n- User wants to look up a single variant (route to `gwas-lookup`)\n- User wants polygenic risk scores (route to `gwas-prs`)\n- User wants colocalization analysis (different method, different skill)\n\n## Why This Exists\n\n- **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\n- **With it**: A single command produces all estimators, the full sensitivity battery, four publication-ready plots, and a STROBE-MR aligned report\n- **Why ClawBio**: Grounded in Burgess et al. (2013), Bowden et al. (2015\u002F2016), Verbanck et al. (2018) — every threshold and method traces to a published paper, not ad hoc parameter choices\n\n## Core Capabilities\n\n1. **Four MR estimators**: IVW (random effects), MR-Egger, weighted median, weighted mode\n2. **Full sensitivity battery**: Cochran's Q, Egger intercept, Steiger directionality (direction only — the correlated-correlations significance test needs exposure and outcome GWAS sample sizes, which the input contract does not carry), F-statistic, I²_GX, leave-one-out\n3. **Instrument diagnostics**: F-statistic per SNP (warning when F \u003C 10), palindromic SNP flagging, weak instrument detection\n4. **Publication plots**: Scatter, forest, funnel, leave-one-out (four .png files)\n5. **STROBE-MR report**: Assumptions stated, all methods and sensitivity results tabulated, caveats explicit\n\n## Scope\n\n**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.\n\n## Input Formats\n\n| Format | Extension | Required Fields | Example |\n|--------|-----------|-----------------|---------|\n| Harmonised instruments JSON | `.json` | SNP, effect_allele, other_allele, eaf, beta_exposure, se_exposure, pval_exposure, beta_outcome, se_outcome, pval_outcome | `demo_instruments.json` |\n\n## Workflow\n\n1. **Load**: Read harmonised instruments from JSON (or from IEU OpenGWAS in live mode)\n2. **Validate**: Check F-statistics, flag weak instruments (F \u003C 10), flag palindromic SNPs with ambiguous EAF\n3. **Estimate**: Run IVW, MR-Egger, weighted median, weighted mode\n4. **Sensitivity**: Cochran's Q, Egger intercept, Steiger test, I²_GX, leave-one-out\n5. **Visualise**: Scatter, forest, funnel, leave-one-out plots\n6. **Report**: STROBE-MR aligned markdown with all results, warnings, and disclaimer\n\n## CLI Reference\n\n```bash\n# Demo mode (cached BMI->T2D, completely offline)\npython skills\u002Fmendelian-randomisation\u002Fmendelian_randomisation.py \\\n  --demo --output \u002Ftmp\u002Fmr_demo\n\n# User-provided instruments\npython skills\u002Fmendelian-randomisation\u002Fmendelian_randomisation.py \\\n  --instruments instruments.json --output results\u002F\n\n# Via ClawBio runner\npython clawbio.py run mr --demo\n```\n\n## Demo\n\n```bash\npython clawbio.py run mr --demo\n```\n\nExpected 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 exposure → outcome Steiger direction. Four plots generated.\n\n## Algorithm \u002F Methodology\n\n1. **IVW**: beta = sum(w * bx * by) \u002F sum(w * bx²), with multiplicative random-effects variance inflation (Burgess et al., 2013)\n2. **MR-Egger**: Weighted linear regression of by on bx with intercept; slope = causal estimate, intercept = pleiotropy (Bowden et al., 2015)\n3. **Weighted Median**: Median of Wald ratios weighted by inverse-variance; consistent when ≥50% weight from valid instruments (Bowden et al., 2016)\n4. **Weighted Mode**: Kernel density mode of weighted Wald ratios (Hartwig et al., 2017), with the modified Silverman\u002FBickel bandwidth `0.9 * min(sd, mad) \u002F k^(1\u002F5)`. The mode SE has no closed form: it is the MAD over a 1000-draw parametric bootstrap of the ratio estimates, and the P-value is t on k-1 df, matching MRCIEU\u002FTwoSampleMR `R\u002Fmr_mode.R`. The mode is strictly less efficient than IVW, so its SE should always exceed the IVW SE.\n\n**Key thresholds**:\n- F-statistic > 10 for instrument strength (Staiger & Stock, 1997)\n- I²_GX > 0.9 for MR-Egger validity; SIMEX recommended below (Bowden et al., 2016)\n- Cochran's Q P \u003C 0.05 indicates heterogeneity\n- Egger intercept P \u003C 0.05 indicates directional pleiotropy\n\n## Example Output\n\n```markdown\n# Mendelian Randomisation Report\n\n**Exposure**: Body mass index (BMI)\n**Outcome**: Type 2 diabetes (T2D)\n**Instruments**: 30 SNPs\n\n## MR Estimates\n\n| Method | Estimate | SE | 95% CI | P-value |\n|--------|----------|----|--------|---------|\n| IVW | 0.5979 | 0.0369 | [0.5255, 0.6702] | 5.17e-59 |\n| MR-Egger | 0.5989 | 0.0391 | [0.5223, 0.6756] | 6.62e-53 |\n| Weighted Median | 0.6001 | 0.0469 | [0.5081, 0.6921] | 2.07e-37 |\n| Weighted Mode | 0.6032 | 0.0757 | [0.4548, 0.7516] | 8.68e-09 |\n\n## Sensitivity Analysis\n\n| Test | Result | Interpretation |\n|------|--------|----------------|\n| Cochran's Q | 0.73 (P=1.00) | No heterogeneity |\n| Egger intercept | 0.0001 (P=0.93) | No pleiotropy |\n| Mean F-statistic | 70.6 | Strong instruments |\n| Steiger direction | Exposure → Outcome | Direction only; no P-value |\n\n*ClawBio is a research tool. Not a medical device.*\n```\n\n## Output Structure\n\n```\noutput_directory\u002F\n├── report.md                              # STROBE-MR aligned report\n├── result.json                            # Machine-readable estimates + sensitivity\n├── tables\u002F\n│   ├── mr_results.tsv                     # Per-method estimates\n│   ├── sensitivity.tsv                    # All sensitivity test results\n│   └── harmonised_instruments.tsv         # Per-SNP instrument details + F-stat\n├── figures\u002F\n│   ├── scatter.png                        # Exposure vs outcome effects\n│   ├── forest.png                         # Per-SNP Wald ratios\n│   ├── funnel.png                         # Precision vs effect\n│   └── leave_one_out.png                  # IVW after removing each SNP\n└── reproducibility\u002F\n    ├── commands.sh\n    └── software_versions.json\n```\n\n## Dependencies\n\n**Required**:\n- `numpy` >= 1.24 — numerical computation\n- `scipy` >= 1.10 — statistical tests (t-test, chi2, norm)\n- `matplotlib` >= 3.7 — scatter, forest, funnel, leave-one-out plots\n\n## Gotchas\n\n- **Palindromic SNPs**: You will want to silently resolve A\u002FT and C\u002FG SNPs using the EAF threshold of 0.42. Do not. When EAF is between 0.42 and 0.58, the correct strand is ambiguous. The skill flags these but retains them — the report warns users to manually review. Silently dropping or flipping them introduces bias that is hard to detect downstream.\n\n- **Weak instruments**: You will want to report F \u003C 10 as a table entry and move on. Do not. Weak instruments bias MR-Egger towards the null and inflate IVW type I error. The skill prints a stderr WARNING for every instrument with F \u003C 10 and highlights it in the report narrative, not just the sensitivity table. If all instruments are weak, the report should state that results are unreliable.\n\n- **Winner's curse**: You will want to select instruments from the same GWAS used as the exposure dataset. Do not, when possible. Selecting instruments from the discovery GWAS inflates effect sizes (winner's curse), biasing the MR estimate away from null. The skill documents this caveat in the report. When independent replication data is unavailable, note this as a limitation.\n\n- **Ignoring MR-Egger intercept**: You will want to report a significant Egger intercept alongside a significant IVW and claim \"robust causal evidence.\" Do not. A significant intercept means directional pleiotropy is present. If Egger intercept P \u003C 0.05, the IVW estimate is biased and the Egger slope should be preferred. The report narrative reads `egger_intercept_pvalue`, `cochran_q_pvalue` and the weak-instrument count directly, so it flags this rather than inferring agreement from point estimates — a pleiotropy-inflated IVW SE widens any across-method tolerance enough to hide the gap.\n\n## Safety\n\n- **Local-first**: Demo mode is fully offline with cached data. Live mode contacts IEU OpenGWAS API (public, unauthenticated) for summary statistics only — no patient data uploaded\n- **Network dependency**: Live mode requires `gwas-api.mrcieu.ac.uk`. Demo mode requires no network access\n- **Disclaimer**: Every report includes the ClawBio medical disclaimer\n- **No hallucinated science**: All thresholds trace to cited publications\n- **Audit trail**: Full command log and software versions in reproducibility bundle\n\n## Agent Boundary\n\nThe agent dispatches and explains. The skill (Python) executes. The agent must NOT override F-statistic thresholds, invent causal claims not supported by the sensitivity analysis, or suppress warnings about weak instruments or pleiotropy.\n\n## Integration with Bio Orchestrator\n\n**Trigger conditions** — the orchestrator routes here when:\n- User mentions Mendelian randomisation, causal inference from GWAS, or two-sample MR\n- User provides GWAS summary statistics and asks about causal effects\n\n**Chaining partners**:\n- `gwas-pipeline` (upstream): Produces GWAS summary statistics (TSV with SNP, beta, se, pval, eaf) that feed into this skill as exposure or outcome data\n- `gwas-lookup` (upstream): Provides variant-level context for instruments (trait associations, eQTLs)\n- `gwas-prs` (parallel): PRS and MR are complementary — PRS predicts individual risk, MR estimates population-level causal effects\n\n**Chaining contract**:\n- **Input**: JSON with `instruments` array; each instrument has `SNP`, `beta_exposure`, `se_exposure`, `pval_exposure`, `beta_outcome`, `se_outcome`, `pval_outcome`, `effect_allele`, `other_allele`, `eaf`, `f_statistic`\n- **Output**: `result.json` with `estimates` array (method, estimate, se, pvalue) and `sensitivity` object; `tables\u002Fmr_results.tsv` for downstream consumption\n\n## Maintenance\n\n- **Review cadence**: Re-evaluate when new MR methods are published or IEU OpenGWAS API changes\n- **Staleness signals**: New MR-PRESSO version, changes to STROBE-MR checklist, IEU API deprecation\n- **Deprecation**: If superseded by a more comprehensive causal inference skill\n\n## Citations\n\n- [Burgess et al. (2013)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F23569189\u002F) — IVW method. *Genet Epidemiol* 37:658–665\n- [Bowden et al. (2015)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F26050253\u002F) — MR-Egger. *Int J Epidemiol* 44:512–525\n- [Bowden et al. (2016)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F26892547\u002F) — Weighted median. *Genet Epidemiol* 40:304–314\n- [Hartwig et al. (2017)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F29040600\u002F) — Weighted mode. *Int J Epidemiol* 46:1985–1998\n- [Verbanck et al. (2018)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F29686387\u002F) — MR-PRESSO. *Nature Genetics* 50:693–698\n- [Hemani et al. (2017)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F28877894\u002F) — Steiger test. *PLOS Genetics* 13:e1007081\n- [Skrivankova et al. (2021)](https:\u002F\u002Fpubmed.ncbi.nlm.nih.gov\u002F34698778\u002F) — STROBE-MR. *BMJ* 375:n2233\n- [Staiger & Stock (1997)](https:\u002F\u002Fdoi.org\u002F10.2307\u002F2171753) — Weak instruments. *Econometrica* 65:557–586\n",{"name":5,"license":15,"metadata":24,"description":7},{"tags":25,"author":33,"domain":31,"inputs":34,"outputs":42,"version":50,"openclaw":51,"demo_data":79,"endpoints":83,"dependencies":85},[5,26,27,28,29,30,31,32],"causal-inference","two-sample-mr","ivw","mr-egger","gwas","genetic-epidemiology","drug-target-validation","Reza",[35],{"name":36,"type":37,"format":38,"required":40,"description":41},"instruments","file",[39],"json",true,"Harmonised instrument JSON with exposure\u002Foutcome effect sizes",[43,47],{"name":44,"type":37,"format":45,"description":46},"report","md","STROBE-MR aligned interpretation report",{"name":48,"type":37,"format":39,"description":49},"result","Machine-readable MR estimates and sensitivity results","0.1.0",{"os":52,"emoji":55,"always":20,"install":56,"homepage":64,"requires":65,"trigger_keywords":68},[53,54],"darwin","linux","🫛",[57,60,62],{"kind":58,"package":59},"pip","numpy",{"kind":58,"package":61},"scipy",{"kind":58,"package":63},"matplotlib","https:\u002F\u002Fgithub.com\u002FClawBio\u002FClawBio",{"bins":66},[67],"python3",[69,70,71,72,73,74,75,76,77,78],"mendelian randomisation","mendelian randomization","MR analysis","two-sample MR","causal inference genetics","IVW","MR-Egger","instrumental variable","drug target validation MR","GWAS causal",[80],{"path":81,"description":82},"example_data\u002Fdemo_instruments.json","30 synthetic BMI->T2D instruments for offline demo",{"cli":84},"python skills\u002Fmendelian-randomisation\u002Fmendelian_randomisation.py --instruments {input_file} --output {output_dir}",{"python":86,"packages":87},">=3.10",[88,89,90],"numpy>=1.24","scipy>=1.10","matplotlib>=3.7","master","49e49abf2f670d429e0b7e2c0349739c3fdd5cbe","skills\u002Fmendelian-randomisation",5,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium","https:\u002F\u002Fgithub.com\u002Fstanfish06","https:\u002F\u002Fwww.stanfish.dev\u002F","2026-11-14 21:31:37",{"source":8,"skillName":5,"commands":100,"prompt":110,"zipAvailable":40},[101,104,107],{"tool":102,"command":103},"npx","npx skills add stanfish06\u002Fskillquarium --skill mendelian-randomisation",{"tool":105,"command":106},"bunx","bunx skills add stanfish06\u002Fskillquarium --skill mendelian-randomisation",{"tool":108,"command":109},"pnpm","pnpm dlx skills add stanfish06\u002Fskillquarium --skill mendelian-randomisation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fmendelian-randomisation\u002FSKILL.md",[112,117,123,127],{"path":81,"resourceType":113,"resourceTypeDesc":114,"sizeBytes":115,"sourceHtmlUrl":116},"REFERENCE","参考文档",11835,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fmendelian-randomisation\u002Fexample_data\u002Fdemo_instruments.json",{"path":118,"resourceType":119,"resourceTypeDesc":120,"sizeBytes":121,"sourceHtmlUrl":122},"mendelian_randomisation.py","SCRIPT","脚本",31879,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fmendelian-randomisation\u002Fmendelian_randomisation.py",{"path":124,"resourceType":119,"resourceTypeDesc":120,"sizeBytes":125,"sourceHtmlUrl":126},"tests\u002F__init__.py",32,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fmendelian-randomisation\u002Ftests\u002F__init__.py",{"path":128,"resourceType":119,"resourceTypeDesc":120,"sizeBytes":129,"sourceHtmlUrl":130},"tests\u002Ftest_mendelian_randomisation.py",8221,"https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fmendelian-randomisation\u002Ftests\u002Ftest_mendelian_randomisation.py",[132,139,148,155,162,169],{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":138,"publishedAt":19},"01M76ZJTRVA456GD7K8Y3EP82H","zarr-python","Stores and queries chunked N-D scientific arrays with Zarr-Python 3, including codecs, sharding, S3\u002FGCS storage, and NumPy\u002FDask\u002FXarray integration. Use for array layout, bounded I\u002FO, format migration, or scientific metadata preservation.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":140,"name":141,"nameZh":6,"description":142,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":143,"licenseFileUrl":144,"sourceHtmlUrl":145,"categories":146,"keywords":147,"publishedAt":19},"01M76ZJQZ15Q1HKC5V85NHE325","yeet","Publish local changes to GitHub by confirming scope, committing intentionally, pushing the branch, and opening a draft PR through the GitHub app from this plugin, with `gh` used only as a fallback where connector coverage is insufficient.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":149,"name":150,"nameZh":6,"description":151,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":143,"licenseFileUrl":6,"sourceHtmlUrl":152,"categories":153,"keywords":154,"publishedAt":19},"01M76ZJ8ASZ4QYQ70Y6SBA4Z4S","xarray","N-dimensional labeled arrays and datasets in Python. Built on top of NumPy and Dask. It introduces labels in the form of dimensions, coordinates, and attributes on top of raw NumPy-like arrays, making data analysis in physical sciences more intuitive and less error-prone. Use for working with multi-dimensional scientific data, NetCDF\u002FGRIB\u002FZarr files, climate\u002Fweather\u002Foceanographic datasets, remote sensing, geospatial imaging, large out-of-memory datasets with Dask, and labeled array operations.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fxarray\u002FSKILL.md",[],[],{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":161,"publishedAt":19},"01M76ZHFBXD6VXPQ02VCEG202B","writing-mstest-tests","Use when asked to fix, rewrite, update, improve, modernize, show corrected code for, or explain existing MSTest tests or MSTest-specific configuration. Use for \"review\" when corrected code or edits are wanted, even for one pasted assertion or passing tests with bad failure output. Covers expected\u002Factual labels; generic Boolean, collection, string, numeric, null, identity, exception, hard-cast, and object[] checks; TestContext\u002Flifecycle; timeout\u002Fcancellation; OS\u002FCI conditions, retry, cleanup, parallelization, MSTest.Sdk project setup, and MSTESTxxxx. Honor the installed MSTest version. DO NOT USE to design new test cases (code-testing), perform report-only audits, create project files rather than explain MSTest setup, run tests, migrate frameworks, or handle non-MSTest\u002Fnon-.NET code.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwriting-mstest-tests\u002FSKILL.md",[],[],{"skillNo":163,"name":164,"nameZh":6,"description":165,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":166,"categories":167,"keywords":168,"publishedAt":19},"01M76ZDFDF4N88RH6HSYGS7GP2","wgs-prs","End-to-end WGS to polygenic risk score pipeline. Takes paired-end FASTQ files (or a pre-existing VCF) through nf-core\u002Fsarek for variant calling, applies VCF QC (normalisation, hard filtering, Ti\u002FTv and Het\u002FHom checks), then computes polygenic risk scores via the PGS Catalog. Fills the FASTQ to VCF gap upstream of the gwas-prs skill.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwgs-prs\u002FSKILL.md",[],[],{"skillNo":170,"name":171,"nameZh":6,"description":172,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":143,"licenseFileUrl":173,"sourceHtmlUrl":174,"categories":175,"keywords":176,"publishedAt":19},"01M76ZCC1SC68J42QK4MDC8RCG","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fstanfish06\u002Fskillquarium\u002Fblob\u002Fmaster\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[],[]]