Extract Divergence Times and Corresponding Node Numbers from a Time Tree
1
0
Entering edit mode
14 months ago
Simone ▴ 10

I need to extract divergence times and their corresponding node numbers for every node in a time tree (ultrametric), basically to create a table with one column for node numbers and one for the divergence time at that node. I've been trying to use phytools/ape/geiger , but I can't figure out how the phylo object stores the order of edge lengths from a tree. The divergence times from the time tree are being read into R as branch lengths, so I can't just print them as node labels. This is such a simple task, I think I'm missing something basic in extracting information from phylogenies.

phylogeny R ape phytools phylogenetics • 1.1k views
ADD COMMENT
0
Entering edit mode
14 months ago
cfos4698 ★ 1.1k

ggtree and treeio help here.

library("ggtree")
library("treeio")
beast_file <- system.file("examples/MCC_FluA_H3.tree", 
                          package="ggtree")
beast_tree <- read.beast(beast_file)
beast_tree@data %>% select(node,height)
ADD COMMENT
0
Entering edit mode

thank you!

ADD REPLY

Login before adding your answer.

Traffic: 1177 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6