# Eklund_script02.txt # 2007-12-05 # Aron Charles Eklund # http://www.cbs.dtu.dk/suppl/biascorr/ # # Fig 5 (Freije glioma dendrogram) # # R 2.5.1 library(affy) library(bias) library(RColorBrewer) load('~/aron/chb/data/int/freije.u133a.batch.RData') ## this data set was saved in an older format; need to update freije.u133a.batch <- updateObject(freije.u133a.batch) freije.u133a.rma <- rma(freije.u133a.batch) freije.u133a.bm <- getBiasMetrics(freije.u133a.batch, freije.u133a.rma) ### set up matrix annotating replicates myPal <- brewer.pal(9, 'Set1') replication <- rep(NA, 85) replication[freije.u133a.rma$Linked == 2 & freije.u133a.rma$Details == 'Replicate'] <- myPal[1] replication[freije.u133a.rma$Linked == 3 & freije.u133a.rma$Details == 'Replicate'] <- myPal[2] myMat <- cbind(replication) ### generate dendrograms ## clustering using (1 - Pearson correlation) as distance metric pclust <- function(x) { if( inherits(x, 'ExpressionSet')) x <- exprs(x) hclust(as.dist(1 - cor(x))) } # Fig. 5a. untreated data freije.u133a.rma.pclust <- pclust(freije.u133a.rma) # Fig. 5b. bias-corrected data freije.u133a.rma.bc <- biasCorrection(freije.u133a.rma, freije.u133a.bm) freije.u133a.rma.bc.pclust <- pclust(freije.u133a.rma.bc) ### create plots pl01 <- function(x, figlabel, ...) { plotDendroCol(as.dendrogram(x), colMat = myMat, leaflab = 'none', colSize = 0.25, colGap = 0.1, xlim = c(3, 83), x.lab.adj = 1, colLab = 'replicate', ...) mtext(figlabel, adj = -0.06, font = 2, cex = 1.2) } pdf('Fig5.pdf', width = 12, height = 5) par(las = 1, mar = c(2, 6, 4, 2), mfrow = c(2,1), cex = 0.75) pl01(freije.u133a.rma.pclust, 'a') pl01(freije.u133a.rma.bc.pclust, 'b') dev.off() ###