系统发育树猿太小

Phylogenetic tree ape too small

我正在使用来自 NCBI 分类学的数据构建系统发育树。这棵树很简单,它的目的是展示几种节肢动物之间的关系。 问题是这棵树看起来很小,我似乎不能把它的树枝拉长。我还想给一些节点上色(例如:Pancrustaceans),但我不知道如何使用猿来做到这一点。 感谢您的帮助!

library(treeio)
library(ape)
treeText <- readLines('phyliptree.phy')
treeText <- paste0(treeText, collapse="")

tree <- read.tree(text = treeText) ## load tree 
distMat <- cophenetic(tree) ## generate dist matrix

plot(tree, use.edge.length = TRUE,show.node.label = T, edge.width = 2, label.offset = 0.75, type = "cladogram",  cex = 1, lwd=2)

这里有一些使用 ape 包的提示。我正在使用随机树,因为我们无法访问您的树,但这些示例应该很容易适应您的问题。如果您提供了特定问题的可重现示例,我可以再看一下。

首先我做了一棵随机树,添加了一些物种名称,并绘制它以显示节点数(终端和内部)

library(ape)
set.seed(123)
Tree <- rtree(10)
Tree$tip.label <- paste("Species", 1:10, sep="_")
plot.phylo(Tree)
nodelabels() # blue
tiplabels() # yellow
edgelabels() # green

然后,要为树的任何节点或边缘着色,我们可以创建一个颜色向量并将其提供给适当的 *labels() 函数。

# using numbers for colors
node_colors <- rep(5:6, each=5)[1:9] # 9 internal nodes 
edge_colors <- rep(3:4, each=9) # 18 branches
tip_colors <- rep(c(11,12,13), 4)
# plot:
plot.phylo(Tree, edge.color = edge_colors, tip.color = tip_colors) 
nodelabels(pch = 21, bg = node_colors, cex=2)

要只标记一个节点和从它下降的进化枝,我们可以这样做:

Nnode(Tree)
node_colors <- rep(NA, 9)
node_colors[7] <- "green"
node_shape <- ifelse(is.na(node_colors), NA, 21)
edge_colors <- rep("black", 18)
edge_colors[13:18] <- "green"
plot(Tree, edge.color = edge_colors, edge.width = 2, label.offset = .1)
nodelabels(pch=node_shape, bg=node_colors, cex=2)

没有你的树,很难说出如何调整树枝。一种方法是减小提示标签的大小,因此它们占用的空间更少 space。另一种方法可能是在保存 png 或 pdf 时进行尝试。

还有其他方法可以做这些树的装饰,包括 ggtree 包。