knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(mrpipeline)
The pipeline contains the ability to run Mendelian randomisation analyses, including relevant sensitivity analyses and visualisation of results from these analyses.
The pipeline expects a harmonised dataset to conduct MR.
exp_dat <- read_exposure("eqtl-a-ENSG00000167207") out_dat <- read_outcome("ieu-a-7", rsids = exp_dat$SNP) dat <- harmonise(exp_dat, out_dat) res <- do_mr(dat) head(data.frame(res))
The do_mr
function conducts the following analyses in this order:
If the F-statistic has not been calculated for the exposure data, and an F cutoff threshold is given (default: 10) then the F-statistic will be calculated here.
head(data.frame(exp_dat)) ```
The Wald ratio (WR) method is used for single-SNP instruments.
all_wr
argument is TRUE
, as it is by default, then the WR will be calculated for all SNPs, even if there are multiple SNPs present for a single exposure. The inverse variance weighted (IVW) method is used for multi-SNP instruments.
MendelianRandomization
package (see: https://rdrr.io/cran/MendelianRandomization/man/mr_ivw.html).Finally, if sample sizes are present for both exposure and outcome datasets, then a test for directionality (Steiger filtering) will be conducted. The pipeline directly calls the TwoSampleMR package for this analysis, so we advise reading those vignettes.
Under construction.
Forest plot:
forest_plot(res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.