Install
$ agentstack add skill-gptomics-bioskills-pleiotropy-detection ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Version Compatibility
Reference examples tested with: TwoSampleMR 0.5.11+, MendelianRandomization 0.9.0+, MR-PRESSO 1.0+, CAUSE 1.2.0+, MR-Clust 0.1.0+, MRMix 0.1+, mr.raps 0.4.1+ (GitHub), LHC-MR 0.0.0.9000+ (GitHub), LCV (script-based, no version tag), simex 1.8+.
Before using code patterns, verify installed versions match. If versions differ:
- R:
packageVersion('')then?function_nameto verify parameters - For GitHub-only packages, check the repo HEAD vs the local install date
If code throws errors, introspect the installed package and adapt the example rather than retrying.
Pleiotropy Detection in Mendelian Randomization
"Validate my MR result against pleiotropic bias" -> Decompose violations of the exclusion-restriction assumption into uncorrelated horizontal pleiotropy (UHP, addressable by Egger / median / mode / MR-PRESSO) and correlated horizontal pleiotropy (CHP, addressable only by CAUSE / LHC-MR / LCV), then run a method battery whose assumptions span both regimes.
- R:
TwoSampleMR::mr()(IVW + Egger + median + mode),mr_pleiotropy_test(),mr_heterogeneity(),mr_leaveoneout(),directionality_test() - R:
MRPRESSO::mr_presso()for UHP outlier removal + distortion test - R:
cause::cause()for CHP-aware estimation;mrclust::mr_clust_em()for mechanism-heterogeneous instruments - R:
MendelianRandomization::mr_conmix()for contamination mixture;MRMix::MRMix()for mixture-of-distributions
UHP vs CHP: The Central Postdoc-Grade Distinction
Horizontal pleiotropy comes in two regimes, and most "standard" MR sensitivity methods address only one of them.
| Regime | Definition | InSIDE assumption | Methods that handle it | |--------|------------|--------------------|------------------------| | UHP (uncorrelated horizontal pleiotropy) | Pleiotropic effect alphaj independent of instrument-exposure effect gammaj | Holds | IVW (balanced UHP only), MR-Egger, weighted median, weighted mode, MR-PRESSO, MR-RAPS, MR-Mix, contamination mixture | | CHP (correlated horizontal pleiotropy) | alphaj correlates with gammaj through a shared upstream factor (heritable confounder, network mediator) | Violated | CAUSE, LHC-MR, LCV, MR-Clust (partial), Steiger-filtered MR (partial) |
InSIDE = INstrument Strength Independent of Direct Effect (Bowden 2015 IJE 44:512). Plain English: across SNPs, the per-SNP pleiotropic effect alpha and per-SNP instrument-exposure effect gamma are treated as independent random variables. CHP is the case where they covary because both flow from a shared upstream genetic factor.
The trap (Morrison 2020 Nat Genet 52:740): IVW, MR-Egger, MR-PRESSO, and GSMR are all blind to CHP. Under a shared heritable confounder they each return a plausible-looking corrected causal estimate that is systematically biased in the direction of the confounder. The MR-PRESSO global test does not flag CHP because correlated pleiotropy is not an outlier pattern, it is a population mean shift in the alpha distribution conditional on gamma.
Operational rule: If genetic correlation rg(exposure, outcome) is high (LDSC >= 0.3) or biology strongly suggests a shared upstream factor, the IVW / Egger / PRESSO triple is insufficient. Add CAUSE (preferred when sig SNPs >= 100) or LHC-MR (preferred for polygenic genome-wide IVs).
Operational Decision Flow (4 Steps)
- Compute genetic correlation (LDSC). Run
ldsc.py --rg ,(see causal-genomics/genetic-correlation). If|rg| > 0.3, CHP is plausible -> flag for Step 3 escalation. If the LDSC rg standard error spans zero broadly, treat low-rg evidence as weak rather than confirming absence of CHP. - Standard battery. IVW (random-effects when Cochran Q p = 10000
for stringent reporting). Report all five with point estimate, SE, p, 95% CI, and n_SNPs_used. Compute Egger I^2_GX; apply SIMEX if I^2_GX 0.3 OR PRESSO global p 50% nominal outliers OR Egger / median / mode disagree by > 2 SE. Run CAUSE (if>= 100` significant SNPs after pruning) or LHC-MR (any N; uses genome-wide sumstats). Report ELPD delta + z + q (CHP fraction) + gamma (CHP-adjusted causal estimate). - Triangulate. Pre-MR Steiger filter; bidirectional MR (examples/bidirectional_mr.R); LCV gcp; LDSC rg report. Consensus across methods supports a publication-ready claim. Disagreement requires narrowing the scope (e.g., subgroup, cis-MR, time-varying analysis) rather than reporting a single point estimate.
Algorithmic Taxonomy
| Method | Models | UHP-robust | CHP-robust | Min #SNPs | Fails when | Citation | |--------|--------|-----------|-----------|-----------|------------|----------| | Inverse-variance weighted (IVW) | Weighted regression through origin | Balanced UHP only | No | 3 | Directional UHP; CHP; weak IV bias; heterogeneity | Burgess 2013 Genet Epidemiol 37:658 | | MR-Egger intercept + slope | IVW + free intercept | Directional UHP | No | >=10 for power | NOME violated (I^2_GX =10 | >50% invalid; CHP | Bowden 2016 Genet Epidemiol 40:304 | | Weighted mode (MBE) | Mode of estimate density | Plurality valid | Partial | >=10 | Multimodal estimates from CHP clusters | Hartwig 2017 IJE 46:1985 | | Cochran Q | Heterogeneity across Wald ratios | Total heterogeneity flag, not direction-specific | No | 3 | Cannot distinguish UHP from heterogeneity from CHP | Greco 2015 Stat Med 34:2926 | | MR-PRESSO | Detect + remove UHP outliers via RSS-out | Yes (assumes majority valid) | No | >=4 | >50% pleiotropic; any CHP; small n | Verbanck 2018 Nat Genet 50:693 | | GSMR + HEIDI-outlier | Outlier removal via single-instrument estimate heterogeneity | Yes | No | >=10 | CHP (HEIDI-outlier is heterogeneity-driven) | Zhu 2018 Nat Commun 9:224 | | MR-RAPS | Profile likelihood with overdispersion + Huber/Tukey loss | Yes; weak-IV robust | Partial via overdispersion | >=10 | Strong CHP | Zhao 2020 Ann Stat 48:1742 | | MR-Mix | Mixture-of-distributions over valid + invalid | Yes | Partial | >=20 | Few SNPs; very heterogeneous CHP | Qi & Chatterjee 2019 Nat Commun 10:1941 | | Contamination mixture | Profile likelihood over contamination fraction | Yes | Partial | >=20 | Few SNPs | Burgess 2020 Nat Commun 11:376 | | MR-Clust | k-means over Wald estimates with NULL cluster | Yes | Diagnostic for CHP via clusters | >=20 | Single-mechanism exposure (no clustering signal) | Foley 2020 Bioinformatics 37:531 | | CAUSE | Bayesian mixture: shared causal + shared-factor (CHP) components | Yes | Yes (explicit) | >=100 sig SNPs at p= 0.3 or strong shared-factor biology | CAUSE (if sig SNPs >= 100`) OR LHC-MR | LCV gcp; cross-check IVW after Steiger filter | | Many weak IVs (mean F 0.05 (no detected pleiotropy) while a CHP-aware method (CAUSE, LHC-MR) returns a substantially different (often null) causal estimate.
Fix: When CHP is plausible, ALWAYS run CAUSE or LHC-MR in addition to PRESSO; do not rely on PRESSO global non-significance as evidence of no pleiotropy.
MR-Egger underpowered with few SNPs
Trigger: Fewer than 10 instruments.
Mechanism: Egger's intercept variance is driven by the spread of beta.exposure across instruments; with few SNPs the intercept CI is so wide that even strongly pleiotropic data give non-significant intercepts.
Symptom: Non-significant Egger intercept p-value alongside obviously discordant IVW and weighted-median estimates.
Fix: Report intercept point estimate and CI rather than a binary "pleiotropy present / absent" verdict; do not use Egger as the only sensitivity method when SNP count is low; weight evidence toward weighted-median, weighted-mode, and CAUSE / LHC-MR.
Steiger filter inverted by exposure measurement error (Hemani & Tilling 2022 IJE)
Trigger: Exposure is imprecisely measured (lower heritability ascertained in the exposure GWAS) and outcome is well-measured.
Mechanism: Steiger compares r^2GX vs r^2GY per SNP. Measurement error in the exposure underestimates r^2GX; well-measured outcome captures r^2GY accurately. Per-SNP, the inequality can flip even when the true causal direction is exposure -> outcome.
Symptom: A large fraction of instruments fail Steiger (steiger_dir == FALSE) in a direction that conflicts with biological plausibility.
Fix: Interpret Steiger as one signal among many, not a hard gate; cross-check with bidirectional MR; verify exposure GWAS heritability and sample size; switch to LHC-MR which models both directions jointly and accounts for heritability.
CAUSE underpowered with few significant SNPs
Trigger: Fewer than 100 genome-wide-significant instruments (p =10 strong; =0.9 Egger reliable | Bowden 2016 IJE 45:1961 | | I^2_GX (NOME) intermediate | 0.6-0.9 SIMEX-corrected Egger | Bowden 2016 IJE | | I^2_GX (NOME) severe | =10 | Bowden 2015 IJE 44:512 | | Cochran Q significance | p =5000 publication; >=10000 stringent | Verbanck 2018 Nat Genet 50:693 (Methods) | | MR-PRESSO global test p | heterogeneity / outliers present | Verbanck 2018 Nat Genet | | MR-PRESSO distortion test p | outliers materially shifted estimate; if >= 0.05 report uncorrected IVW | Verbanck 2018 Nat Genet | | MR-PRESSO min instruments | >=4 to run; >=10 for non-degenerate global test | Verbanck 2018 Nat Genet | | MR-PRESSO SignifThreshold | 0.05 default | Verbanck 2018 Nat Genet | | MR-PRESSO majority-valid breakdown | Fails when >50% instruments pleiotropic | Verbanck 2018 Nat Genet (theoretical limit) | | Weighted median validity | Robust to =100 p 1.96 standard; z > 3.0 stringent | Morrison 2020 Nat Genet | | LDSC rg suggesting CHP | >= 0.3 flags need for CAUSE / LHC-MR | Operational rule; see causal-genomics/genetic-correlation | | Steiger r^2 difference | Reverse-causal flag at any per-SNP r2GY > r2GX | Hemani 2017 PLoS Genet 13:e1007081 | | Standard sensitivity battery | IVW + Egger + median + mode + PRESSO + Steiger + LOO | Hemani 2018 eLife 7:e34408 / STROBE-MR 2021 |
LCV gcp interpretation thresholds (0, 0.5, 0.6, 1) are tabulated in usage-guide.md.
Standard Sensitivity Battery (Working Reference)
Goal: Run the canonical UHP-focused MR sensitivity suite on harmonized two-sample data.
Approach: Compute IVW + Egger + median + mode side-by-side; test Egger intercept and heterogeneity; run MR-PRESSO with >=5000 distributions for publication or >=10000 for stringent reporting; apply Steiger filter; leave-one-out; report all estimates.
library(TwoSampleMR)
library(MRPRESSO)
methods = 0.9
presso causal model preferred; z = delta_elpd / se(delta_elpd); z > 1.96 standard, z > 3.0 stringent; one-sided p reported alongside posterior gamma
- Pareto-k > 0.7 indicates unstable posterior on those points; if more than 10% of points are unstable, treat the posterior as unreliable; remediation: add more SNPs (loosen p-threshold one notch then re-prune in LD) or re-fit excluding flagged outliers
CAUSE requires sumstats from both exposure and outcome GWAS in matched effect-allele coding. The pruning step typically retains 100-5000 signature SNPs at LD r^2 = 100,000` genome-wide SNPs) to fit rho (sample overlap) stably.
## MR-RAPS Loss Function and Overdispersion
**Trigger:** Weak instruments (mean F 1 SE.
## MR-Clust for Mechanism Heterogeneity
**Goal:** When a single causal estimate is misleading because instruments operate through multiple causal mechanisms (e.g. LDL on CHD via multiple lipoprotein subfractions), identify clusters of instruments with similar per-SNP Wald ratios.
```r
library(mrclust)
ratio_hat = 100` genome-wide significant SNPs after pruning | CAUSE (Bayesian; CHP-explicit; mature posterior diagnostics) |
| Polygenic exposure with few significant loci | LHC-MR (uses genome-wide signal, not just significant SNPs) |
| Severe sample overlap between exposure and outcome GWAS | LHC-MR (jointly models overlap); CAUSE's rho correction is exposed to misspecification at high overlap |
| Bidirectionality of central interest | LHC-MR (jointly estimates alpha_xy and alpha_yx); CAUSE only models forward |
| Limited compute / quick turnaround | CAUSE (minutes to hours); LHC-MR may be > 24h on full sumstats |
When both apply, report both with the agreement / disagreement explicit in the discussion.
## Bidirectional MR Procedure
1. **Forward MR:** instrument exposure E, test effect on outcome Y (primary)
2. **Reverse MR:** instrument outcome Y, test effect on exposure E (using outcome-direction instruments)
3. **Steiger pre-filter both directions:** `steiger_filtering(dat)`; drop SNPs where outcome r^2 > exposure r^2 before primary IVW
4. **Compare estimates:** null reverse + significant forward strengthens the forward causal claim; bidirectional significance flags feedback / shared confounder / reciprocal causation
5. **LCV gcp orthogonal check:** genome-wide directional inference independent of the instrument set
Working code: examples/bidirectional_mr.R.
**Interpretation cheat-sheet:**
| Forward p | Reverse p | Reading |
|-----------|-----------|---------|
| significant | non-significant | Forward causal claim strengthened |
| non-significant | significant | Re-examine instrument-exposure assignment; the "outcome" may causally drive the "exposure" |
| significant | significant | Feedback loop, shared confounder, or reciprocal causation; resolve with LHC-MR |
| non-significant | non-significant | No evidence of causation in either direction |
When forward and reverse both clear Steiger and both IVW p 1.96 -> causal) |
## Reconciliation Across Methods
| Pattern | Likely cause | Action |
|---------|--------------|--------|
| IVW and Egger agree (small Egger intercept); median and mode agree | Likely true causal; minimal pleiotropy | Report all; STROBE-MR; emphasize agreement |
| IVW significant; Egger non-significant with similar slope; PRESSO global p > 0.05 | Egger underpowered (few SNPs) OR Egger NOME violated | Check I^2_GX; SIMEX-correct if 0.6 =2 distinct non-null clusters | Heterogeneous mechanisms | Report per-cluster estimates; do not summarize as a single effect |
| Steiger fails on a substantial fraction of instruments | Reverse causation OR exposure measurement error | Run bidirectional MR; check exposure GWAS heritability; LHC-MR |
| MR-PRESSO global p 50% pleiotropic OR CHP masquerading as UHP | Re-prune instruments; switch to weighted-mode / CAUSE / LHC-MR |
**Operational rule for publication:** Report IVW (primary), Egger slope + intercept, weighted median, weighted mode, MR-PRESSO global + distortion + corrected, Cochran Q, Steiger directionality, F-statistic distribution, I^2_GX (for Egger validity), and at least one CHP-aware method (CAUSE or LHC-MR) when rg `>= 0.3` or biology suggests shared upstream. Failure to report a CHP-aware result when CHP is plausible is a reviewer-flagged red flag since 2020.
## Anticipated Reviewer Pushback
| Pushback | Standard response |
|----------|-------------------|
| "Was CHP checked for?" | LDSC rg reported (causal-genomics/genetic-correlation); if rg > 0.3, CAUSE or LHC-MR ran; q posterior reported |
| "Why CAUSE and not LHC-MR?" | CAUSE preferred when `>= 100` significant SNPs available (Morrison 2020). LHC-MR preferred when significant-SNP set is small or polygenic, using genome-wide sumstats (Darrous 2021) |
| "Egger NOME?" | I^2_GX computed; if 0.6 =4 for PRESSO; for cis-MR with few SNPs use colocalization |
| Egger intercept p 0.7 | 24h | Default n_cores=1 on full sumstats | Use n_cores >= 4; restrict to LDSC-overlapping SNPs first |
| MR-PRESSO outliers all on same chromosome | Genome-wide LD not properly pruned; clumping window too narrow | Re-clump at r^2 =20 SNPs; default mixture grid may need tuning |
## References
- Bowden J et al 2015 Int J Epidemiol 44:512 (MR-Egger; InSIDE)
- Bowden J et al 2016 Int J Epidemiol 45:1961 (NOME, I^2_GX, SIMEX)
- Cook JR & Stefanski LA 1994 JASA 89:1314 (SIMEX framework)
- Burgess S 2020 Nat Commun 11:376 (contamination mixture)
- Burgess S & Thompson SG 2021 (Mendelian Random
…
## Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- **Author:** [GPTomics](https://github.com/GPTomics)
- **Source:** [GPTomics/bioSkills](https://github.com/GPTomics/bioSkills)
- **License:** MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.