Visualize / Highlight Specific Nodes In A Taxonomy Tree
4
5
Entering edit mode
11.1 years ago

I have a set of species and a score derived from set of proteins associated with each species in the given format. I would like to know what will be the best visualization option to map these species to a tree of life. The idea is to visualize how these proteins are distribute on the tree of life.

Is there any webserver / software package which can perform such type of visualization. Google is only giving me tools for the visualization of phylogeny tree. Here am not looking at a phylogeny tree, these sequences are not homologs. What I am looking is a way to highlight these nodes in a given phylogeny tree using the taxonomy ids. If possible to give a grading color schema to show the significant species.

Taxid Score
9606 75
9823 2
9844 1
9913 27
99287 1

Thanks in advance

visualization taxonomy tree • 6.3k views
ADD COMMENT
10
Entering edit mode
11.1 years ago
jhc ★ 3.0k

If you need more control over your tree images, you can program how the tree is rendered using ETE (Python language)

A very very simple example that associates node features with node size and color would look like this:

from ete2 import Tree, faces
import colorsys
import random

def hls2hex(h, l, s):
    ''' Converts from HLS to RGB '''
    return '#%02x%02x%02x' %tuple(map(lambda x: int(x*255), 
                                      colorsys.hls_to_rgb(h, l, s)))
def get_color(h=None, s=0.5, l=0.5):
    ''' Returns a RGB color code with the specific Hue, Saturation and
    lightness. Otherwise, it returns a random color'''
    if not h:
        h = random.random()
    return hls2hex(h, l, s)

def my_layout(node):
    """ This function set the rules that control how nodes are drawn"""
    value = tax2size.getnode.name, None)
    if value is not None:

        # generate a gradient on color lightness for 0.3 to 0.8. A
        # assume value is in the (0,1) range.
        gradient = 0.3 + (float(value)/100)/2

        # Set node size and color based on the dictionary of user
        # values
        color = get_color(h=0.9, l=gradient)
        node.img_style["size"] = 20 + value
        node.img_style["fgcolor"] = color
        node.img_style["line_type"] = 1

        # Text labels can also be added to the image
        faces.add_face_to_node(faces.TextFace(" (%s) " %node.name), \
                                   node=node, column=0, aligned=True)

        faces.add_face_to_node(faces.TextFace("value: %s" %value), \
                                   node=node, column=1, aligned=True)
    else:
        node.img_style["size"] = 0

# Loads the example tree
t = Tree("(((9606,9844),99287),(9823,9913));")

# Loads the example values associated to leaf nodes
tax2size = {
    "9606": 100, "9823": 80,  "9844": 60,  "9913": 40,  "99287": 20  }

t.show(my_layout)
t.render("gradient.png", my_layout)

alt text

fullsize

ADD COMMENT
0
Entering edit mode

That's neat. Thanks jhc !

ADD REPLY
0
Entering edit mode

Cool module. and nice color choice.

ADD REPLY
0
Entering edit mode

jhc,great idea. I would like to do something similar only start with the Tree-of-Life and assign abunce values. However I can't seem to open the NCBI Taxonomy trees (http://itol.embl.de/other_trees.shtml) with ETE2. I would love to copy your general method but using the entire taxonomical dataset.

ADD REPLY
5
Entering edit mode
11.1 years ago

I would use iTOL for that. I am not sure if it can do a color gradient, but it has several different ways of visualizing data onto a phylogenetic tree.

ADD COMMENT
1
Entering edit mode

Yes, iTOL has gradients, see: http://itol.embl.de/help/help.shtml under "Uploading trees and data"

ADD REPLY
0
Entering edit mode

Thanks a lot Lars.

ADD REPLY
0
Entering edit mode

Thanks a lot Lars, Michael !

ADD REPLY
1
Entering edit mode
10.6 years ago
Lo Sauer ▴ 160

If you happen to be tackling metagenomic data (I am not sure), MEGAN will be of much help, in the task of actually sorting out the phylogenetic relationships, even of unknown taxa.

http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1800929/

Similar plots as posted by jhc can be created directly in the software.

excerpt:

In a preprocessing step, the set of DNA sequences is compared against databases of known sequences using BLAST or another comparison tool. MEGAN is then used to compute and explore the taxonomical content of the data set, employing the NCBI taxonomy to summarize and order the results. A simple lowest common ancestor algorithm assigns reads to taxa such that the taxonomical level of the assigned taxon reflects the level of conservation of the sequenceconservation of the sequence conservation of the sequence

ADD COMMENT
1
Entering edit mode
8.1 years ago

If you can convert those taxids to scientific names of species and use a comma-separated table, then you can use my PHYLOmap to visualise phylogenetic tree (which links up with ITOL).

Format the data as table.csv given on page 2.

Best Wishes,
Umer

ADD COMMENT

Login before adding your answer.

Traffic: 2197 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6