How do I annotate a tree with boostrap scores and color code clades in ggtree?
1
0
Entering edit mode
4.8 years ago
Namenlos • 0

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?

R bootstrap ggtree phylogenetics • 4.6k views
ADD COMMENT
1
Entering edit mode
4.7 years ago
Guangchuang Yu ★ 2.6k

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 COMMENT

Login before adding your answer.

Traffic: 2592 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