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
相关推荐
chaoyuanl3 天前
超元力主题乐园飞行影院:把景区文化做成可持续更新的沉浸体验
大数据·3d·xr·娱乐·mr
Hody9112 天前
【XR硬件介绍】PICO Space Pro(Project Swan)深度解析:字节 2026 旗舰 MR 头显延期背后
xr·mr
极小狐15 天前
极狐GitLab Duo 功能更新:扩展 MCP 工具集、支持 MR 事件触发
运维·gitlab·agent·mr·极狐gitlab·mcp·极狐gitlab duo
Mixr_immersive23 天前
场馆采购MR无限飞车项目 实操要点全解析
娱乐·mr
chaoyuanl1 个月前
悬空玻璃剧场源头厂家选型全解析|270°裸眼3D悬空玻璃剧场投资避坑指南
大数据·人工智能·3d·xr·娱乐·mr
chaoyuanl2 个月前
超元力XR黑暗乘骑
科技·xr·vr·娱乐·mr
不厌 -_-2 个月前
gitlab中怎么创建MR提交模板
gitlab·mr
鸿儒5172 个月前
MR-50国产化GPU docker配置方法
docker·容器·mr
世优科技虚拟人3 个月前
VR大空间成文旅研学新宠:山海经、西游记、吴哥窟三大IP项目实探
vr·mr·虚拟体验·vr大空间