an example of drawing beast tree using ggtree

快来打我* 2022-08-05 13:11 210阅读 0赞

(This article was first published on YGC » R, and kindly contributed to R-bloggers)

FigTree is designed for viewing beast output as demonstrated by their example data:
Screenshot_202015-03-10_2018.15.57.png

BEAST output is well supported by ggtree and it’s easy to reproduce such a tree view. ggtree supports parsing beast output by read.beast function. We can visualize the tree directly by using ggtree function. Since this is a time scale tree, we can set the parameter time_scale = TRUE and ggtree will parse the time and use it as branch length.

? RSPLUS








  1. 1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
  1. require(ggplot2)
    require(ggtree)
    x <- read.beast(“/Applications/FigTree/influenza.tree)
    cols <- scale_color(x, by=height)
    ggtree(x, right=TRUE, time_scale=TRUE, color=cols) + theme_tree2() +
    geom_text(aes(x=max(x), label=label), size=1, color=cols, hjust=-.3) +
    scale_x_continuous(breaks=c(1992, 1995, 1997, 2000, 2002, 2005), minor_breaks=seq(1992, 2005, 1)) +
    geom_segment(aes(xend=max(x)+.20, yend=y), linetype=dotted, size=.1, color=cols) +
    theme(panel.grid.major = element_line(color=black, size=.2),
    panel.grid.minor = element_line(color=grey, size=.2),
    panel.grid.major.y = element_blank(),
    panel.grid.minor.y = element_blank())

Screenshot_202015-03-10_2018.16.14.png

  • January 19, 2015 — ggtree in Bioconductor 3.1 (15)
  • February 10, 2015 — [ggtree] updating a tree view using %<% operator (0)
  • December 21, 2014 — viewing and annotating phylogenetic tree with ggtree (5)
  • April 30, 2014 — visualization methods in ChIPseeker (8)
  • March 27, 2011 — clusterProfiler in Bioconductor 2.8 (1)

发表评论

表情:
评论列表 (有 0 条评论,210人围观)

还没有评论,来说两句吧...

相关阅读