
Mendelian Randomization
FreeAssess causal relationships using genetic data.
Free · Opens the source repo
What Mendelian Randomization does
Mendelian Randomization (MR) is a statistical method that uses genetic variants as instrumental variables to estimate the causal effects of an exposure on an outcome. This skill is particularly useful in epidemiology and genetics, where it helps determine whether a correlation between a risk factor and a disease is indeed causal or merely coincidental. By leveraging the random allocation of alleles at conception, MR mitigates confounding factors and reverse causation that often plague observational studies.
The skill integrates with resources like the IEU OpenGWAS and EpiGraphDB, providing access to a comprehensive database of pre-computed two-sample MR results. Users can query whether specific exposures, such as LDL cholesterol or BMI, causally affect outcomes like heart disease or diabetes. It also facilitates triangulation of evidence, allowing researchers to explore reverse causation and prioritize drug targets based on genetic causal support.
To effectively use this skill, users must follow a structured workflow. First, they should resolve trait labels accurately to ensure the correct genetic data is retrieved. Next, they can perform MR analyses to obtain causal effect estimates, which include important metrics like the direction and magnitude of the effect, as well as the quality of the instrumental variables. The skill emphasizes the importance of interpreting results cautiously, especially when considering the assumptions underlying MR, such as relevance, independence, and exclusion restriction.
This skill is aimed at researchers and professionals in the fields of genetics, epidemiology, and public health who are interested in understanding causal relationships in health and disease. It is a valuable tool for those looking to make informed decisions based on genetic evidence, particularly in the context of developing interventions or understanding disease mechanisms.
When to use it
Use this skill when investigating causal relationships between exposures and outcomes in health research, especially when genetic data is involved.
When not to use it
This skill is not suitable for simple GWAS association lookups or when you need to fit custom instruments from raw summary statistics.
What you can build with it
Assessing Causality for LDL Cholesterol
Determine if LDL cholesterol levels causally influence the risk of coronary heart disease using genetic evidence.
Investigating BMI and Depression
Explore whether BMI is a causal factor for depression or merely correlated, leveraging genetic data for insights.
Reverse Causation Checks
Conduct bidirectional MR to evaluate if a disease outcome might be influencing the exposure, enhancing causal understanding.
How to install Mendelian Randomization
View source1. Install with the skills CLI
npx skills add mims-harvard/tooluniverse/tooluniverse-mendelian-randomization --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by mims-harvardMendelian Randomization (Causal Inference from Genetic Instruments)
MR estimates the CAUSAL effect of an exposure on an outcome using genetic variants as instrumental variables. Because alleles are randomized at conception, MR is largely robust to the confounding and reverse causation that bias observational associations. It is not a free lunch: the causal claim rests on three assumptions, and violating them (especially horizontal pleiotropy) silently biases the estimate.
LOOK UP, DON'T GUESS: never assert a causal MR estimate from memory. Genetic-instrument results are updated as new GWAS are published — always retrieve current evidence with EpiGraphDB_get_mendelian_randomization. Do not invent beta/p-values.
Correlation ≠ causation, and genetic correlation ≠ causation. A high genetic correlation (rg) means two traits share heritability — it does NOT establish a causal direction. Only MR (with valid instruments) speaks to causality. Report them as different kinds of evidence.
The three instrumental-variable assumptions
| Assumption | Statement | How it fails | Check |
|---|---|---|---|
| Relevance | Instrument is robustly associated with the exposure | Weak instruments (low F-stat) → bias toward the confounded observational estimate | MOE score; instruments selected at GWAS significance |
| Independence | Instrument shares no common cause with the outcome | Population stratification, assortative mating | Ancestry-matched GWAS; report population |
| Exclusion restriction | Instrument affects the outcome ONLY through the exposure | Horizontal pleiotropy — the variant influences the outcome via another path | MR-Egger intercept ≈ 0; agreement across methods |
If you cannot speak to these, your causal claim is provisional. Say so.
When to use
- "Does [exposure] causally affect [outcome/disease]?" — the core MR question.
- Triangulating an observational/epidemiological association ("BMI correlates with depression — is it causal?").
- Reverse-causation checks (bidirectional MR: does the outcome cause the exposure instead?).
- Prioritising drug targets / risk factors with genetic causal support.
- Distinguishing a causal driver from a shared-etiology bystander (MR vs genetic correlation).
This skill wraps the IEU OpenGWAS / EpiGraphDB MR-EvE ("MR Everything-vs-Everything") resource: a large matrix of pre-computed two-sample MR results between GWAS traits. It does not run a bespoke two-sample MR from raw summary statistics with your own instrument set — see Limitations.
Anchor tools
| Tool | Purpose |
|---|---|
EpiGraphDB_search_opengwas | Resolve a free-text trait to exact OpenGWAS study IDs + labels (DO THIS FIRST) |
EpiGraphDB_get_mendelian_randomization | Pre-computed MR estimate(s) for an exposure→outcome trait pair (curated pairs; start here) |
OpenGWAS_get_mr_instruments | Custom two-sample MR: fetch the exposure's clumped instruments + their harmonized outcome effects for any GWAS pair (needs a free OPENGWAS_JWT). Use when the pair isn't in MR-EvE |
EpiGraphDB_get_genetic_correlations | rg between a trait and others (shared etiology, NOT causation). Sparse — see Step 4 caveat |
EpiGraphDB_get_drugs_for_trait | Drugs targeting genes associated with a risk-factor trait (causal-target follow-up) |
gwas_search_associations | GWAS Catalog associations, to inspect the instruments behind a trait |
Workflow
Step 1 — Resolve trait labels (avoid silent misses)
EpiGraphDB matches GWAS trait labels exactly and case-sensitively. Always resolve free text first:
EpiGraphDB_search_opengwas {"query": "coronary heart disease"}
# → returns ids like 'ieu-a-7' and the exact label 'Coronary heart disease'
Use the returned exact label (or a sentence-case form) in the MR call. The MR tool now retries sentence-case variants and returns a metadata.note when it falls back or finds nothing — read that note; an empty mr_results with a note means "labels didn't match", NOT "no causal effect".
Step 2 — Run MR (exposure → outcome)
EpiGraphDB_get_mendelian_randomization {
"exposure_trait": "LDL cholesterol",
"outcome_trait": "Coronary heart disease",
"pval_threshold": 1e-5
}
Each row carries beta (causal effect estimate), se, pval, method, moescore, and the exposure/outcome IDs.
Step 3 — Interpret (see tables below)
Direction, magnitude, instrument quality, and method agreement.
Step 4 — Triangulate
- Bidirectional MR (primary triangulation) — swap exposure and outcome to test reverse causation. A causal X→Y with no Y→X strengthens the claim; bidirectional signals suggest shared genetics or feedback. This is the reliable leg — lean on it.
- Multiple methods — prefer pairs where IVW and a pleiotropy-robust method (MR-Egger, weighted median) agree in sign and significance.
- Genetic correlation (secondary, often empty) —
EpiGraphDB_get_genetic_correlationson the exposure. ⚠️ The/genetic-corgraph is sparse: it stores only strong edges (|rg| > 0.8), matches exact, case-sensitive labels distinct from OpenGWAS search labels, and ignores thepval_thresholdargument. Common traits (e.g. 'Body mass index') return empty — that is a graph gap, not "no shared genetics." Readmetadata.note; if empty, do NOT conclude absence — fall back to bidirectional MR. When it does return, highrg+ significant MR = causal; highrg+ null MR = shared etiology without a detectable causal path.
Step 5 — Actionable follow-up (optional)
EpiGraphDB_get_drugs_for_trait surfaces drugs whose target genes drive a causal risk factor — a genetics-anchored repurposing hypothesis.
Interpretation tables
Causal effect (beta)
| Observation | Meaning |
|---|---|
beta > 0, pval significant | Higher exposure causally increases the outcome (on the GWAS scale — often log-odds for a binary outcome) |
beta < 0, pval significant | Higher exposure causally decreases the outcome |
pval not significant | No detectable causal effect at the available instrument strength — absence of evidence, not evidence of absence |
| Effect on a binary outcome | beta is typically a log-odds-ratio; report exp(beta) as an odds ratio per SD/unit of exposure |
Instrument quality (moescore, "Mixture of Experts")
| MOE | Confidence |
|---|---|
| > 0.9 | High-quality instrument selection — trust the estimate most |
| 0.6–0.9 | Moderate — corroborate with another exposure GWAS or method |
| < 0.6 | Weak — treat as hypothesis-generating only |
Method (method)
| Method | Note |
|---|---|
| IVW (inverse-variance weighted) | Primary estimate; assumes no pleiotropy |
| MR-Egger | Allows directional pleiotropy; intercept ≠ 0 flags pleiotropy; lower power |
| Weighted median | Valid if ≥50% of instrument weight is from valid variants |
| Disagreement across methods | A red flag for pleiotropy — downgrade confidence |
Limitations (state these honestly)
- Two MR paths, different scopes.
EpiGraphDB_get_mendelian_randomizationreturns pre-computed MR-EvE estimates for curated trait pairs — fast, but limited to pairs IEU already ran. For a pair that isn't covered, or for custom instruments (your own p-value/clumping thresholds), useOpenGWAS_get_mr_instruments(needs a freeOPENGWAS_JWT) to assemble harmonized exposure+outcome SNP data, then compute the IVW/MR-Egger estimate yourself (e.g. IVW = Σ(βx·βy/σy²)/Σ(βx²/σy²)) or hand themr_inputto theTwoSampleMRR package. Advanced sensitivity analyses (MR-PRESSO, Steiger, leave-one-out) still needTwoSampleMR. - Palindromic SNPs (A/T, C/G) are not strand-resolved by
OpenGWAS_get_mr_instruments; review or drop ambiguous ones before trusting the estimate. - Horizontal pleiotropy is the dominant threat and cannot be fully excluded from a single estimate. Method agreement reduces but does not eliminate it.
- Population. Most OpenGWAS instruments are European-ancestry; effects and LD differ across ancestries. Report this.
- Winner's curse / weak instruments bias toward the confounded observational estimate; lean on MOE and instrument F-statistics.
- Scale. A statistically significant causal effect may be clinically small. Report magnitude, not just the p-value.
- One GWAS ≠ truth. Replication across independent exposure and outcome GWAS strengthens any MR claim.
Reporting template
Causal question: Does [exposure] affect [outcome]? MR estimate: beta = X (se Y, p = Z), method IVW, MOE score → [direction + magnitude, OR if binary]. Triangulation: bidirectional MR [reverse effect?]; genetic correlation rg = [value]; method agreement [yes/no]. Assumptions/caveats: instrument quality [MOE], pleiotropy [Egger intercept / method agreement], ancestry [population]. Verdict: [supported / not supported / inconclusive] causal effect, with the above caveats.
Frequently asked questions about Mendelian Randomization
Similar skills
Scientific Problem Selection
Streamline your research problem selection process.
Nextflow Development
Run nf-core bioinformatics pipelines with ease.
Nature Reviewer Assessment
Simulate peer review for scientific manuscripts.
Research Writing Pipeline
Streamline your scientific writing with structured proposal-first methodologies.
Nature Literature Downloader
Efficiently download academic literature from various sources.
Auto Research
Streamline your NeMo-RL experiments with automated workflows.
