Heatmaps in BHC package
1
0
Entering edit mode
b.curran • 0
@bcurran-6988
Last seen 8 months ago
New Zealand

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 • 1.2k views
ADD COMMENT
0
Entering edit mode
Rich Savage ▴ 60
@rich-savage-3040
Last seen 8.6 years ago
University of Warwick, UK

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)

ADD COMMENT

Login before adding your answer.

Traffic: 553 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6