Parse tree to retrieve bootstrap support, patristic distance and node ids

42 views
Skip to first unread message

vmontoya

unread,
Aug 6, 2015, 12:55:58 AM8/6/15
to DendroPy Users
I am able to retrieve the patristic distances for all pairwise comparisons below a given distance cutoff with:

infile  = sys.argv[1]
cutoff = sys.argv[2]
tree = dendropy.Tree.get_from_path(infile, "nexus")
pdm = treecalc.PatristicDistanceMatrix(tree)
for i, t1 in enumerate(tree.taxon_set):
    for t2 in tree.taxon_set[i+1:]:
        if pdm(t1,t2) < float(cutoff):
            print("%s,%s,%s" % (t1.label, t2.label, pdm(t1, t2)))

How can I also retrieve the bootstrap support for these nodes?

Thanks
V

vmontoya

unread,
Aug 6, 2015, 1:29:06 PM8/6/15
to DendroPy Users
Note that I do not mean generate bootstrap support, I only need to retrieve the previously generated bootstrap support values

Jeet Sukumaran

unread,
Aug 6, 2015, 1:38:11 PM8/6/15
to dendrop...@googlegroups.com
You need to provide a little more detail here.

Are these values on the original tree as node labels? If so, read the
node labels of the relevant node (and, most likely, coerce to floats).

Are these values given as metadata annotations? Access the metadata
annotations?

Are these values given as branch lengths? Read the branch lengths.

And so on.
> --
> 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/
--------------------------------------

vmontoya

unread,
Aug 6, 2015, 2:34:26 PM8/6/15
to DendroPy Users
Yes, the bootstrap support are on the original tree as node labels.  How do I read the node labels and export them?
I have tried using:
suppress_leaf_node_labels=False
suppress_internal_node_taxa=False
...but I am not sure how to retrieve the label information
Thanks

On Wednesday, August 5, 2015 at 9:55:58 PM UTC-7, vmontoya wrote:

Jeet Sukumaran

unread,
Aug 6, 2015, 5:26:22 PM8/6/15
to dendrop...@googlegroups.com
The ``PatristicDistanceMatrix.mrca()`` method returns the node that the
MRCA of two taxa, and the label of this node will indicate the support.
So the following should work:

~~
bootstrap_value = float(pdm.mrca(t1, t2).label)
~~

You will probably want to add some logic to handle special case of no
support values (as might be expected at the root).

Note that you want to explicitly have:

``suppress_internal_node_taxa=True``

Otherwise the internal node labels would be interpreted as taxa.

-- jeet

vmontoya

unread,
Aug 6, 2015, 5:42:02 PM8/6/15
to DendroPy Users
Perfect, thanks so much Jeet!


On Wednesday, August 5, 2015 at 9:55:58 PM UTC-7, vmontoya wrote:
Reply all
Reply to author
Forward
0 new messages