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语言随机研究工具包1)---friendly2MR

    2023-12-31 05:44:02       42 阅读
  2. R语言入门笔记2.1

    2023-12-31 05:44:02       20 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-31 05:44:02       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-31 05:44:02       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-31 05:44:02       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-31 05:44:02       20 阅读

热门阅读

  1. Python装饰器

    2023-12-31 05:44:02       39 阅读
  2. k8s学习 — 各章节重要知识点

    2023-12-31 05:44:02       38 阅读
  3. k8s的网络类型

    2023-12-31 05:44:02       30 阅读
  4. GitHub Copilot 快速入门

    2023-12-31 05:44:02       37 阅读
  5. k8s学习 — (运维)第十一章 ELK 日志管理

    2023-12-31 05:44:02       30 阅读
  6. XAMPP for Windows 8.0.30, 8.1.25 & 8.2.12

    2023-12-31 05:44:02       37 阅读
  7. GitHub Copilot 快速入门

    2023-12-31 05:44:02       37 阅读
  8. 云计算的服务模式和发展趋势

    2023-12-31 05:44:02       38 阅读
  9. 2024年网络安全竞赛-页面信息发现任务解析

    2023-12-31 05:44:02       34 阅读