【发布时间】:2019-07-15 13:55:34
【问题描述】:
我正在寻找一种在 R 中将系统发育树(Newick 格式或“phylo”类)转换为数据框的方法。目标是很好地了解哪些提示从树的每个节点下降。有没有人遇到过这个问题?
我可以从系统发育树中获取所有尖端标签,或者从一个节点中获取所有后代节点,但我无法获取属于某个节点的尖端标签。
#for a random tree x
x <- rtree(10, tip.label = LETTERS[1:10])
#get all tip labels by asking for tree information
> x
Phylogenetic tree with 10 tips and 9 internal nodes.
Tip labels:
H, G, D, B, I, C, ...
Rooted; includes branch lengths.
#descendant nodes from a node
test <- phytools::getDescendants(x, node=5, curr=NULL)
#the package ggphylo seemed to have the answer to my problem, but it is no longer supported (last updates were in 2012)
ggphylo::tree.as.data.frame(x)
(我认为转换为数据框是最简单的方法,但如果您知道另一种从节点获取后代提示的方法,我愿意接受所有可能的解决方案)
【问题讨论】: