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 binaryTree
(orTreeNode
) for the givenTree
(orTreeNode
): 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.