Monday, 13 July 2015

Making a quick plot of a phylogenetic tree

I've been trying to find nice ways to make a quick plot of a phylogenetic tree.

Here are some nice ones:
- My colleague Bhavana told me about using FigTree [note to self: this is installed on the Sanger farm]
- On the ETE2 webpage, there is a very nice TreeView tool for drawing a tree, where you can just paste in your tree, and it makes a tree picture
- On the Sanger farm, if you logged in using 'ssh -X', you can use the ETE2 command-line tool, by typing 'ete2' with a Newick tree file name, and a GUI pops up
- You can also plot a tree using a Python script that calls ETE2, for example, this script calls ETE2 and pops up a picture of the tree in a GUI (picture below): (again, for this you need to log into the Sanger farm using 'ssh -X')

import osimport sysfrom ete2 import Tree

# note: this script is in python2, as ete2 is in python2#====================================================================#

# the code below is based on examples on http://pythonhosted.org/ete2/tutorial/tutorial_drawing.html # load a tree from a file. The root node is put into 't' t = Tree(newick_file, format=1) # format=1 means internal node names are loaded t.show()