data(khan)
logkhan<-log2(khan$train)
# Get a character vector which defines which khan samples are cell lines or tissue sample
khanAnnot= cbind(as.character(khan$train.classes),khan$cellType)
print(khanAnnot[1:3,])
# Add 2 color bar, one for cancer subtype, another for cell type under dendrogram
prettyDend(logkhan, classvec=khanAnnot, covars = c(1,2), labels=khan$train.classes)
# To change the palette of colors
# Use topo.colors(), see colors() for more help on inbuilt palettes
prettyDend(logkhan, classvec=khanAnnot, covars = c(1,2), labels=khan$train.classes, getPalette=topo.colors)
# To use RColorBrewer Palettes
library(RColorBrewer)
# Use RColorBrewer Dark2 which contains 8 colors
prettyDend(logkhan, classvec=khanAnnot, covars = c(1,2), labels=khan$train.classes, getPalette=function(x) brewer.pal(8,"Dark2")[1:x])
# Use RColorBrewer Set1 which contains 9 colors
prettyDend(logkhan, classvec=khanAnnot, covars = c(1,2), labels=khan$train.classes, getPalette=function(x) brewer.pal(9,"Set1")[1:x])
Run the code above in your browser using DataLab