You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Possible minor bug in that function call looks for a non-existent attribute. Perhaps a more informative Error pointing to the lack of edge lengths rather than the more indirect lack of an attribute?
import dendropy
t = dendropy.Tree.get_from_string("(('A1','A2'),('B1','B2'),('C1','C2'));", schema = "newick")
print(t.as_ascii_plot(plot_metric='length'))
# AttributeError: 'Tree' object has no attribute 'as_newick_string'
t = dendropy.Tree.get_from_string("(('A1':0.1,'A2':0.1):0.2,('B1':0.1,'B2':0.1):0.2,('C1':0.1,'C2':0.1):0.2);", schema = "newick")
print(t.as_ascii_plot(plot_metric='length'))
# prints OK
The text was updated successfully, but these errors were encountered:
That's in dendropy_version_info(major=4, minor=0, micro=3, releaselevel='') and Python 3.
I notice t.as_newick_string() is now t.as_string(schema='newick').
Thank you for reporting this error. As it turned out, this was a case of the error message confusing the error message. What was happening was that the plotting encountered an error due the width not being able to be properly calculated as there were no branch lengths even thought the requested plot metric was "length":
if max_width == 0:
raise AsciiTreePlot.NullEdgeLengthError("Tree cannot be plotted under metric '%s' due to zero or null edge lengths: '%s'" % (self.plot_metric, tree.as_newick_string()))
Unfortunately, the error message composition called on an obsolete function (as_newick_string of older code rather than the internal _as_newick_string of the newer code), and it was this error that caused the failure and an associated error message.
This has now been fixed in the top the development-master branch, revision a7bfde4 .
You will still get an error if you try to plot a tree with the plot metric being branch lengths and the tree has no branch lengths! But at least now, the error message should be meaningful.
Hi
Possible minor bug in that function call looks for a non-existent attribute. Perhaps a more informative Error pointing to the lack of edge lengths rather than the more indirect lack of an attribute?
The text was updated successfully, but these errors were encountered: