赞
踩
install.packages("remotes")
remotes::install_github("MRCIEU/TwoSampleMR")##To update the package just run the command again
install.packages("readxl")
format_data()
读取自己整理好的工具变量文件,命名如下图。注意,命名区分大小写,不正确则无法读取##name:SNP beta se effect_allele eaf exposure chr position gene pval samplesize mr_keep
HcyIV <- as.data.frame(read_excel("IV_Hcy.xlsx"))
library(TwoSampleMR)
Hcy_exp_dat <- format_data(HcyIV, type="exposure")
read_exposure_data()
读,然后code改。尽可能提供多的信息,方便后期画图HcyIV.2 <- read_exposure_data(
filename = "IV_Hcy2.csv",
sep = ",",
snp_col = "SNP",
beta_col = "beta",
se_col = "se",
effect_allele_col = "effect_allele",
#other_allele_col = "a2",
eaf_col = "eaf",
pval_col = "pval",
#units_col = "Units",
#gene_col = "Gene",
samplesize_col = "samplesize"
)
Hcy_exp_dat$exposure <- "Homocysteine"
工具变量必须为独立变量。根据参考文献选择ref人群和r2
## Clumping via IEU GWAS database
Hcy_e
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。