biotite.sequence.phylo.as_binary

biotite.sequence.phylo.as_binary(tree_or_node)[source]

Convert a tree into a binary tree.

In general a TreeNode can have more or less than two children. However guide trees usually expect each intermediate node to have exactly two child nodes. This function creates a binary Tree (or TreeNode) for the given Tree (or TreeNode): Intermediate nodes that have only a single child are deleted and its parent node is directly connected to its child node. Intermediate nodes that have more than two childs are divided into multiple nodes (distances are preserved).

Parameters
tree_or_nodeTree or TreeNode

The tree or node to be converted into a binary tree or node.

Returns
binary_tree_or_nodeTree or TreeNode

The converted tree or node.