Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TreeNode.prune does not collapse single descendants from root properly #1247

Closed
wasade opened this issue Dec 23, 2015 · 3 comments
Closed

TreeNode.prune does not collapse single descendants from root properly #1247

wasade opened this issue Dec 23, 2015 · 3 comments

Comments

@wasade
Copy link
Collaborator

wasade commented Dec 23, 2015

I noticed this while working on a collapse method (i.e., prune) for the tree arrays. The expectation is that ((a,b)c)extra; should become (a,b)c as extra only contains a single child. Interestingly, the collapse happens partially if there are multiple extras where (((a,b)c)extra1)extra2; becomes ((a,b)c)extra2;.

09:25:16 (daniel@sandbar):repicking> t = TreeNode.read(["((a,b)c)extra;"])

09:26:00 (daniel@sandbar):repicking> print(t.ascii_art())
                    /-a
-extra--- /c-------|
                    \-b

09:26:03 (daniel@sandbar):repicking> t.prune()

09:26:05 (daniel@sandbar):repicking> print(t.ascii_art())
                    /-a
-extra--- /c-------|
                    \-b
@jairideout
Copy link
Contributor

@wasade, any bandwidth to work on this for the release? Ideally this could be fixed proper, but raising a NotImplementedError is also a big improvement over a silent bug.

@wasade
Copy link
Collaborator Author

wasade commented Jun 1, 2016

Sure. Just for reference, I believe the only change necessary is to make include_self=True...

@jairideout
Copy link
Contributor

Awesome, thanks @wasade!

wasade added a commit to wasade/scikit-bio that referenced this issue Jun 2, 2016
jairideout added a commit that referenced this issue Jun 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants