gdsfile <- tempfile()
snpfile <- tempfile()
scanfile <- tempfile()
logfile <- tempfile()
# IMPUTE2
probfile <- system.file("extdata", "imputation", "IMPUTE2", "example.chr22.study.gens",
package="GWASdata")
sampfile <- system.file("extdata", "imputation", "IMPUTE2", "example.study.samples",
package="GWASdata")
imputedDosageFile(input.files=c(probfile, sampfile), filename=gdsfile, chromosome=22,
input.type="IMPUTE2", input.dosage=FALSE,
snp.annot.filename=snpfile, scan.annot.filename=scanfile)
gds <- GdsGenotypeReader(gdsfile)
scanAnnot <- getobj(scanfile)
snpAnnot <- getobj(snpfile)
genoData <- GenotypeData(gds, scanAnnot=scanAnnot, snpAnnot=snpAnnot)
checkImputedDosageFile(genoData, snpAnnot, scanAnnot,
input.files=c(probfile, sampfile), chromosome=22,
input.type="IMPUTE2", input.dosage=FALSE, na.logfile=logfile)
geno <- getGenotype(genoData)
getAlleleA(genoData)
getAlleleB(genoData)
log <- read.table(logfile)
head(log)
# association test with imputed dosages
scanAnnot$status <- sample(0:1, nrow(scanAnnot), replace=TRUE)
genoData <- GenotypeData(gds, scanAnnot=scanAnnot, snpAnnot=snpAnnot)
assoc <- assocRegression(genoData, outcome="status", model.type="logistic")
head(assoc)
close(genoData)
# BEAGLE - genotype probabilities
probfile <- system.file("extdata", "imputation", "BEAGLE", "example.hapmap.unphased.bgl.gprobs",
package="GWASdata")
markfile <- system.file("extdata", "imputation", "BEAGLE", "hapmap.markers",
package="GWASdata")
imputedDosageFile(input.files=c(probfile, markfile), filename=gdsfile, chromosome=22,
input.type="BEAGLE", input.dosage=FALSE, file.type="gds",
snp.annot.filename=snpfile, scan.annot.filename=scanfile)
# BEAGLE - dosage
dosefile <- system.file("extdata", "imputation", "BEAGLE", "example.hapmap.unphased.bgl.dose",
package="GWASdata")
imputedDosageFile(input.files=c(dosefile, markfile), filename=gdsfile, chromosome=22,
input.type="BEAGLE", input.dosage=TRUE, file.type="gds",
snp.annot.filename=snpfile, scan.annot.filename=scanfile)
# MaCH - genotype probabilities
probfile <- system.file("extdata", "imputation", "MaCH", "mach1.out.mlprob",
package="GWASdata")
markfile <- system.file("extdata", "imputation", "MaCH", "mach1.out.mlinfo",
package="GWASdata")
posfile <- system.file("extdata", "imputation", "MaCH", "mach1.snp.position",
package="GWASdata")
imputedDosageFile(input.files=c(probfile, markfile, posfile), filename=gdsfile, chromosome=22,
input.type="MaCH", input.dosage=FALSE, file.type="gds",
snp.annot.filename=snpfile, scan.annot.filename=scanfile)
# MaCH - dosage
dosefile <- system.file("extdata", "imputation", "MaCH", "mach1.out.mldose",
package="GWASdata")
imputedDosageFile(input.files=c(dosefile, markfile, posfile), filename=gdsfile, chromosome=22,
input.type="MaCH", input.dosage=TRUE, file.type="gds",
snp.annot.filename=snpfile, scan.annot.filename=scanfile)
unlink(c(gdsfile, snpfile, scanfile))
Run the code above in your browser using DataLab