R语言孟德尔随机化研究工具包(1)---friendly2MR

friendly2MR是孟德尔岁随机化研究中的一个重要补充工具,可以批量探索因素间的因果关系,以及快速填补缺失eaf的数据,但是存在细微差异需要注意。

复制代码
remotes::install_github("xiechengyong123/friendly2MR")
library(friendly2MR)

library(friendly2MR)
#Based on TwosampleMR, to investigate the causal relationship between multiexposure and outcome
a<-find_multiexposure_outcome(
  exposure =c("ieu-b-6","ieu-b-8","ieu-b-9"),
  outcome ="ieu-b-4965",
  write = T,
  p1 = 5e-08,
  clump = TRUE,
  p2 = 5e-08,
  r2 = 0.001,
  kb = 10000,
  LD = 0.8
)
#It can used to investigate the causal relationship between exposure and multioutcome: find_exposure_multioutcome
#It can also used to investigate the causal relationship between multiexposure and multioutcome:
memo<-find_multiexposure_multioutcome_epigraphdb(
  exposure =c("ukb-a-7"),
  outcome = c("ieu-a-7"),
  pval_threshold = 1e-05,
  write = T,
  save_path = "multi.csv"
)


#Fill in the missing effect allele
library(TwoSampleMR)
aaa<-extract_instruments(outcomes='ukb-b-8755',
                               clump=TRUE, 
                               r2=0.001,kb=10000,access_token=NULL)
eaf<-aaa$eaf.exposure
aaa$eaf.exposure<-NA
abc<-find_snp_add_eaf(exposure=aaa)
identical(eaf,abc$eaf.exposure)
#Please pay attention to differences
cb<-cbind(eaf,abc$eaf.exposure)

#To find confounders
ee1<-de("ieu-a-7")
confound<-c("body mass index","Coronary heart disease")
expo_dat_nocon<-deletion_confounding_snp(
  confound = confound,
  exposure_dat = aaa,
  query_gene = NULL,
  query_region = NULL,
  catalogue = "GWAS",
  pvalue = 5e-08,
  proxies = "None",
  r2 = 0.8,
  build = 37,
  write = TRUE,
  save_path = "MR_ivs.csv"
)
相关推荐
烟锁池塘柳01 天前
【R语言】R语言中 rbind() 与 merge() 的区别详解
sql·r语言
夏婵语冰2 天前
实用R语言机器学习指南:从数据预处理到模型实战(附配套学习资源)
开发语言·学习·r语言
Yolo566Q3 天前
“R语言+遥感”的水环境综合评价方法实践技术应用
开发语言·r语言
天意生信云3 天前
生信分析自学攻略 | R语言数据筛选和修改
数据结构·经验分享·r语言
烟锁池塘柳05 天前
【R语言】R 语言中 gsub 与正则表达式详解(含 POSIX 与 Perl 风格实例)
正则表达式·r语言·perl
梦想的初衷~6 天前
“R+遥感”的水环境综合评价方法实践技术应用
r语言·水环境·水文
天意生信云7 天前
生信分析自学攻略 | R软件和Rstudio的安装
经验分享·r语言
TS的美梦7 天前
【1:1复刻R版】python版火山图函数一键出图
开发语言·python·r语言·scanpy·火山图
nonono7 天前
深度学习——R-CNN及其变体
深度学习·r语言·cnn
烟锁池塘柳08 天前
【R语言】R 语言中打印含有双引号的字符串时会出现 “\” 的原因解析
r语言