download code
## Chunk 1
## library("affy")
## myAB = ReadAffy()
## Chunk 2
## myAB = ReadAffy(filenames=c("a1.cel", "a2.cel", "a3.cel"))
## Chunk 3
library("CLL")
data("CLLbatch")
CLLbatch 
## Chunk 4
sampleNames(CLLbatch)
## Chunk 5
data("disease")
head(disease)
## Chunk 6
rownames(disease) = disease$SampleID
## Chunk 7
sampleNames(CLLbatch) = sub("\\.CEL$", "", 
    sampleNames(CLLbatch))
## Chunk 8
mt = match(rownames(disease), sampleNames(CLLbatch))
## Chunk 9
vmd = data.frame(labelDescription = c("Sample ID",  
    "Disease status: progressive or stable disease"))
## Chunk 10
phenoData(CLLbatch) = new("AnnotatedDataFrame", 
    data = disease[mt, ], varMetadata = vmd)
## Chunk 11
CLLbatch = CLLbatch[, !is.na(CLLbatch$Disease)]
## Chunk 12
library("affyQCReport")
saqc = qc(CLLbatch)
## Chunk 13
plot(saqc)
## Chunk 14
dd = dist2(log2(exprs(CLLbatch)))
## Chunk 15
diag(dd) = 0
dd.row <- as.dendrogram(hclust(as.dist(dd)))
row.ord <- order.dendrogram(dd.row)
library("latticeExtra")
legend = list(top=list(fun=dendrogramGrob, 
    args=list(x=dd.row, side="top")))
lp = levelplot(dd[row.ord, row.ord], 
    scales=list(x=list(rot=90)), xlab="", 
    ylab="", legend=legend)
## Chunk 16
library("affyPLM")
dataPLM = fitPLM(CLLbatch)
## Chunk 17
boxplot(dataPLM, main="NUSE", ylim = c(0.95, 1.22),
    outline = FALSE, col="lightblue", las=3, 
    whisklty=0, staplelty=0)
## Chunk 18
Mbox(dataPLM, main="RLE", ylim = c(-0.4, 0.4), 
    outline = FALSE, col="mistyrose", las=3, 
    whisklty=0, staplelty=0)
## Chunk 19
badArray = match("CLL1", sampleNames(CLLbatch))
CLLB = CLLbatch[, -badArray]
  (solution chunk)
## Chunk 21
CLLrma = rma(CLLB)
## Chunk 22
e = exprs(CLLrma)
dim(e)
dim(CLLrma)
  (solution chunk)
## Chunk 24
pData(CLLrma)[1:3,]
## Chunk 25
table(CLLrma$Disease)
## Chunk 26
CLLf = nsFilter(CLLrma, remove.dupEntrez=FALSE, 
    var.cutof =0.5)$eset
## Chunk 27
CLLtt = rowttests(CLLf, "Disease")
names(CLLtt)
## Chunk 28
a = rowMeans(exprs(CLLf))
  (solution chunk)
## Chunk 30
library("limma") 
design = model.matrix(~CLLf$Disease) 
CLLlim = lmFit(CLLf, design)
CLLeb = eBayes(CLLlim) 
  (solution chunk)
## Chunk 32
lod = -log10(CLLtt$p.value)
plot(CLLtt$dm, lod, pch=".", xlab="log-ratio", 
    ylab=expression(-log[10]~p))
abline(h=2)
  (solution chunk)
  (solution chunk)
  (solution chunk)
## Chunk 36
tab = topTable(CLLeb, coef=2, adjust.method="BH", n=10)
genenames = as.character(tab$ID)
## Chunk 37
library("annotate")
## Chunk 38
annotation(CLLf)
library("hgu95av2.db")
## Chunk 39
ll = getEG(genenames, "hgu95av2")
sym = getSYMBOL(genenames, "hgu95av2")
## Chunk 40
tab = data.frame(sym, signif(tab[,-1], 3))
htmlpage(list(ll), othernames=tab, 
    filename="GeneList1.html",
    title="HTML report", table.center=TRUE,
    table.head=c("Entrez ID",colnames(tab)))
## Chunk 41
browseURL("GeneList1.html")
## Chunk 42
library("KEGG.db")
library("annaffy") 
atab = aafTableAnn(genenames, "hgu95av2.db", aaf.handler()) 
saveHTML(atab, file="GeneList2.html") 
## Chunk 43
atab = aafTableAnn(genenames, "hgu95av2.db", 
    aaf.handler()[c(2,5,8,12)])
saveHTML(atab, file="GeneList3.html")
## Chunk 44
pms = pm(CLLB)
mms = mm(CLLB)
  (solution chunk)
  (solution chunk)
  (solution chunk)
## Chunk 48
bgrma = bg.correct.rma(CLLB)
exprs(bgrma) = log2(exprs(bgrma))
## Chunk 49
library("vsn")
bgvsn = justvsn(CLLB)
  (solution chunk)
  (solution chunk)
  (solution chunk)
## Chunk 53
CLLvsn = vsnrma(CLLB)
## Chunk 54
CLLvsnf = nsFilter(CLLvsn, remove.dupEntrez=FALSE, 
    var.cutoff=0.5)$eset
CLLvsntt = rowttests(CLLvsnf, "Disease")
  (solution chunk)
  (solution chunk)
## Chunk 57
pns = probeNames(CLLB)
indices = split(seq(along=pns), pns)
## Chunk 58
length(indices)
indices[["189_s_at"]]
  (solution chunk)
## Chunk 60
newsummary = t(sapply(indices, function(j) 
    rowMedians(t(pms[j,]-mms[j,]))))
dim(newsummary)
  (solution chunk)