I am trying to parse a Newick file downloaded from the Open Tree of Life server using the ete3 python package:
from ete3 import Tree
tree = Tree('Vertebrata.tre', format=1)
and getting the following error:
raise NewickError('Broken newick structure at: %s' %chunk)
ete3.parser.newick.NewickError: Broken newick structure at:
Malacothrix_typica_ott600700)'Malacothrix You may want to check other
newick loading flags like 'format' or 'quoted_node_names'.
I also tried all other possible values for the 'format' option, but this did not solve the problem.
I've seen this mentioned in an old Github issue, but this is not very helpful.
Anyone ever tried this, or can help me figure it out? In case you want to try it out, the download link is here,
Thanks!
As the error suggests, it sounds like your input file is broken. Typically with NEWICK this is because one or more brackets is missing. ETE3 can be quite fussy, especially if its a multi-line NEWICK representation.
I'd hazard a guess that your found solution was less fussy about the input format, but has 'fixed' your file when you wrote out a new tree.