[Biopython] extra annotations for phyla tree

Eric Talevich eric.talevich at gmail.com
Mon Feb 17 06:25:18 UTC 2014


On Sat, Feb 15, 2014 at 10:49 PM, Willis, Jordan R <
jordan.r.willis at vanderbilt.edu> wrote:

>
> Hi,
>
> First off, whomever wrote the DistanceTree and DistranceMatrix
> Calculator...hat's off! I have been looking for an easy way to do custom
> distance matrices for a while. Wow.
>
> Anyway, I noticed you can add some extra annotations to your leafs by
> converting your tree into a PhyloXML. I was wondering if there are ways to
> color branches and adjust thickness to highlight branches of interest. I
> know you can simply open the trees in other programs like Dendroscope and
> color them manually, but you can imagine a scenario where you have
> thousands of trees to compare etc.
>
> Jordan
>

Hi Jordan,

The TreeConstruction and Consensus modules are the recent work of Yanbo Ye.
Good to hear you're using it and liking it.

As for annotating branch display colors and widths, you can accomplish this
by setting the .color and .width attributes of Clade objects. See:
http://biopython.org/DIST/docs/tutorial/Tutorial.html#sec233

tree = Phylo.read("mytree.nwk", "newick")
clade = tree.common_ancestor("A", "B")
clade.color = "red"
clade.width = 2

Note that the clade color and width is recursive, applying to all
descendent clade branches too (per the phyloXML spec). To save the
annotations so they can be read by Dendroscope and Archaeopteryx, the trees
must be saved in phyloXML format:

Phylo.write(tree, "mytree-annotated.xml", "phyloxml")


Cheers,
Eric



More information about the Biopython mailing list