Question: Heatmaps in BHC package
0
4.8 years ago by
b.curran0
New Zealand
b.curran0 wrote:

Quick, probably simple question that I can't find the answer to.

I'm using the BHC package. The paper associated with the package says that in addition to displaying the results as a dendrogram, it is possible to display the resulats as a heatmap using the package R heatmap command. It doesn't (that I can see), say how. Any attempt to put the dendrogram straight into heatmap, very rightly returns an error suggesting that x should be a  numeric matrix. And if you search for information on dendrograms and heatmaps all the results are dominated by how to attach dendrograms to the side of your heatmap rather than generate one from a dendrogram. Which would be odd anyway, so I believe I am missing something somewhere in the bhc package. Anyone know what I'm doing?

In this case, candidates is a list of gene names that I am extracting from a larger frame of all genes.  Plotting the dendrogram works fine.

rawCounts = read.table( datafile,sep=",", header=TRUE,row.names=1 , stringsAsFactors = FALSE )

counts<-rawCounts[candidates,]   timePoints <- 1:2 # for the time-course case

hc2 <- bhc(counts, candidates, 0, timePoints, "time-course", numReps=1, noiseMode=0, numThreads=10, verbose=TRUE)

heatmap(hc2)

Error in heatmap(hc2) : 'x' must be a numeric matrix

Cheers

Ben.

bhc • 657 views
modified 4.5 years ago by Rich Savage60 • written 4.8 years ago by b.curran0
0
4.5 years ago by
Rich Savage60
University of Warwick, UK
Rich Savage60 wrote:

Try something like the following:

hc3 <- bhc(discreteData, rowLabels, verbose = T)

hc2 <- bhc(t(discreteData), colLabels, verbose = T)

heatmap.2(discreteData, trace="none", hclustfun = function(x) hclust(x,"ave"),col=redgreen(100),breaks=colors,Rowv = hc2,Colv=hc3)