Good morning,
I am using below code to create an heatmap:
f0<-pheatmap(my_signature, annotation_col=annot_cols,cluster_rows=F,cluster_cols=T,show_colnames=F,main="My test)
f0
Even though I specify "cluster_cols=TRUE" it does not cluster all column (which are similar) together.
Can anyone explain me this behaviour? Am I doing anyting incorrect?
Thank you!
Thank you very much for your reply.
Yes, gene counts with 5 different metadata.
Sorry for not being clear. I meant that i expected that the columns on the left and on the right should cluster together. And then the ones in pale blue next to it...
I guess you are talking about the chunk of 3 columns together on the left side and the chunk of 6 columns together on the right side. Your genes expression look quite different between the 2 chunks, so maybe the right chunk is cluster from the pale blue chunk than the left chunk.
You can change the
clustering_method
parameter if you think another method would better fit your data. You have multiple choice described here.Great, thanks a lot for the explanation and info!
Perhaps you are overlooking that in a dendrogram you can rotate branches without changing the structure of the tree. If you rotate the branch containing the central big cluster and the cluster on the right with 6 columns, then you have the "left" and "right" cluster visually close to each other without changing anything in the underlying tree. If I'm not mistaken, base R rotates branches to have them in alphabetical order (or something like that). Often it is visually more useful to have them ordered by branch length. Check the ladderize function in dendextend package. In other words, if my guess of what you want is correct, your dendrogram is already the way you expect it, it's just not plotted the way you want.
Great, thanks a lot, I will check that.