Closed smirarab closed 1 year ago
The previous code happens to be correct for one case: length = node.edge_length/2
; I suspect only that case is tested.
Thanks for catching that! Fixed in TreeSwift v1.1.30 via commit https://github.com/niemasd/TreeSwift/commit/2d045fb90503a1963a6b312d47bb7f7bc35ab1e8
You should be able to update via pip
, e.g. pip install --upgrade treeswift
(might take a few tries since the update is fresh)
In this line, we should have
node.edge_length = length
notnode.edge_length -= length
. As is, length is subtracted from both sides, which is incorrect. The total length after should be the same as total length before. https://github.com/niemasd/TreeSwift/blob/53c752e0f738627774fad70b3ca6c1725cc606e9/treeswift/Tree.py#L1069