简体   繁体   中英

Compute and plot bootstrap values with ggtree

I have a file with the phylogenetic tree that is the output of doing RAxML. I want to plot this tree with the R package ggtree and show the bootstrap values and the internal numbers of the nodes.

The actual code plots the tree with the node numbers, but I don't know if I have to calculate the bootstrap values or get them from the RAxML file. If I have to calculate them, how can I do it? I have searched for ape package functions but I can't find anything.

treeR <- treeio::read.tree("RAxML_bipartitionsBranchLabels.tre")
treeplot <- function(tree, x){
  ggtree(tree) + 
    geom_tiplab(align=TRUE, size=3, color='#609ECF', linesize=.5) + 
    hexpand(.3) +
    labs(title = x) +
    # geom_text(aes(label=bootstrap), hjust=-.25, size = 3) +
    geom_text2(aes(subset=!isTip, label=node), # subset=!isTip
               size = 3.5,
               color = "#0063B1",
               hjust = 1, 
               vjust = -1.5
               ) 
}

treeplot(treeR, "Phylogenetic tree")

RAxML file: https://drive.google.com/drive/folders/1KcOnFWUcLetkDj5Q9Y2KQaSHdsQf2isR?usp=sharing

Your script looks ok, the only thing is that you should read the tree using the read.raxml function

https://rdrr.io/bioc/treeio/man/read.raxml.html

This should reveal your bootstrap values

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM