###################################################
### chunk number 1: 
###################################################
library(sscore)
options(width=60)
library(affydata)


###################################################
### chunk number 2: 
###################################################
data(Dilution)  ## get the example data
## get the path to the package directory
pathname <- system.file("doc",package="sscore")
cel <- Dilution[,c(1,3)] 
## only need the first 2 samples per condition
SScore.basic <- SScore(cel,celfile.path=pathname,
SF=c(4.46,5.72),SDT=c(57.241,63.581),rm.extra=FALSE)


###################################################
### chunk number 3: 
###################################################
exprs(SScore.basic)[1:20]


###################################################
### chunk number 4: 
###################################################
labels <- c(0,0,0,1,1,1)


###################################################
### chunk number 5: 
###################################################
data(Dilution)
pathname <- system.file("doc",package="sscore")
cel <- Dilution
SScore.multi <- SScore(cel,classlabel=c(0,0,1,1),
SF=c(4.46,6.32,5.72,9.22),SDT=c(57.241,53.995,63.581,
69.636),celfile.path=pathname,rm.extra=FALSE)


###################################################
### chunk number 6: 
###################################################
exprs(SScore.multi)[1:20]


###################################################
### chunk number 7: 
###################################################
data(Dilution)
pathname <- system.file("doc",package="sscore")
compare <- matrix(c(1,2,1,3,1,4),ncol=2,byrow=TRUE)
SScoreBatch.basic <- SScoreBatch(Dilution,compare=compare,
SF=c(4.46,6.32,5.72,9.22),SDT=c(57.241,53.995,63.58,169.636),
celfile.path=pathname,rm.extra=FALSE)


###################################################
### chunk number 8: 
###################################################
exprs(SScoreBatch.basic)[1:10,] 


###################################################
### chunk number 9: 
###################################################
sscores <- exprs(SScore.basic) ## extract the S-Score values
## find those greater than 3 SD
signif <- geneNames(Dilution)[abs(sscores) >= 3]


###################################################
### chunk number 10: 
###################################################
sscores <- exprs(SScore.basic) ## extract the S-Score values
p.values.1 <- 1 - pnorm(abs(sscores)) ## find the corresponding
                        ## one-sided p-values
p.values.2 <- 2*(1 - pnorm(abs(sscores))) ## find the corresponding
                        ## two-sided p-values