MR分析——剔除与混淆因素相关的SNP

library(TwoSampleMR)

i = "ieu-b-4836"

trait = 'Years_of_schooling'

remove_snp <- read.table('C:/Users/DELL/Desktop/要剔除的SNP.txt', sep = '\t', header = T)

exposure = extract_instruments(outcomes = i)

outcome <- read_outcome_data(snps = exposureKaTeX parse error: Undefined control sequence: \t at position 84: ...8.tsv', sep = '\̲t̲', snp_col = 'S...SNP %in% remove_snp B B [ r e m o v e s n p BB[remove_snp BB[removesnpAAtrait]),] # 剔除SNP
sum(dat$mr_keep'TRUE')

a <- generate_odds_ratios(mr_res = mr(dat))

b <- mr_heterogeneity(dat)

c <- mr_pleiotropy_test(dat)

filenamea <- paste0('mr_', i, '.txt')

filenameb <- paste0('heter_', i, '.txt')

filenamec <- paste0('pleio_', i, '.txt')

write.table(a, file = filenamea, quote = F, sep = '\t')

write.table(b, file = filenameb, quote = F, sep = '\t')

write.table(c, file = filenamec, quote = F, sep = '\t')

filename <- paste0("outfig_", i, '.pdf')

pdf(file = filename)

a <- mr_scatter_plot(mr_results = mr(dat, method_list = c("mr_ivw", "mr_egger_regression", "mr_weighted_median")), dat)

b <- mr_funnel_plot(singlesnp_results = mr_singlesnp(dat))

c <- mr_leaveoneout_plot(leaveoneout_results = mr_leaveoneout(dat))

print(a)

print(b)

print©

dev.off()

要剔除的SNP.txt:

html 复制代码
AA	BB	CC
Alcoholic_drinks_per_week	rs1260326	3
Alcoholic_drinks_per_week	rs13107325	3
Cholesterol_total	rs112552009	2
Cholesterol_total	rs7412	2
Cigarettes_smoked_per_day	rs56113850	2
Cigarettes_smoked_per_day	rs73229090	2
Fluid_intelligence_score	rs13107325	3
Fluid_intelligence_score	rs7963801	2
Granulocyte_percentage_of_myeloid_white_cells	rs1260326	3
Granulocyte_percentage_of_myeloid_white_cells	rs10732976	2
相关推荐
atwdy5 天前
【hadoop】hadoop streaming
大数据·hadoop·mr·streaming
Unity大海5 天前
诠视科技MR眼镜如何使用VLC 进行RTSP投屏到电脑
科技·mr
Unity大海6 天前
诠视科技MR眼镜如何安装apk应用
科技·mr
YY-nb16 天前
基于 Quest 摄像头数据开发的原理介绍【Unity Meta Quest MR 开发教程】
unity·游戏引擎·mr
小杨小杨11 个月前
Lifespan Brain MR 图像分割的知识引导式提示学习
学习·mr
岱宗夫up1 个月前
探秘虚拟与现实的融合:VR、AR、MR 技术的变革力量
ar·vr·mr
罗小罗同学1 个月前
国自然面上项目|基于多模态MR影像的胶质母细胞瘤高危区域定位及预后预测研究|基金申请·25-02-28
人工智能·深度学习·mr·影像组学·医学人工智能
小技工丨1 个月前
MR-图解
hadoop·mr
MediaTea1 个月前
Ae 效果详解:CC Mr. Mercury
mr
YY-nb2 个月前
【2025 Unity Meta Quest MR 开发教程】透视 Passthrough 模块配置(戴上头显看见现实画面)
unity·游戏引擎·mr