Question: Visualize / Highlight Specific Nodes In A Taxonomy Tree
5
gravatar for Khader Shameer
7.3 years ago by
Manhattan, NY
Khader Shameer17k wrote:

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

taxonomy visualization tree • 4.2k views
ADD COMMENTlink modified 4.3 years ago by umer.zeeshan.ijaz1.7k • written 7.3 years ago by Khader Shameer17k
10
gravatar for jhc
7.3 years ago by
jhc2.7k
Germany
jhc2.7k wrote:

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 COMMENTlink written 7.3 years ago by jhc2.7k

That's neat. Thanks jhc !

ADD REPLYlink written 7.3 years ago by Khader Shameer17k

Cool module. and nice color choice.

ADD REPLYlink written 6.8 years ago by brentp22k

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 REPLYlink written 6.2 years ago by Zach Powers340
5
gravatar for Lars Juhl Jensen
7.3 years ago by
Copenhagen, Denmark
Lars Juhl Jensen11k wrote:

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 COMMENTlink written 7.3 years ago by Lars Juhl Jensen11k
1

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

ADD REPLYlink written 7.3 years ago by Michael Kuhn4.9k

Thanks a lot Lars.

ADD REPLYlink written 7.3 years ago by Khader Shameer17k

Thanks a lot Lars, Michael !

ADD REPLYlink written 7.3 years ago by Khader Shameer17k
1
gravatar for Lo Sauer
6.8 years ago by
Lo Sauer160
Lo Sauer160 wrote:

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 COMMENTlink written 6.8 years ago by Lo Sauer160
1
gravatar for umer.zeeshan.ijaz
4.3 years ago by
Glasgow, UK
umer.zeeshan.ijaz1.7k wrote:

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 COMMENTlink written 4.3 years ago by umer.zeeshan.ijaz1.7k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 578 users visited in the last hour