mcmc2multiphylo: Convert an MCMC sample from MCMCTree or BPP to a list of...

View source: R/mcmc2multiphylo.R

mcmc2multiphyloR Documentation

Convert an MCMC sample from MCMCTree or BPP to a list of trees

Description

Convert an MCMC sample from MCMCTree or BPP to a list of trees

Usage

mcmc2multiphylo(tree, mcmc, time.name, thin)

Arguments

tree

an object of class phylo

mcmc

data frame with an MCMC sample from MCMCTree or a BPP A00 analysis

time.name

character vector of length one, this is usually "tau_" for BPP, or "t_" for MCMCTree.

thin

numeric, the fraction of MCMC samples to keep

Details

tree must be rooted and strictly bifurcating, and it must match (i.e, it must use the same Newick representation) as the tree used by BPP or MCMCTree to obtain the MCMC sample. The function uses the node ages in mcmc to calculate branch lengths and generate a list of trees (with the same topology as tree), one tree per (thinned) MCMC sample. The tips of the phylogeny are assumed to have age zero.

Value

An object of class multiPhylo (i.e., a list of trees).

Author(s)

Mario dos Reis

Examples

# hominid MCMC sample from BPP:
data(hominids)
hominid.trees <- mcmc2multiphylo(hominids$tree, hominids$mcmc, "tau_", 0.001)

## Not run: 
# If you have the ape package installed, you can output the trees in 
# Newick format
ape::write.tree(hominid.trees) 

## End(Not run)


dosreislab/mcmc3r documentation built on April 5, 2025, 4:06 p.m.