library(TwoSampleMR)
exposure_dat = mv_extract_exposures_local(
filenames_exposure=c('PSY_factor.txt',"Alanine_aminotransferase.vcf",'HDL.vcf','HbA1c.vcf'),
sep = c("\t",'\t','\t','\t'),
phenotype_col = "Phenotype",
snp_col = "SNP",
beta_col = "BETA",
se_col = "SE",
effect_allele_col = "A1",
other_allele_col = "A2",
pval_col = "P",
samplesize_col = "N",
min_pval = 1e-200,
log_pval = FALSE,
pval_threshold = 5e-08,
plink_bin = 'C:/Users/DELL/Documents/R/win-library/4.1/plinkbinr/bin/plink_Windows.exe',
bfile = "H:\\Puberty_SEM\\MR_GWAS\\EUR\\EUR",
clump_r2 = 0.001,
clump_kb = 10000,
pop = "EUR",
harmonise_strictness = 2
)
outcome_dat <- read_outcome_data(
snps = exposure_dat$SNP,
filename = 'mvAge.txt',
sep = "\t",
snp_col = "SNP",
beta_col = "BETA",
se_col = "SE",
effect_allele_col = "A1",
other_allele_col = "A2",
pval_col = "P",
samplesize_col = "N"
)
mvdat <- mv_harmonise_data(exposure_dat, outcome_dat)
res <- mv_multiple(mvdat)
mv_res = res[['result']]
write.table(mv_res,file = 'Puberty-aging-mv_res.txt',row.names = F,sep = '\t',quote = F)
TwoSampleMR包的MVMR分析
最新推荐文章于 2024-10-07 00:05:15 发布