###################################################
### chunk number 1: 
###################################################
library(affyPara)


###################################################
### chunk number 2: 
###################################################
library(affyPara)


###################################################
### chunk number 3: 
###################################################
library(affydata)
data(Dilution)
Dilution


###################################################
### chunk number 4: 
###################################################
cl <- makeCluster(4, type='SOCK')


###################################################
### chunk number 5: 
###################################################
stopCluster(cl)


###################################################
### chunk number 6: 
###################################################
cl <- makeCluster(2, type='SOCK')


###################################################
### chunk number 7:  eval=FALSE
###################################################
## AffyBatch <- ReadAffy()


###################################################
### chunk number 8: 
###################################################
bgcorrect.methods()


###################################################
### chunk number 9: affyBatchBGC
###################################################
affyBatchBGC <- bgCorrectPara(Dilution,
				method="rma", verbose=TRUE)


###################################################
### chunk number 10: affyBatchBGCfiles eval=FALSE
###################################################
## files <- list.celfiles(full.names=TRUE)
## affyBatchGBC <- bgCorrectPara(files, 
## 				method="rma", cluster=cl)


###################################################
### chunk number 11: affyBatchNORM
###################################################
affyBatchNORM <- normalizeAffyBatchQuantilesPara(
		Dilution, type = "pmonly", verbose=TRUE)


###################################################
### chunk number 12: affyBatchGBCfiles eval=FALSE
###################################################
## files <- list.celfiles(full.names=TRUE)
## affyBatchNORM <- normalizeAffyBatchQuantilesPara(
## 		files, type = "pmonly")


###################################################
### chunk number 13: 
###################################################
express.summary.stat.methods()
pmcorrect.methods()


###################################################
### chunk number 14: computeExprSetPara eval=FALSE
###################################################
## esset <- computeExprSetPara(
## 	Dilution,
## 	pmcorrect.method = "pmonly",
## 	summary.method = "avgdiff")


###################################################
### chunk number 15: computeExprSetParafiles eval=FALSE
###################################################
## files <- list.celfiles(full.names=TRUE)
## esset <- normalizeAffyBatchQuantilesPara(
## 	files, 
## 	pmcorrect.method = "pmonly",
## 	summary.method = "avgdiff")


###################################################
### chunk number 16: preproPara eval=FALSE
###################################################
## esset <- preproPara(
## 	Dilution, 
## 	bgcorrect = TRUE, bgcorrect.method = "rma",
## 	normalize = TRUE, normalize.method = "quantil",
## 	pmcorrect.method = "pmonly",
## 	summary.method = "avgdiff")


###################################################
### chunk number 17: preproParafiles eval=FALSE
###################################################
## files <- list.celfiles(full.names=TRUE)
## esset <- preproPara(
## 	files, 
## 	bgcorrect = TRUE, bgcorrect.method = "rma",
## 	normalize = TRUE, normalize.method = "quantil",
## 	pmcorrect.method = "pmonly",
## 	summary.method = "avgdiff")


###################################################
### chunk number 18: rmaPara eval=FALSE
###################################################
## esset <- rmaPara(Dilution)


###################################################
### chunk number 19: rmaParaFiles eval=FALSE
###################################################
## files <- list.celfiles(full.names=TRUE)
## esset <- rmaPara(files)


###################################################
### chunk number 20: qc eval=FALSE
###################################################
## boxplotPara(Dilution)
## MAplotPara(Dilution)


###################################################
### chunk number 21: distributeFiles eval=FALSE
###################################################
## path <- "tmp/CELfiles" # path at local computer system (master)
## files <- list.files(path,full.names=TRUE)
## distList <- distributeFiles(CELfiles, protocol="RCP")
## eset <- rmaPara(distList$CELfiles)


###################################################
### chunk number 22: removeDistributedFiles eval=FALSE
###################################################
## removeDistributedFiles("/usr1/tmp/CELfiles")


###################################################
### chunk number 23: identical_bgc
###################################################
affybatch1 <- bg.correct(Dilution,
		method="rma") 
 affybatch2 <- bgCorrectPara(Dilution,
		method="rma")
identical(exprs(affybatch1),exprs(affybatch2))
all.equal(exprs(affybatch1),exprs(affybatch2))


###################################################
### chunk number 24: identical_loess eval=FALSE
###################################################
## set.seed(1234)
## affybatch1 <- normalize.AffyBatch.loess(Dilution)
## set.seed(1234)
## affybatch2 <- normalizeAffyBatchLoessPara(Dilution, verbose=TRUE) 
## identical(exprs(affybatch1),exprs(affybatch2))


###################################################
### chunk number 25: 
###################################################
stopCluster()