Closed bede closed 6 years ago
Added the feature in this commit: https://github.com/niemasd/TreeSwift/commit/ac354bb81f4463138663edf06d2bcc6c7bcfc1d5
I added it to TreeSwift 1.0.73, but for some reason it's not showing up via pip install
yet. Hopefully PyPI will refresh shortly or something.
Basically, if the tree does not have a root edge (i.e., if tree.root.edge_length
is None
), nothing happens. If the tree does have a root edge (i.e., if tree.root.edge_length
is not None
), I create a new child of the root (by default, I label it "OLDROOT"
, but you can set it to whatever you want via the label
argument of deroot()
), I set its edge length to be what the root edge length was, and then I remove the root edge (i.e., I set tree.root.edge_length
to None)
Looks like 1.0.73 installs properly in pip
now, so the updates should be accessible now!
Fantastic! Amusingly I implemented this feature (albeit without modifying treeswift internals) early this morning, before checking my mail. Cheers : )
Some software expects unrooted trees to have trifurcating roots. This would be a useful feature.
See Dendropy's
deroot()
http://dendropy.org/primer/treemanips.html?highlight=deroot#derootingSource: https://github.com/jeetsukumaran/DendroPy/blob/7f2dfd2aad20daafb18b817b985d0146e670fc23/src/dendropy/datamodel/treemodel.py#L4810