Hi Yan,
First of all, you did not miss anything in the documentation. There is
currently no pre-rolled method to do this.
Secondly, the approach you describe below is how I would go about doing
it, but it can be done more simply:
subtree = dendropy.Tree(seed_node=node_of_interest)
BUT bear in mind that the original tree is now in an invalid state, as
the node links are disrupted. In DendroPy's data model, nodes cannot be
shared between trees. If you need the original tree intact, you will
have to clone the entire structure first and use the nodes from the clone:
tree2 = dendropy.Tree(tree1)
node_of_interest = tree2.find_node(...)
subtree = dendropy.Tree(seed_node=node_of_interest)
In response to your second question, garbage collection is, of course,
the purview of the Python virtual machine. So as long as you do not
maintain any references to the original tree and its component nodes,
the Python VM GC will kick in. To be sure, you may want to delete the
original tree reference after extracting the subtree:
node_of_interest = tree1.find_node(...)
subtree = dendropy.Tree(seed_node=node_of_interest)
del tree1
> --
> You received this message because you are subscribed to the Google
> Groups "DendroPy Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
dendropy-user...@googlegroups.com
> <mailto:
dendropy-user...@googlegroups.com>.
> For more options, visit
https://groups.google.com/d/optout.
--
--------------------------------------
Jeet Sukumaran
--------------------------------------
jeetsu...@gmail.com
--------------------------------------
Blog/Personal Pages:
http://jeetworks.org/
GitHub Repositories:
http://github.com/jeetsukumaran
Photographs (as stream):
http://www.flickr.com/photos/jeetsukumaran/
Photographs (by galleries):
http://www.flickr.com/photos/jeetsukumaran/sets/
--------------------------------------