MRZhou

This R package is designed for the convenience of medical professionals, aiming to further simplify the analysis methods of Mendelian randomization (MR). It is integrated based on the TwosampleMR, MRpresso, and coloc packages. Therefore, whether it is the online data of the IEU GWAS database or local GWAS data (such as FinnGen database), this package can be conveniently executed. This package also includes: GSMR analysis, SMR analysis methods, etc. TWAS/Fusion analysis function method is under development.

When using this MRZhou package, it is recommended to first learn the basic syntax of TwosampleMR.

Installation

You can install the development version of MRZhou from GitHub with:

1
2
# install.packages("devtools")
devtools::install_github("fangzhoufan/MRZhou")

Example

This is a basic example which shows you how to solve a common problem:

1.Exposure and Outcome

Let’s identify the instrumental variables (IVs) for BMI and extract the BMI-associated SNPs from the CAD (coronary artery disease) outcome GWAS data.

1
2
3
library(MRZhou)
exp <- extract_instruments(outcomes = "ieu-a-2")
out <- extract_outcome_data(exp$SNP,outcomes = "ieu-a-7")

The above two functions are based on the TwosampleMR package, and detailed information can be found in the tutorial.

If you would like to use the FinnGen database, you can follow: exposure:

1
2
3
4
5
library(MRZhou)
data("finngenR9")
data("finngenR10")
# exp<-read_finngen_exposure('BMI','finngen_R10_BMI_IRN.gz', 290820, p_threshold = 5e-08)
# out<-read_finngen_outcome(exp, 'CAD', 'finngen_R10_I9_IHD.gz', 412181)

2. IVW analysis (main analysis method)

1
2
3
4
5
dat <- harmonise_data(exp, out)
result <- IVW_fix_random(dat)
test <- mr_test(dat)
presso <- MRpresso(dat)
resall <- combine_results(result, test, presso)

The resall dataframe is all of the MR methods results (including: MRpresso), Heterogeneity statistics and Horizontal pleiotropy results

3.Plot

1
2
3
4
5
6
## Not include MRpresso method results
forest_plot <- forest_plot(result)

## Include MRpresso method results
result2 <- combine_results(result, NULL, presso)
forest_plot <- forest_plot(result2)

4.Other Visualization

  • Volcano plot
1
volcano_plot <- volcano_plot(result)
  • Circle plot
1
circle_plot <- circle_plot(result)