随时学随时记录
rm(list = ls())
getwd()
setwd("D:\\科研——实验与课题\\孟德尔随机研究\\R目录")
install.packages("remotes")
library(remotes)
install_github("MRCIEU/TwoSampleMR")
library(TwoSampleMR)
#读取暴露相关的SNP
exposure_dat <- extract_instruments(outcomes = "ieu-a-2",
clump = TRUE,r2=0.0001,kb=1000,
access_token = NULL)
write.csv(exposure_dat,"exposure_dat.csv")
#结局
outcome_dat <- extract_outcome_data(snps=exposure_dat$SNP,
outcomes = "bbj-a-109")
write.csv(outcome_dat,"outcome_dat.csv")
#合并数据,action = 3去除回文序列
dat <- harmonise_data(exposure_dat, outcome_dat,action = 3)
res <- mr(dat)
网友评论