library(GWASdata)
#############
# Illumina - genotype file
#############
gdsfile <- tempfile()
path <- system.file("extdata", "illumina_raw_data", package="GWASdata")
data(illumina_snp_annot, illumina_scan_annot)
snpAnnot <- illumina_snp_annot[,c("snpID", "rsID", "chromosome",
"position", "alleleA", "alleleB")]
names(snpAnnot)[2] <- "snpName"
# subset of samples for testing
scanAnnot <- illumina_scan_annot[1:3, c("scanID", "genoRunID", "file")]
names(scanAnnot)[2] <- "scanName"
col.nums <- as.integer(c(1,2,12,13))
names(col.nums) <- c("snp", "sample", "a1", "a2")
diagfile <- tempfile()
res <- createDataFile(path, gdsfile, file.type="gds", variables="genotype",
snpAnnot, scanAnnot, sep.type=",",
skip.num=11, col.total=21, col.nums=col.nums,
scan.name.in.file=1, diagnostics.filename=diagfile)
file.remove(diagfile)
file.remove(gdsfile)
#############
# Affymetrix - genotype file
#############
gdsfile <- tempfile()
path <- system.file("extdata", "affy_raw_data", package="GWASdata")
data(affy_snp_annot, affy_scan_annot)
snpAnnot <- affy_snp_annot[,c("snpID", "probeID", "chromosome", "position")]
names(snpAnnot)[2] <- "snpName"
# subset of samples for testing
scanAnnot <- affy_scan_annot[1:3, c("scanID", "genoRunID", "chpFile")]
names(scanAnnot)[2:3] <- c("scanName", "file")
col.nums <- as.integer(c(2,3)); names(col.nums) <- c("snp", "geno")
diagfile <- tempfile()
res <- createDataFile(path, gdsfile, file.type="gds", variables="genotype",
snpAnnot, scanAnnot, sep.type="\t",
skip.num=1, col.total=6, col.nums=col.nums,
scan.name.in.file=-1, diagnostics.filename=diagfile)
file.remove(diagfile)
# check
diagfile <- tempfile()
res <- checkGenotypeFile(path, gdsfile, file.type="gds", snpAnnot, scanAnnot,
sep.type="\t", skip.num=1, col.total=6, col.nums=col.nums,
scan.name.in.file=-1,
check.scan.index=1:3, n.scans.loaded=3,
diagnostics.filename=diagfile)
file.remove(diagfile)
file.remove(gdsfile)
#############
# Affymetrix - intensity file
#############
gdsfile <- tempfile()
path <- system.file("extdata", "affy_raw_data", package="GWASdata")
data(affy_snp_annot, affy_scan_annot)
snpAnnot <- affy_snp_annot[,c("snpID", "probeID", "chromosome", "position")]
names(snpAnnot)[2] <- "snpName"
# subset of samples for testing
scanAnnot <- affy_scan_annot[1:3, c("scanID", "genoRunID", "alleleFile")]
names(scanAnnot)[2:3] <- c("scanName", "file")
diagfile <- tempfile()
res <- createAffyIntensityFile(path, gdsfile, file.type="gds", snpAnnot, scanAnnot,
diagnostics.filename=diagfile)
file.remove(diagfile)
# check
diagfile <- tempfile()
res <- checkIntensityFile(path, gdsfile, file.type="gds", snpAnnot, scanAnnot,
sep.type="\t", skip.num=1, col.total=2,
col.nums=setNames(as.integer(c(1,2,2)), c("snp", "X", "Y")),
scan.name.in.file=-1, affy.inten=TRUE,
check.scan.index=1:3, n.scans.loaded=3,
diagnostics.filename=diagfile)
file.remove(diagfile)
file.remove(gdsfile)
Run the code above in your browser using DataLab