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"
)
相关推荐
知识分享小能手1 小时前
R语言入门学习教程,从入门到精通,集成开发环境RStudio(2)
开发语言·学习·r语言
Biomamba生信基地3 小时前
拷贝数变异分析的python实现及R语言对比
python·r语言·生物信息学·单细胞测序
生物信息与育种1 天前
实战总结:用 rMVP 做植物 GWAS 的标准工作流与避坑指南
人工智能·深度学习·职场和发展·数据分析·r语言
知识分享小能手1 天前
R语言入门学习教程,从入门到精通,初识R语言(1)
开发语言·学习·r语言
知识分享小能手2 天前
R语言入门学习教程,从入门到精通,R语言多维数据可视化(12)
学习·信息可视化·r语言
知识分享小能手3 天前
R语言入门学习教程,从入门到精通,R语言时间序列数据可视化(11)
学习·信息可视化·r语言
maizeman1263 天前
R语言——折线图与面积图
信息可视化·r语言·折线图·面积图·堆积面积图
知识分享小能手4 天前
R语言入门学习教程,从入门到精通,R语言局部整体型数据可视化(10)
学习·信息可视化·r语言
知识分享小能手5 天前
R语言入门学习教程,从入门到精通,R语言数据计算与分组统计(9)
开发语言·学习·r语言
知识分享小能手6 天前
R语言入门学习教程,从入门到精通,R语言网络关系数据可视化(8)
学习·信息可视化·r语言