# #——回声= FALSE --------------------------------------------------------------------------------------------- 选项(宽度= 110)# #——消息= FALSE ------------------------------------------------------------------------------------------ 库(SeqArray)库(SAIGEgds) # SeqArray GDS中的基因型文件格式(1000 Phase1基因组,22号染色体)(geno_fn < - seqExampleFileName(“KG_Phase1 ")) ## ----------------------------------------------------------------------------------------------------------- # 打开一个SeqArray文件在包(1000基因组Phase1,染色体22)gds < - seqOpen (geno_fn ) ## ----------------------------------------------------------------------------------------------------------- 库(SNPRelate) set.seed (1000) snpset < - snpgdsLDpruning (gds) str snpset (snpset)。id < - unlist (snpset use.names = FALSE) #变体id的一套LD-pruned头(snpset.id ) ## ----------------------------------------------------------------------------------------------------------- grm_fn <——“grm_geno。gds”seqSetFilter (gds variant.id = snpset.id) #出口gds基因型文件没有注释数据seqExport (gds、grm_fn info.var =字符(),fmt.var =字符(),samp.var =字符 ()) ## ----------------------------------------------------------------------------------------------------------- # 关闭文件seqClose (gds ) ## ----------------------------------------------------------------------------------------------------------- set.seed (1000) sampid < - seqGetData (grm_fn,"sample.id") #基因型文件pheno中的样本id号<- data.frame(sample.id)id = sampid, y =样本(c(0, 1),长度(sampid),取代= TRUE,概率= c (0.95, 0.05), x1 = rnorm(长度(sampid)), x2 = rnorm(长度(sampid)), stringsAsFactors = FALSE)头(把)grm_fn # #——回声= FALSE --------------------------------------------------------------------------------------------- glmm < readRDS(系统。文件(“extdata”、“v_glmm。rds”,包= " SAIGEgds ")) ## ----------------------------------------------------------------------------------------------------------- # 遗传变异中存储文件geno_fn geno_fn #计算,使用2流程assoc < - seqAssocGLMM_SPA (glmm geno_fn, mac = 10,并行= 2)头(协会)#过滤基于假定值assoc [assoc pval < 5美元的军医 , ] ## ----------------------------------------------------------------------------------------------------------- # 保存到”协会。gds seqAssocGLMM_SPA (glmm geno_fn, mac = 10,平行= 2,res.savefn = " assoc.gds ") ## ----------------------------------------------------------------------------------------------------------- # 打开GDS文件(f < - openfn.gds(“assoc.gds”))#假定值pval < read.gdsn(指数。gdsn (f, pval))总结(pval) closefn.gds (f ) ## ----------------------------------------------------------------------------------------------------------- res < - seqSAIGE_LoadPval (assoc.gds)头(res) # #——无花果。宽度= 6,fig.height = 3, fig.align = '中心 '---------------------------------------------------------- 库(ggmanh) g < - manhattan_plot (pval协会。colname = " pval”,空空的。colname="chr", pos.colname="pos", x.label=" 22号染色体")g ## ----宽度= 3,fig.height = 3, fig.align = '中心 '---------------------------------------------------------- # QQ情节qqunif (assoc pval美元 ) ## ----------------------------------------------------------------------------------------------------------- sessionInfo () ## ---- 回声= FALSE --------------------------------------------------------------------------------------------- 分离(c(“grm_geno。gds", "assoc.gds"), force=TRUE)