Convert a tree in the tree sequence to an object of the class phylo

ts_phylo(
ts,
i,
mode = c("index", "position"),
labels = c("tskit", "pop"),
quiet = FALSE
)

## Arguments

ts

Tree sequence object of the class slendr_ts

i

Position of the tree in the tree sequence. If mode = "index", an i-th tree will be returned (in one-based indexing), if mode = "position", a tree covering an i-th base of the simulated genome will be returned.

mode

How should the i argument be interpreted? Either "index" as an i-th tree in the sequence of genealogies, or "position" along the simulated genome.

labels

What should be stored as node labels in the final phylo object? Options are either a population name or a tskit integer node ID (which is a different thing from a phylo class node integer index).

quiet

Should ape's internal phylo validity test be printed out?

## Examples

if (FALSE)  # extract a 42nd tree from a given tree sequence, return ape object
tree <- ts_phylo(ts, i = 42, mode = "index")

# extract a tree at a 42th basepair in the given tree sequence
tree <- ts_phylo(ts, i = 42, mode = "position")