查看原文
其他

Y叔 2018-06-04

这是比较早期的文章,介绍了操作符%<%,这是我的小玩具,可以把画出来的图,当成模版,去画另一颗树。

I am very exciting that I have received very positive feedback from Ahmed Moustafa and Simon Frost.


ggtree now has equipped with a lot of new features. This time, I would like to introduce the replace operator, %<%. Suppose we have build a tree view using ggtree with multiple layers, we don’t need to run the code again to build a new tree view with another tree. In ggtree, we provides an operator, %<%, for updating tree view.

library(ggplot2)
library(ggtree) ggtree(rtree(15)) %<% rtree(30)

It supports different layout.

ggtree(rtree(15), layout="unrooted", ladderize=FALSE) %<% rtree(45)


It is chainable.

ggtree(rtree(15), layout="cladogram", ladderize=FALSE) %<%    rtree(30) %<%       rtree(45)

It also supports multiple layers.

(ggtree(rtree(15), layout="fan") +    geom_point(aes(shape=isTip, color=isTip))) %<%      rtree(40)

In the final example, we parse rst file from BaseML output and annotate the tree with marginal_AA_subs.

rstfile <- system.file("extdata/PAML_Baseml", "rst", package="ggtree") tipfas <- system.file("extdata", "pa.fas", package="ggtree") rst <- read.paml_rst(rstfile, tipfas) p <- plot(rst, annotation="marginal_AA_subs", annotation.color="steelblue") print(p)


We have ancestral sequences inferred from CodeML with the same tree. We can use this new data to update the tree view.

rstfile <- system.file("extdata/PAML_Codeml", "rst", package="ggtree") rst <- read.paml_rst(rstfile, tipfas) p %<% rst


In these two figures, we can found that they have different evolution distances, and substitutions inferred from BASEML and CODEML are slightly different.


赞赏

    您可能也对以下帖子感兴趣

    文章有问题?点此查看未经处理的缓存