data(khan)
## Change color scheme
heatplot(khan$train[1:30,])
heatplot(khan$train[1:30,], cols.default=FALSE, lowcol="white", highcol="red")
## Add labels to rows, columns
heatplot(khan$train[1:26,], labCol = c(64:1), labRow=LETTERS[1:26])
## Add a color bar
heatplot(khan$train[1:26,], classvec=khan$train.classes)
heatplot(khan$train[1:26,], classvec=khan$train.classes, classvecCol=c("magenta", "yellow", "cyan", "orange"))
## Change the scaling to the older made4 version (pre Bioconductor 2.5)
heatplot(khan$train[1:26,], classvec=khan$train.classes, dualScale=FALSE, scale="row")
## Getting the members of a cluster and manuipulating the tree
sTree<-heatplot(khan$train, classvec=khan$train.classes, returnSampleTree=TRUE)
class(sTree)
plot(sTree)
## Cut the tree at the height=1.0
lapply(cut(sTree,h=1)$lower, labels)
## Zoom in on the first cluster
plot(cut(sTree,1)$lower[[1]])
str(cut(sTree,1.0)$lower[[1]])
## Visualizing results from an ordination using heatplot
if (require(ade4, quiet = TRUE)) {
res<-ord(khan$train, ord.nf=5) # save 5 components from correspondence analysis
khan.coa = res$ord
}
# Provides a view of the components of the Correspondence analysis (gene projection)
heatplot(khan.coa$li, dend="row", dualScale=FALSE) # first 5 components, do not cluster columns, only rows.
# Provides a view of the components of the Correspondence analysis (sample projection)
# The difference between tissues and cell line samples are defined in the first axis.
heatplot(khan.coa$co, margins=c(4,20), dend="row") # Change the margin size. The default is c(5,5)
# Add a colorbar, change the heatmap color scheme and no scaling of data
heatplot(khan.coa$co,classvec2=khan$train.classes, cols.default=FALSE, lowcol="blue", dend="row", dualScale=FALSE)
apply(khan.coa$co,2, range)
Run the code above in your browser using DataLab