[BioC] tweaks for the heatmap ()?

Florian Hahne fhahne at fhcrc.org
Thu Nov 8 19:03:11 CET 2007


Simon Lin wrote:
> I am looking for two tweaks of the heatmap function:
> 1) a choice to order the genes by 1-D MDS projection. The current 
> hierarchical clustering flips many nodes.
> 2) a color bar at the side to indicate the color scale, as with maColorBar() 
> in the marray package
>
> Any code to share?
>
> Thanks!
>
> Simon
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>   
Hi Simon,
you might want to take a look at the levelplot function in the lattice 
package. The following code snippet emulates what  heatmap does with a 
colorbar added to the plot:

myHeatmap = function(x) {
  dd.row = as.dendrogram(hclust(dist(x)))
  row.ord = order.dendrogram(dd.row)
 
  dd.col = as.dendrogram(hclust(dist(t(x))))
  col.ord = order.dendrogram(dd.col)

  levelplot(x[row.ord,col.ord],  scales = list(x = list(rot = 90)),
    xlab="", ylab="", main="whatever the title is"
    col.regions=colorRampPalette(c("white", "darkblue"))(256))
}

You can use any ordering of the rows and column by modifying the 
assignments to row.ord and col.ord

BW,
Florian



More information about the Bioconductor mailing list