| | 27 | |
| | 28 | # Data quality assessment by sample clustering and visualisation (optional) |
| | 29 | library(gplots) |
| | 30 | library("RColorBrewer") |
| | 31 | #re-estimate dispersion with method "blind" to ensure analysis is unbiased. |
| | 32 | cdsFullBlind=estimateDispersions(cds, method="blind") |
| | 33 | #vst needed for PCA and heatmap |
| | 34 | vsd=varianceStabilizingTransformation(cdsFullBlind) |
| | 35 | |
| | 36 | #do heatmap |
| | 37 | dists=dist(t(exprs(vsd))) |
| | 38 | mat=as.matrix(dists) |
| | 39 | rownames(mat) = colnames(mat) = with(pData(cds), paste(groups, sep=" : ")) |
| | 40 | hmcol = colorRampPalette(brewer.pal(9, "GnBu"))(100) |
| | 41 | heatmap.2(mat, trace="none", col = rev(hmcol), margin=c(13, 13)) |
| | 42 | |
| | 43 | #do PCA |
| | 44 | print(plotPCA(vsd, intgroup=c("condition"))) |
| | 45 | |