###################################################
### chunk number 1: 
###################################################
library("hgug4112a.db")


###################################################
### chunk number 2: data
###################################################
library("Agi4x44PreProcess")
data(targets)
targets


###################################################
### chunk number 3: data
###################################################
data(dd) 
class(dd)
dim(dd)


###################################################
### chunk number 4: 
###################################################
names(dd)


###################################################
### chunk number 5: BoxPlot1
###################################################
BoxPlot(log2(dd$R),"ProcessedSignal", "red",
xlab="Samples", ylab="expression")


###################################################
### chunk number 6: plotDensity1
###################################################
plotDensity(log2(dd$R),"ProcessedSignal")


###################################################
### chunk number 7: BoxPlot2
###################################################
BoxPlot(log2(dd$G),"MeanSignal", "green",
xlab="Samples", ylab="expression")


###################################################
### chunk number 8: plotDensity2
###################################################
plotDensity(log2(dd$G),"MeanSignal")


###################################################
### chunk number 9: BoxPlot3
###################################################
BoxPlot(log2(dd$Gb),"BGUsed", "orange",
xlab="Samples", ylab="expression")


###################################################
### chunk number 10: BoxPlot4
###################################################
BoxPlot(log2(dd$Rb),"BGMedianSignal", "blue",
xlab="Samples", ylab="expression")


###################################################
### chunk number 11: CV.rep.probes
###################################################
CV.rep.probes(dd,"hgug4112a.db",
               	foreground="MeanSignal", raw.data=TRUE,
		writeR=FALSE, targets)


###################################################
### chunk number 12: genes.rpt.agi
###################################################
genes.rpt.agi(dd,"hgug4112a.db",raw.data=TRUE,
               WRITE.html=FALSE,REPORT=FALSE)


###################################################
### chunk number 13: BGandNorm
###################################################
ddNORM=BGandNorm(dd,BGmethod="half",NORMmethod="quantile",
                 foreground="MeanSignal",background="BGMedianSignal",
                 offset=50,makePLOTpre=FALSE,makePLOTpost=FALSE)


###################################################
### chunk number 14: filter.probes
###################################################
ddFILT=filter.probes(ddNORM,
                control=TRUE,
                wellaboveBG=TRUE,
                isfound=TRUE,
                wellaboveNEG=TRUE,
                sat=TRUE,
                PopnOL=TRUE,
                NonUnifOL=T,
                nas=TRUE,
                limWellAbove=75,
                limISF=75,
                limNEG=75,
                limSAT=75,
                limPopnOL=75,
                limNonUnifOL=75,
                limNAS=100,
                makePLOT=F,annotation.package="hgug4112a.db",flag.counts=T,targets)


###################################################
### chunk number 15: 
###################################################
dim(ddFILT)


###################################################
### chunk number 16: summarize.probe
###################################################
ddPROC=summarize.probe(ddFILT, makePLOT=FALSE, targets)


###################################################
### chunk number 17: build.eset
###################################################
esetPROC=build.eset(ddPROC, targets, makePLOT=FALSE,
                annotation.package="hgug4112a.db")


###################################################
### chunk number 18: BoxPlot eval=FALSE
###################################################
## BoxPlot(log2(dd$G),"MeanSignal","green",
## xlab="Samples",ylab="expression")


###################################################
### chunk number 19: boxplotNegCtrl
###################################################
boxplotNegCtrl(dd,Log2=FALSE, channel="G")


###################################################
### chunk number 20: plotDensity eval=FALSE
###################################################
## plotDensity(log2(dd$G),"Density Plot example")


###################################################
### chunk number 21: MVAplotMEDctrl eval=FALSE
###################################################
## 
## par(mfrow=c(2,2),ask=TRUE)	
## MVAplotMEDctrl(dd,"MVA example",channel="G")


###################################################
### chunk number 22: MVAplotMED eval=FALSE
###################################################
## par(mfrow=c(2,2))
## MVAplotMED(dd$G,"red","MVA example")


###################################################
### chunk number 23: RLE
###################################################
par(mfrow=c(1,1))	
RLE(log2(dd$G),"RLE example ","orange")



###################################################
### chunk number 24: HeatMap
###################################################
HeatMap(exprs(esetPROC),size=100,"100 High Var genes")


###################################################
### chunk number 25: hierclus
###################################################

data(targets)
GErep=targets$Gerep 
hierclus(exprs(esetPROC),GErep,methdis="euclidean",
        methclu="complete",sel=FALSE,size = 100)



###################################################
### chunk number 26: PCAplot eval=FALSE
###################################################
## 
## data(targets)
## PCAplot(esetPROC,targets)