This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Heatmap.2 dendrogram generation

I used heatmap.2 in R, to create a heatmap. I used the following command :

heatmap.2(as.matrix(mat_data), density.info="none", trace="none", margins =c(12,9), col=my_palette, breaks=seq(96,100,0.5), dendrogram="both")

What is the method used by the heatmap.2 for dendrogram generation? Is it hclust()? If so, what metric (euclidean or manhattan distance) does it use for default, since I have used default parameters in the above command.

heatmap.2 r hclust

Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.
code_formatting

1 answer

Please read the manual well. It says

... dendrograms are computed as dd <- as.dendrogram(hclustfun(distfun(X))) where X is either x or t(x).

where distful defaults to stats::dist and hclustfun defaults to stats::hclust.

Iam sorry, but again what is the metric used by hclust() to find distance as we pass the function from distfun(). Is there any default metric ?

To get to that, you’ll either need to ask the developer or look into the source code for all instances of hclustfun being used. I’d recommend doing both - the latter approach is great as a learning method.

Log in to answer this question.