Heat map for bootstrapped dendrogram

172 views
Skip to first unread message

ecwa...@ncsu.edu

unread,
Sep 12, 2016, 4:26:56 PM9/12/16
to poppr
I have a general question: Is it possible to generate a heat map from a distance matrix with bootstrap support? The "bruvo.boot" function, for example, generates a tree of this type of distance, but is there not a numeric matrix associated with this tree that can be used to generate the heat map? Thank you for your help. 

Zhian Kamvar

unread,
Sep 13, 2016, 12:40:41 PM9/13/16
to ecwa...@ncsu.edu, poppr
Hi,

To generate a heat map, you do not need to perform bootstrap analysis. You can use the heatmap function on the distance matrix from bruvo.dist.

If you want to add a heat map to your tree, a way to do this would be to use the ggtree package from Bioconductor (here's a demonstration: https://bioconductor.org/packages/devel/bioc/vignettes/ggtree/inst/doc/advanceTreeAnnotation.html). 

You can calculate the matrix with bruvo.dist().

here's how you would set up your data:

library(poppr)
library(ggtree)
myTree <- bruvo.boot(myData, replen = myReplen)
myTree <- apeBoot(myTree, myTree$node.labels)
myDist  <- bruvo.dist(myData, replen = myReplen) %>% as.matrix()

Then you can use ggtree and gheatmap to make your figure.

Hope that helps,
Zhian

On Sep 12, 2016, at 12:57 , ecwa...@ncsu.edu wrote:

I have a general question: Is it possible to generate a heat map from a distance matrix with bootstrap support? The "bruvo.boot" function, for example, generates a tree of this type of distance, but is there not a numeric matrix associated with this tree that can be used to generate the heat map? Thank you for your help. 

--
You received this message because you are subscribed to the Google Groups "poppr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to poppr+un...@googlegroups.com.
To post to this group, send email to po...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/poppr/1dd85ef0-ef0f-409e-a7a0-1d05e8f182e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ecwa...@ncsu.edu

unread,
Sep 16, 2016, 12:38:43 PM9/16/16
to poppr, ecwa...@ncsu.edu
Thank you very much for your quick response! I appreciate your help.

There is a recent publication that includes a heat map for Bruvo's genetic distance between isolates plotted along with neighbor joining trees with bootstrap support (Figure 4). 

http://www.sciencedirect.com/science/article/pii/S1754504815001270

I am able to generate a heat map with bruvo.dist and a nj tree with bruvo.dist and with bruvo.boot, but I cannot generate a heat map with these trees, specifically. Is this possible? Perhaps I am not understanding the figure correctly?

The root of my question comes down to not knowing much about the "dendrogram"  generated along with the heat map for bruvo.dist, and how it is different than a nj tree.

Any clarification on this topic or direction to appropriate literature would be helpful. Thank you very much!

Zhian Kamvar

unread,
Sep 16, 2016, 12:46:38 PM9/16/16
to ecwa...@ncsu.edu, poppr
Hello,

It is possible. You just have to get comfortable with playing around with options for the heat map function :)

A quick google search of "heatmap with tree in R" revealed this:

I believe that should answer your question.

Additionally, I would like to point out a couple of things:
1) For coloring your heatmap, the viridis color scheme (https://cran.r-project.org/web/packages/viridis/index.html) is empirically the best for being perceptually uniform.
2) You might want to consider using the default UPGMA tree when constructing your figure since the much of the valuable information in the NJ branch lengths is lost if you extend them to the edges of the heatmap.

Hope that helps!
Zhian

ecwa...@ncsu.edu

unread,
Sep 19, 2016, 1:44:39 PM9/19/16
to poppr, ecwa...@ncsu.edu
Thank you so much for directing me to this thread. I really appreciate it- very helpful! 
Reply all
Reply to author
Forward
0 new messages