library(GWASdata)
data(illuminaScanADF)
scanAnnot <- illuminaScanADF
# exclude duplicated subjects
scan.exclude <- scanAnnot$scanID[scanAnnot$duplicated]
# create some variables for the scans
scanAnnot$sex <- as.factor(scanAnnot$sex)
scanAnnot$age <- rnorm(nrow(scanAnnot), mean=40, sd=10)
scanAnnot$case.cntl.status <- rbinom(nrow(scanAnnot), 1, 0.4)
scanAnnot$blood.pressure[scanAnnot$case.cntl.status==1] <- rnorm(sum(scanAnnot$case.cntl.status==1), mean=100, sd=10)
scanAnnot$blood.pressure[scanAnnot$case.cntl.status==0] <- rnorm(sum(scanAnnot$case.cntl.status==0), mean=90, sd=5)
# create data object
gdsfile <- system.file("extdata", "illumina_geno.gds", package="GWASdata")
gds <- GdsGenotypeReader(gdsfile)
genoData <- GenotypeData(gds, scanAnnot=scanAnnot)
## linear regression
res <- assocRegression(genoData,
outcome="blood.pressure",
model.type="linear",
covar=c("sex", "age"),
scan.exclude=scan.exclude,
snpStart=1, snpEnd=100)
## logistic regression
res <- assocRegression(genoData,
outcome="case.cntl.status",
model.type="logistic",
covar=c("sex", "age"),
scan.exclude=scan.exclude,
snpStart=1, snpEnd=100)
close(genoData)
Run the code above in your browser using DataLab