jeetsukumaran / DendroPy

A Python library for phylogenetic scripting, simulation, data processing and manipulation.
https://pypi.org/project/DendroPy/.
BSD 3-Clause "New" or "Revised" License
205 stars 63 forks source link

Support values written as quoted node labels since >4.6.1 #200

Closed alpae closed 3 months ago

alpae commented 3 months ago

Describe the bug Handling of reading newick trees with support values (numeric values as internal node names) somehow changes after release 4.6.1.

Expected behavior reading and writing a newick tree should result in the same representation. This was also the behavior for Dendropy <= 4.6.1

To Reproduce

nw_str = "(A:0.36827875,B:0.186986942,(C:0.156890492,D:0.175861009)1.000:0.163375071);"
tree = dendropy.Tree.get(data=nw_str,schema="newick")
assert nw_str == tree.as_string("newick").strip()

Computational environment

Additional context Add any other context about the problem here.

mmore500 commented 3 months ago

Hi @alpae , thanks for the report! I’ll look into this shortly and follow up

mmore500 commented 3 months ago

The output string in this case is

(A:0.36827875,B:0.186986942,(C:0.156890492,D:0.175861009)'1.000':0.163375071);

with 1.000 quoted

mmore500 commented 3 months ago

Seems potentially related to #144

mmore500 commented 3 months ago

Hi @alpae --- found the issue and fixed. (Nexus and Newick serialization share logic, and Nexus is more eager about quoting certain characters than Newick). I just tagged v5.0.1 with the bug fix, which should release onto PyPI in about half an hour.

Thank you for the report!