### R code from vignette source 'ABSSeq.Rnw'

###################################################
### code chunk number 1: ABSSeq.Rnw:27-28
###################################################
library(ABSSeq)


###################################################
### code chunk number 2: ABSSeq.Rnw:33-35
###################################################
data(simuN5)
names(simuN5)


###################################################
### code chunk number 3: ABSSeq.Rnw:40-41
###################################################
simuN5$groups


###################################################
### code chunk number 4: ABSSeq.Rnw:46-47
###################################################
conditions <- factor(c(rep(1,5),rep(2,5)))


###################################################
### code chunk number 5: ABSSeq.Rnw:52-54
###################################################
obj <- ABSDataSet(simuN5$counts, factor(simuN5$groups))
obj1 <- ABSDataSet(simuN5$counts, conditions)


###################################################
### code chunk number 6: ABSSeq.Rnw:59-63
###################################################
obj1 <- ABSDataSet(simuN5$counts, factor(simuN5$groups),normMethod="user",sizeFactor=runif(10,1,2))
normMethod(obj1)
normMethod(obj1) <- "geometric"
normMethod(obj1)


###################################################
### code chunk number 7: ABSSeq.Rnw:68-70
###################################################
  obj=normalFactors(obj)
  sFactors(obj)


###################################################
### code chunk number 8: ABSSeq.Rnw:75-76
###################################################
  head(counts(obj,norm=TRUE))


###################################################
### code chunk number 9: ABSSeq.Rnw:81-82
###################################################
  obj=callParameter(obj)


###################################################
### code chunk number 10: plotDifftoBase
###################################################
plotDifftoBase(obj)


###################################################
### code chunk number 11: plotDifftoBase
###################################################
plotDifftoBase(obj)


###################################################
### code chunk number 12: ABSSeq.Rnw:103-105
###################################################
obj <- callDEs(obj)
head(results(obj,c("rawFC","lowFC","foldChange","pvalue","adj.pvalue")))


###################################################
### code chunk number 13: ABSSeq.Rnw:110-111
###################################################
head(results(obj))


###################################################
### code chunk number 14: ABSSeq.Rnw:116-121
###################################################
data(simuN5)
obj <- ABSDataSet(simuN5$counts, factor(simuN5$groups))
obj <- ABSSeq(obj)
res=results(obj,c("Amean","Bmean","foldChange","pvalue","adj.pvalue"))
head(res)


###################################################
### code chunk number 15: ABSSeq.Rnw:126-134
###################################################
data(simuN5)
obj <- ABSDataSet(simuN5$counts, factor(simuN5$groups),minRates=0.2, maxRates=0.2)
#or by slot functions
#minRates(obj) <- 0.2
#maxRates(obj) <- 0.2
obj <- ABSSeq(obj)
res=results(obj,c("Amean","Bmean","foldChange","pvalue","adj.pvalue"))
head(res)


###################################################
### code chunk number 16: ABSSeq.Rnw:138-145
###################################################
data(simuN5)
obj <- ABSDataSet(simuN5$counts, factor(simuN5$groups),minDispersion=0.1)
#or by slot functions
#minimalDispersion(obj) <- 0.2
obj <- ABSSeq(obj)
res=results(obj,c("Amean","Bmean","foldChange","pvalue","adj.pvalue"))
head(res)


###################################################
### code chunk number 17: ABSSeq.Rnw:150-155
###################################################
data(simuN5)
obj <- ABSDataSet(simuN5$counts[,c(1,2)], factor(c(1,2)))
obj <- ABSSeq(obj)
res=results(obj,c("Amean","Bmean","foldChange","pvalue","adj.pvalue"))
head(res)