不做实验就可以发文章,为小伙伴们安利孟德尔随机化分析(MR)
收录于话题

今天小果为大家分享一下两样本孟德尔随机化分析流程,整个分析过程比较简单,该分析最重要的是暴露因素和结局变量GWAS数据的查找,一般都通过两种方式获得,公共数据库和发表的相关文章获取,接下来就为大家用示例数据做下演示,代码如下:
01
安装需要的R包
install.packages("devtools")devtools::install_github("MRCIEU/TwoSampleMR")Install.packages(“ggplot2”)
02
导入需要的R包
library(TwoSampleMR)library(ggplot2)
03
分析过程
bmi_exp <- extract_instruments(outcomes=ieu-a-835,clump=TRUE, r2=0.01,kb=5000,access_token = NULL)##获取结局变量数据t2d_out <- extract_outcome_data(snps=bmi_exp$SNP,outcomes=ieu-a-26,proxies = FALSE,maf_threshold = 0.01,access_token = NULL)#对数据进行预处理mydata <- harmonise_data(exposure_dat=bmi_exp,outcome_dat=t2d_out,action= 2)#MR分析res <- mr(mydata)write.table(res,file="twosampleMR.txt",sep="t",quote=F)

##敏感性分析#异质性检验het <- mr_heterogeneity(mydata)hetwrite.table(het,file="het.txt",col.names=T,row.names=F,sep="t",quote=F)#多效性检验pleio <- mr_pleiotropy_test(mydata)pleiowrite.table(pleio,file="pleio.txt",col.names=T,row.names=F,sep="t",quote=F)#逐个剔除检验single <- mr_leaveoneout(mydata)mr_leaveoneout_plot(single)ggsave("leaveoneout.pdf")

##可视化分析#绘制散点图mr_scatter_plot(res,mydata)ggsave("scatter_plot.pdf")

#绘制森林图res_single <- mr_singlesnp(mydata)mr_forest_plot(res_single)ggsave("forest_plot.pdf")

#绘制漏斗图mr_funnel_plot(res_single)ggsave("funnel_plot.pdf")

小果今天对两样本孟德尔随机化的分享就到这里,有需要的可以借鉴学习奥,不要忘记点赞关注呀,下期在见。

