This vignette shows how to parse a BEAST2 posterior file using RBeast
.
Load the RBeast
package:
library(RBeast)
Check if the example file can be found:
trees_file <- system.file( "extdata", "read_beast2_trees_example.trees", package = "RBeast" ) testit::assert(file.exists(trees_file))
Parse the posterior:
posterior_trees <- read_beast2_trees(trees_file)
Investigating the posterior:
names(posterior_trees) 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 seperately:
for (p in posterior_trees) { graphics::plot(p) }
Or we plot all at once:
class(posterior_trees) <- "multiPhylo" phangorn::densiTree( posterior_trees, type = "cladogram", alpha = 1 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.