## ----style, echo = FALSE, results = 'asis'------------------------------- BiocStyle::markdown() ## ---- message=FALSE, warning=FALSE--------------------------------------- library(minfi) library(minfiData) library(sva) ## ----eval=FALSE---------------------------------------------------------- # source("http://www.bioconductor.org/biocLite.R") # biocLite(c("minfiData", "sva")) ## ----eval=FALSE---------------------------------------------------------- # library(devtools) # install_github("hansenlab/tutorial.450k") ## ------------------------------------------------------------------------ baseDir <- system.file("extdata", package="minfiData") targets <- read.450k.sheet(baseDir) targets RGSet <- read.450k.exp(targets = targets) ## ------------------------------------------------------------------------ phenoData <- pData(RGSet) phenoData[,1:6] ## ------------------------------------------------------------------------ manifest <- getManifest(RGSet) manifest head(getProbeInfo(manifest)) ## ------------------------------------------------------------------------ MSet <- preprocessRaw(RGSet) MSet ## ------------------------------------------------------------------------ head(getMeth(MSet)[,1:3]) head(getUnmeth(MSet)[,1:3]) ## ------------------------------------------------------------------------ RSet <- ratioConvert(MSet, what = "both", keepCN = TRUE) RSet ## ------------------------------------------------------------------------ beta <- getBeta(RSet) ## ------------------------------------------------------------------------ GRset <- mapToGenome(RSet) GRset ## ------------------------------------------------------------------------ beta <- getBeta(GRset) M <- getM(GRset) CN <- getCN(GRset) ## ------------------------------------------------------------------------ sampleNames <- sampleNames(GRset) probeNames <- featureNames(GRset) pheno <- pData(GRset) ## ------------------------------------------------------------------------ gr <- granges(GRset) head(gr, n= 3) ## ------------------------------------------------------------------------ annotation <- getAnnotation(GRset) names(annotation) ## ------------------------------------------------------------------------ head(getMeth(MSet)[,1:3]) head(getUnmeth(MSet)[,1:3]) ## ------------------------------------------------------------------------ qc <- getQC(MSet) head(qc) plotQC(qc) ## ------------------------------------------------------------------------ densityPlot(MSet, sampGroups = phenoData$Sample_Group) ## ------------------------------------------------------------------------ densityBeanPlot(MSet, sampGroups = phenoData$Sample_Group) ## ------------------------------------------------------------------------ controlStripPlot(RGSet, controls="BISULFITE CONVERSION II") ## ---- eval=FALSE--------------------------------------------------------- # qcReport(RGSet, pdf= "qcReport.pdf") ## ------------------------------------------------------------------------ predictedSex <- getSex(GRset, cutoff = -2)$predictedSex head(predictedSex) ## ------------------------------------------------------------------------ plotSex(getSex(GRset, cutoff = -2)) ## ------------------------------------------------------------------------ MSet.illumina <- preprocessIllumina(RGSet, bg.correct = TRUE, normalize = "controls") ## ------------------------------------------------------------------------ MSet.swan <- preprocessSWAN(RGSet) ## ------------------------------------------------------------------------ GRset.quantile <- preprocessQuantile(RGSet, fixOutliers = TRUE, removeBadSamples = TRUE, badSampleCutoff = 10.5, quantileNormalize = TRUE, stratified = TRUE, mergeManifest = FALSE, sex = NULL) ## ------------------------------------------------------------------------ MSet.noob <- preprocessNoob(RGSet) ## ------------------------------------------------------------------------ GRset.funnorm <- preprocessFunnorm(RGSet) ## ------------------------------------------------------------------------ snps <- getSnpInfo(GRset) head(snps,10) ## ------------------------------------------------------------------------ GRset <- addSnpInfo(GRset) ## ------------------------------------------------------------------------ GRset <- dropLociWithSnps(GRset, snps=c("SBE","CpG"), maf=0) ## ---- eval=FALSE--------------------------------------------------------- # library(FlowSorted.Blood.450k) # cellCounts <- estimateCellCounts(RGset) ## ------------------------------------------------------------------------ beta <- getBeta(GRset.funnorm) age <- pData(GRset.funnorm)$age dmp <- dmpFinder(beta, pheno = age , type = "continuous") head(dmp) ## ------------------------------------------------------------------------ pheno <- pData(GRset.funnorm)$status designMatrix <- model.matrix(~ pheno) ## ---- eval=FALSE--------------------------------------------------------- # dmrs <- bumphunter(GRset.funnorm, design = designMatrix, # cutoff = 0.2, B=0, type="Beta") ## ---- eval=FALSE--------------------------------------------------------- # dmrs <- bumphunter(GRset.funnorm, design = designMatrix, # cutoff = 0.2, B=1000, type="Beta") ## ---- eval=FALSE--------------------------------------------------------- # library(doParallel) # registerDoParallel(cores = 3) ## ---- eval=FALSE-------------------------------------------------------- # names(dmrs) # head(dmrs$table, n=3) ## ---- eval=FALSE--------------------------------------------------------- # data("dmrs_B1000_c02") # head(dmrs$table) ## ------------------------------------------------------------------------ library(sva) mval <- getM(GRset)[1:5000,] pheno <- pData(GRset) mod <- model.matrix(~as.factor(status), data=pheno) mod0 <- model.matrix(~1, data=pheno) sva.results <- sva(mval, mod, mod0) ## ---- eval=FALSE--------------------------------------------------------- # ab <- compartments(grset.quantile, chr="chr14", resolution=100`1000) ## ------------------------------------------------------------------------ snps <- getSnpBeta(RGSet) head(snps) ## ------------------------------------------------------------------------ oob <- getOOB(RGSet) ## ------------------------------------------------------------------------ sessionInfo()