biotite icon indicating copy to clipboard operation
biotite copied to clipboard

`RecursionError` in `TreeNode.from_newick()`

Open padix-key opened this issue 2 years ago • 0 comments

When a Tree is created from a large number of sequences, the following error occurs:

src/biotite/sequence/phylo/tree.pyx:323: in biotite.sequence.phylo.tree.Tree.from_newick
    root, distance = TreeNode.from_newick(newick, labels)
src/biotite/sequence/phylo/tree.pyx:921: in biotite.sequence.phylo.tree.TreeNode.from_newick
    child, dist = TreeNode.from_newick(
src/biotite/sequence/phylo/tree.pyx:921: in biotite.sequence.phylo.tree.TreeNode.from_newick
    child, dist = TreeNode.from_newick(
RecursionError: maximum recursion depth exceeded while calling a Python object

The reason is that from_newick() uses recursion to create the tree, which is limited to a certain depth in Python.

padix-key avatar May 30 '22 08:05 padix-key