Question: How do I annotate a tree with boostrap scores and color code clades in ggtree?
0
gravatar for Namenlos
14 months ago by
Namenlos0
Namenlos0 wrote:

I want to annotate a phylogenetic tree with bootstrap and add color to certain clades in ggtree. Something goes wrong when I try to do both, which has something to do with the indices of the internal nodes.

Here is a random tree with 24 tips:

 library(ape)
 set.seed(123)
 rtree <- rtree(24)

The following identifies the nodes to which I want to assign different colors:

rtree.clade <- groupClade(rtree, c(44, 37, 29))

These are the bootstrap scores:

rtree.bs <- c(1000,  918,  966,  997,  661,  631,  711, 1000,  980,  991,  999,  998, 1000, 1000,  990, 1000,  980, 1000, 
899, 755, 654, 908, 334)

In the following two trees, the bootstrap scores do not show up on the same nodes:

#Tree with color added to clades
library(ggtree)
ggtree(rtree.clade, aes(color = group)) +
geom_tiplab() +
geom_nodelab(label = rtree.bs,
           geom = 'label')
#Tree with no color
ggtree(rtree.clade) +
geom_tiplab() +
geom_nodelab(label = rtree.bs,
           geom = 'label')

In the tree without color, the bootstrap scores have been assigned to the correct nodes. It is the tree with color that is incorrect. What am I doing wrong?

ggtree bootstrap phylogenetics R • 1.2k views
ADD COMMENTlink modified 13 months ago by Guangchuang Yu2.3k • written 14 months ago by Namenlos0
1
gravatar for Guangchuang Yu
13 months ago by
Guangchuang Yu2.3k
China/Guangzhou/Southern Medical University
Guangchuang Yu2.3k wrote:

see an example in https://yulab-smu.github.io/treedata-book/chapter2.html#data-integration for integrating bootstrap value.

For data integration, we have published a paper, https://academic.oup.com/mbe/article/35/12/3041/5142656, with lots of examples in the supplemental files.

ADD COMMENTlink written 13 months ago by Guangchuang Yu2.3k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 707 users visited in the last hour