Learn R Programming

mvSLOUCH (version 2.7.6)

phyltree_paths: Extract path information from a phylogenetic tree

Description

The function computes for each node its path to the root and its distance to the root. It returns an ``enhanced'' phylo type tree.

Usage

phyltree_paths(phyltree)

Value

The function returns a phylo type tree with the below additional fields.

Ntips

Number of tips on the tree.

path.from.root

A list of length equalling the number of nodes. Each entry is a list made up of two fields nodes and edges. nodes are the nodes on the path to the root and edges the edges.

time.of.nodes

A vector of length equalling the number of nodes. Each entry is the node's distance from the root. This is only calculated if the input tree has the $edge.length field.

tree_height

The height of the tree if it is ultrametric, otherwise the length of the longest path from root to tip.

tip_species_index

The node numbers corresponding to tip nodes, should equal 1:n.

internal_nodes_index

The node numbers corresponding to internal nodes, should equal (n+1):(2n-1).

root_index

The node number corresponding to the root, should equal n+1.

Arguments

phyltree

The phylogeny - an object of class phylo, i.e. tree in ape format. The "standard" ape node indexing is assumed: for a tree with \(n\) tips, the tips should have indices 1:n and the root index n+1.

Author

Krzysztof Bartoszek

Details

The function removes a root edge, i.e. $root.edge if one is present.

See Also

ape, phangorn

Examples

Run this code
    RNGversion(min(as.character(getRversion()),"3.6.1"))
    set.seed(12345, kind = "Mersenne-Twister", normal.kind = "Inversion")
    phyltree<-ape::rtree(5)
    phyltree_augmented<-phyltree_paths(phyltree)
    RNGversion(as.character(getRversion()))

Run the code above in your browser using DataLab