letsc
letsc

Reputation: 2567

Phylogenetic Tree Coloring

I have created a phylogenetic tree of a bunch on enzyme sequences I have. I have it in a simple format with only scores displayed and no coloring. Now the sequences I have are Restriction enzymes and each of them have a motif. I want to color the enzyme branches having similar motifs. I spent the better part of yesterday looking at different softwares that could help me do this but ended up confused. I wanted to know a good tool that takes trees either in the newick format or takes in alignment information. and will allow me to impart color based on similar motifs.

I came across this tool : http://etetoolkit.org/ , but it requires a large number of dependent libraries which in turn have dependencies with little or no documentation of installation errors.

I used the Phylo class from the BioPython library to develop the trees. I used the following command to generate my tree with the scores:

Phylo.draw(tree,branch_labels=lambda c: c.branch_length)

Upvotes: 2

Views: 3033

Answers (2)

Roger V.
Roger V.

Reputation: 668

In BioPython an easy way to color tree branches is by setting clade attribute color. For example, if I wanted to color red all the leafs, whose names are in list L, I could write something like

for clade in tree.get_terminals():
    if clade.name in L:
        clade.color = 'red'

and then plot this tree using Phylo.draw

Upvotes: 0

iayork
iayork

Reputation: 6709

FigTree (http://tree.bio.ed.ac.uk/software/figtree/) is a phylogenetic tree viewer that allows customizable coloring.

It's not clear to me how you know which enzyme has which motif. If that information isn't built in, you may need to annotate each sequence before building your tree, so that you can search in FigTree and color by label.

(Note that if you want to only show the enzyme name, with no motif, you can still take this approach and then manually edit the .nwk file afterward, leaving in the color information but stripping out the annotations.)

Upvotes: 0

Related Questions