clump的时候,报错:The query to MR-Base exceeded 300 seconds ,尝试做本地clump
参考了一下前人的经验,这里是参考的原文的链接
TwoSampleMR:local clump(MR-Base exceeded 300 seconds) 包括Windows和Linux R解决办法_Bioinfoer的博客-CSDN博客
下面是我自己跑的代码,在原文的基础上加了一些我的修改和解读
先安装包
devtools::install_github("mrcieu/ieugwasr",force = TRUE)
更新所有的包
library(ieugwasr)
devtools::install_github("explodecomputer/plinkbinr")
library(plinkbinr)
get_plink_exe()
下载bfile,我的GWAS是欧洲人种所以用EUR*,存到本地G盘的EUR_ref/EUR文件夹里
#http://fileserve.mrcieu.ac.uk/ld/1kg.v3.tgz
#解压该文件夹
b <- ld_clump(
dplyr::tibble(rsid=a$rsid, pval=a$p, id=a$id),
#get_plink_exe()
plink_bin = "C:/Users/Thinkpad/Documents/R/win-library/4.0/plinkbinr/bin/plink_Windows.exe",
#欧洲人群参考基因组位置
bfile = "D:/EUR_ref/EUR"
)
上面这一段代码在运行的时候又遇到了下面的报错
按照路径打开了该文件,应该就是clump没有成功,导致生成临时文件失败,在clump成功的文件里面找相应的文件也是没有的,因为这个只是一个临时生成的中间文件,只不过在这一步临时文件生成没有成功。
后面看到上文作者改了源代码
这个是源代码的网址
GitHub - MRCIEU/ieugwasr: R interface to the IEU GWAS database API
把源代码的zip下载到G盘,下载下来之后本地解压命名为ieugwasr
作者改的就是ld_matrix这个文件
用R打开,在相应的位置加上 " --threads 1 ",
然后保存,然后再本地重新安装ieugwasr
setwd("G:/ieugwasr")
devtools::install_local() 安装完成之后
library(ieugwasr)
library(plinkbinr)
get_plink_exe()
trait1.exposure_data_clumped <- ld_clump(
dplyr::tibble(rsid=trait1.exposure_data_1$SNP,
pval=trait1.exposure_data_1$pval.exposure,
id=trait1.exposure_data_1$exposure,
beta_col = trait1.exposure_data_1$beta.exposure,
se_col = trait1.exposure_data_1$se.exposure,
eaf_col = trait1.exposure_data_1$eaf.exposure),
#get_plink_exe()
plink_bin = "C:/Users/Thinkpad/Documents/R/win-library/4.0/plinkbinr/bin/plink_Windows.exe",
#欧洲人群参考基因组位置
bfile = "G:/EUR_ref/EUR"
)
运行之后,还是出现了上述的问题。
后来跟在线数据库的clump比对了一下
在线clump
编辑切换为居中
本地clump
本地clump的数据,自己在 dplyr::tibble列哪些数据才展现哪些数据,比在线的clump的数据要少一些。
然后出现前面:The query to MR-Base exceeded 300 seconds的问题,主要是我把很多exposure的snp放在一个txt文档里面,想一起做clump,后来觉得把exposure 逐个拆开,用for循环来逐个文件做clump。