Convert trees produced by a BEAST2 FBD analysis with offset...

View source: R/treesWoffset.R Documentation

Convert trees produced by a BEAST2 FBD analysis with offset to trees with correct ages.


This method adds a dummy tip at the present (t = 0) to fully extinct trees with offsets, in order to have correct ages (otherwise the most recent tip is assumed to be at 0). This is a workaround to get the proper ages of the trees into other tools such as TreeAnnotator.

Usage, log.file, output.file = NULL, = "dummy")



path to BEAST2 output file containing posterior trees


path to BEAST2 trace log file containing offset values


path to file to write converted trees. If NULL (default), trees are simply returned.

name of the added dummy tip, default dummy.


NB: Any metadata present on the tips will be discarded. If you want to keep metadata (such as clock rate values), use instead.


list of converted trees (as treedata)

See Also (slower version, keeping metadata)


# Convert trees with offset to trees with dummy tip
trees_file <- system.file("extdata", "ex_offset.trees", package = "EvoPhylo")
log_file <- system.file("extdata", "ex_offset.log", package = "EvoPhylo")
converted_trees <-, log_file)

# Do something with the converted trees - for instance, calculate the MCC summary tree
# Then remove the dummy tip from the MCC tree
final_tree <- drop.dummy.beast(system.file("extdata", "ex_offset.MCC.tre", package = "EvoPhylo"))

EvoPhylo documentation built on Nov. 4, 2022, 1:06 a.m.