【问题标题】:R ggtree annotate node in accordance with branch lengthR ggtree 根据分支长度注释节点
【发布时间】:2021-10-11 00:40:19
【问题描述】:

我有一个由 Newick 文件制作的系统发育树。

library(tidyverse)
library(ggtree)

tree <- read.tree("newick_test.nwk")

p1 <- ggtree(tree) + geom_tree() + theme_tree2() + coord_cartesian(xlim = c(0,40), ylim = c(0,19))

Newick 文件是

(((15L55MS_1001A7:32411,(15LSRMS_5001H4:94544,15R36Fb_5001F1:16481):15:0):9,(15L49Fb_2001E2:3430,15R126Fb_1001B4:10443):10:0):5,((15LNMS_2001H5:4859,15C9Fb_6001E2:18771):10:0,(15L36Fb_001A6:5646,(15R76Fb_6001A8:11866,15L21Fb_1001D4:11563):14:0):12:0):7):0;

输出树是这样的。

我想像这样注释节点。 (根据枝长)

【问题讨论】:

    标签: r annotations phylogeny ggtree


    【解决方案1】:

    您可以尝试使用geom_text2添加分支长度信息。

    library(ggtree)
    
    tree <- read.tree(text = "(((15L55MS_1001A7:32411,(15LSRMS_5001H4:94544,15R36Fb_5001F1:16481):15:0):9,(15L49Fb_2001E2:3430,15R126Fb_1001B4:10443):10:0):5,((15LNMS_2001H5:4859,15C9Fb_6001E2:18771):10:0,(15L36Fb_001A6:5646,(15R76Fb_6001A8:11866,15L21Fb_1001D4:11563):14:0):12:0):7):0;")
    
    ggtree(tree) + 
      geom_tree() + 
      theme_tree2() + 
      coord_cartesian(xlim = c(0, 40), ylim = c(0, 19)) +
      geom_text2(aes(label = branch.length), hjust = -.3)
    

    情节

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-24
      • 2018-05-05
      • 2020-09-09
      • 2020-06-27
      • 1970-01-01
      • 1970-01-01
      • 2010-09-07
      • 1970-01-01
      相关资源
      最近更新 更多