Learn R Programming

BAT (version 2.9.6)

tree.zero: Convert negative branches of tree.

Description

Converts negative branch lengths of any tree to zero.

Usage

tree.zero(tree)

Value

A phylo object.

Arguments

tree

A phylo object.

Details

Converts branches with negative values to zero while shortening only the two branches immediately below it by the same absolute amount to ensure the tree remains with tips at same distances and there are no polytomies.

Examples

Run this code
par(mfrow = c(1,2))
tree <- ape::read.tree(text='(((A:3, B:3):1,
(G:6, (H:5, I:5):1):-2):3, ((C:1, D:1):2, (E:4, F:4):-1):4);')
plot(tree)

tree = tree.zero(tree)
plot(tree)

Run the code above in your browser using DataLab