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

该文章描述了一项使用遗传关联研究方法,针对吸烟开始年龄(Age_Of_Smoking_Initiation)的SNP进行数据处理、效应估计和异质性、多效性检验的过程,生成了相关图表结果并保存为文本和PDF格式。
摘要由CSDN通过智能技术生成




i = "ukb-b-6134"
# trait = 'Age_Of_Smoking_Initiation'
# remove_snp <- read.table('C:/Users/DELL/Desktop/路易性痴呆/要剔除的SNP.txt', sep = '\t', header = T)


exposure = extract_instruments(outcomes = i)

outcome <- read_outcome_data(snps = exposure$SNP, filename = 'C:/Users/DELL/Desktop/路易性痴呆/GCST90001390_buildGRCh38.tsv', sep = '\t', snp_col = 'SNP', beta_col = 'beta', se_col = 'se', effect_allele_col = 'effect_allele', other_allele_col = 'other_allele', pval_col = 'p_value', eaf_col = 'effect_allele_frequency')
# dat1 <- harmonise_data(exposure_dat = exposure, outcome_dat = outcome)
# dat <- dat1[!(dat1$SNP %in% remove_snp$BB[remove_snp$AA==trait]),] # 剔除SNP
dat <- harmonise_data(exposure_dat = exposure, outcome_dat = outcome)
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(c)
dev.off()




要剔除的SNP.txt:

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值