pruned a super tree

12 views
Skip to first unread message

Wasiu Akanni

unread,
Mar 16, 2012, 2:02:38 PM3/16/12
to dendrop...@googlegroups.com
Hi, am having a problem executing the following

s = '(si,se,(me,(er,(ya,(out,(hy,(vi,le)))))));'
input_tree = '((((si,se),me),(er,ya)),out);'
input_tree1= dendropy.Tree.get_from_string(input_tree, 'newick')
input_taxa = input_tree1.taxon_set.labels()
nuproposed_tree = dendropy.Tree.get_from_string(s, 'newick')
taxa_2_retain= nuproposed_tree.taxon_set.get_taxa(labels = input_taxa)
pruned_supertree = dendropy.treemanip.retain_taxa(nuproposed_tree, taxa=taxa_2_retain)

########## the pruned_supertree has nothing in it... so i figured i must be using the treemanip.retain_taxa wrong

pls any help woud be useful

wasiu

Jeet Sukumaran

unread,
Mar 16, 2012, 2:16:10 PM3/16/12
to DendroPy Users
You need to use the same TaxonSet object to manage the taxa on both
your input_tree and nuproposed_tree. Otherwise, even though the labels
are the same, DendroPy considers the taxa to be different, and thus
there are no taxax on the nuproposed_tree that are found on the
input_tree and vice versa, and hence no taxa get retained.

Wasiu Akanni

unread,
Mar 20, 2012, 3:11:39 PM3/20/12
to dendrop...@googlegroups.com
thanks for your reply... i tried it and still got nothing


taxap = dendropy.TaxonSet()

In [6]: input_tree1= dendropy.Tree.get_from_string(input_tree, 'newick',taxon_set = taxap)

In [7]: input_taxa = input_tree1.taxon_set.labels()

In [8]: nuproposed_tree = dendropy.Tree.get_from_string(s, 'newick', taxon_set = taxap)

In [9]: taxa_2_retain= nuproposed_tree.taxon_set.get_taxa(labels = input_taxa)

In [10]: pruned_supertree = dendropy.treemanip.retain_taxa(nuproposed_tree, taxa=taxa_2_retain)

In [11]: pruned_supertree

In [12]: pruned_tree= str(pruned_supertree)

In [13]: pruned_tree
Out[13]: 'None'
Reply all
Reply to author
Forward
0 new messages