# NOT RUN {
## read annotated tree from Nexus file
## (note: do not use 'system file' for your own file!)
tre <- read.annotated.nexus(system.file("files/BEAST-expl.nex", package="OutbreakTools"))
## ladderize the tree
tre <- ladderize(tre)
## this tree has annotations
##
names(tre)
class(tre$annotations)
length(tre$annotations)
## for each edge (each edge is identified by a terminal node), we have:
tre$annotations[[1]]
names(tre$annotations[[1]])
## extract rates from annotations
rates <- unlist(sapply(tre$annotations, function(e) e$rate_median))
## plot tree, show median rates as colors
plot(tre, show.tip=FALSE, edge.col=num2col(rates, col.pal=seasun))
# }
Run the code above in your browser using DataLab