# # # R与装饰图案来源的代码的格式。Rnw的utf - 8编码:# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块1号:格式。Rnw: 170 - 178 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #库(GWASTools)库(SNPRelate)床上。fn < -系统。文件(“extdata”、“plinkhapmap.bed。广州”,包= " SNPRelate”)的家。fn < -系统。文件(“extdata”、“plinkhapmap.fam。广州”,包= " SNPRelate”)荡妇。fn < -系统。文件(“extdata”、“plinkhapmap.bim。广州”,包= " SNPRelate”) gdsfile <——“单核苷酸多态性。gds“snpgdsBED2GDS(床上。fn,家人。fn,荡妇。fn、gdsfile家庭= TRUE, cvt。=“int”,从而向cvt。snpid = " int " verbose = FALSE) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块2号:格式。Rnw: 188 - 215 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # (gds < - GdsGenotypeReader (gdsfile YchromCode = 24 l, XYchromCode = 25 l)) scanID < - getScanID家人(gds) < - getVariable (gds,“sample.annot /家庭”)父亲< - getVariable (gds,“sample.annot /父亲”)母亲< - getVariable (gds,“sample.annot /母亲”)性< - getVariable (gds,“sample.annot /性”)性(性= = " ")< - NA #性必须编码为M / F / NA表型< - getVariable (gds,“sample.annot /表型”)scanAnnot < - ScanAnnotationDataFrame (data.frame (scanID,父亲,母亲,性别、表型、stringsAsFactors = FALSE)) snpID < - getSnpID (gds)染色体< - getChromosome (gds)位置< - getPosition (gds) alleleA < - getAlleleA (gds) alleleB < - getAlleleB (gds) rsID < - getVariable (gds, snp.rs.id) snpAnnot < - SnpAnnotationDataFrame (data.frame (snpID、染色体、位置、rsID alleleA, alleleB, stringsAsFactors = FALSE), YchromCode = 24 l, XYchromCode = 25 l) genoData <——GenotypeData (gds, scanAnnot = scanAnnot snpAnnot = snpAnnot) getGenotype (genoData snp = c(1、5),扫描= c(1、5))关闭(genoData) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块3号:格式。Rnw: 218 - 219 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #拆开(gdsfile) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块数量4:格式。Rnw: 228 - 233 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #库(GWASTools)库(SNPRelate) vcffile < -系统。文件(“extdata”、“序列。vcf”,包= " SNPRelate”) gdsfile <——“单核苷酸多态性。gds" snpgdsVCF2GDS(vcffile, gdsfile, verbose=FALSE) ################################################### ### code chunk number 5: Formats.Rnw:240-260 ################################################### (gds <- GdsGenotypeReader(gdsfile)) getScanID(gds) snpID <- getSnpID(gds) chromosome <- as.integer(getChromosome(gds)) position <- getPosition(gds) alleleA <- getAlleleA(gds) alleleB <- getAlleleB(gds) rsID <- getVariable(gds, "snp.rs.id") qual <- getVariable(gds, "snp.annot/qual") filter <- getVariable(gds, "snp.annot/filter") snpAnnot <- SnpAnnotationDataFrame(data.frame(snpID, chromosome, position, rsID, alleleA, alleleB, qual, filter, stringsAsFactors=FALSE)) genoData <- GenotypeData(gds, snpAnnot=snpAnnot) getGenotype(genoData) close(genoData) ################################################### ### code chunk number 6: Formats.Rnw:263-264 ################################################### unlink(gdsfile)