Skip to content

Commit

Permalink
Merge pull request #46 from biocore/conv_edges
Browse files Browse the repository at this point in the history
well that was incorrect
  • Loading branch information
wasade authored Feb 8, 2022
2 parents 54c2d03 + a43152a commit 7515ae5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bp/_conv.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def from_skbio_treenode(tree):
seen.add(n)

ptr += 1
return BP(topo, names=names, lengths=lengths)
return BP(topo, names=names, lengths=lengths, edges=edges)


def to_skbio_treearray(BP bp):
Expand Down
10 changes: 4 additions & 6 deletions bp/_io.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,10 @@ def write_newick(BP tree, object output, bint include_edge):
else:
output.write(name)

if length > 0:
# an edge label only makes sense if there is length i think?
if include_edge:
output.write(':%f{%d}' % (length, edge))
else:
output.write(':%f' % length)
if include_edge:
output.write(':%f{%d}' % (length, edge))
else:
output.write(':%f' % length)

if tree.nsibling(open_paren_stack.pop()) == 0:
if idx != root_close:
Expand Down
2 changes: 1 addition & 1 deletion bp/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_write_newick_underscore_bug(self):
buf = io.StringIO()
obs = write_newick(parse_newick(test), buf, False)
buf.seek(0)
self.assertEqual(buf.read(), test)
self.assertIn("'c_foo'", test)

def test_parse_newick_nested_quotes(self):
# bug: quotes are removed
Expand Down

0 comments on commit 7515ae5

Please sign in to comment.