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
相关推荐
AI浩3 天前
MR-GDINO: Efficient Open-World Continual Object Detection
目标检测·目标跟踪·mr
十画_8244 天前
如何为运行在 PICO 4 Ultra 设备上的项目设置外部文件读写权限?
mr·pico
Cool-浩9 天前
Unity 开发Apple Vision Pro物体识别追踪ObjectTracking
unity·ar·apple vision pro·mr·物体识别·vision pro教程·objecttracking
三菱-Liu22 天前
三菱伺服通过MR Configurator2进行的试运行模式
运维·驱动开发·嵌入式硬件·制造·mr
Leeuwenhoek23 天前
MR智能眼镜:未来视觉的革新者
ar·mr·虚拟现实
幽默的荆轲君1 个月前
git如何快速拉取已经提交的mr进行验证
git·mr
Cool-浩1 个月前
Vision Pro VR/MR 平滑过度切换 Passthrough
unity·ar·vr·apple vision pro·mr·空间计算
声网2 个月前
脑机接口、嵌入式 AI 、工业级 MR、空间视频和下一代 XR 浏览器丨RTE2024 空间计算和新硬件专场回顾
人工智能·音视频·mr
程序员正茂2 个月前
PICO+Unity MR空间网格
unity·mr·pico
三菱-Liu2 个月前
三菱MR-J4-B伺服连接器和信号排列
网络·驱动开发·硬件工程·制造·mr