This vignette shows how to parse a BEAST2 posterior file using tracerer
.
Load the tracerer
package:
library(tracerer)
Check if the example file can be found:
trees_file <- get_tracerer_path("beast2_example_output.trees")
testit::assert(file.exists(trees_file))
Parse the posterior:
posterior_trees <- parse_beast_trees(trees_file)
Investigating the posterior:
names(posterior_trees)
## NULL
testit::assert(length(posterior_trees) == 11)
We can see that the posterior has multiple states.
Every state is a phylogeny:
testit::assert(class(posterior_trees[[1]]) == "phylo")
We can plot these all separately:
for (p in posterior_trees) {
graphics::plot(p)
}
Or we plot all at once:
phangorn::densiTree(
posterior_trees,
type = "cladogram",
alpha = 1
)