Home
Back to Programs
TreeCoder

Information

This program was created to aid anyone who has wanted to reproduce a tree from an image or paper where access to the tree file or original data isn't available or there isn't time to recompile it. This applet lets you copy the visual style of the tree manually in a format that's easier to use than the usual mess of parenthesis or code that's required. This applet has no way of taking into account confidence values or branch length - it allows you to copy topology only. It is not intended for rigorous scientific work, simply for those who would like to be able to investigate and perhaps rearrange a tree, or add colours/styling.




Information

It is recommended that you print off the tree you'd like to replicate, if possible, so you can write on it. Then label the branch points however you like - simple numbers or letter will work best.
Here I've labeled the branch points 'a' and 'b':
Original Tree
Now, simply define each branch point by stating what it contains.
How to code
Notice that if you are putting a lower-down branch point inside of a higher-up branch point (here clade 'a' is nested in clade 'b'), the fact that 'a' is a branch-point name is signified by putting an asterick (*) in front of it. This tells the program that 'a' isn't a leaf, but contains further branches/leaves. Also notice that order is noted - defining 'b' as '*a, rat' states that 'cat' and 'dog' branch above rat. Obviously the tree is still the same, but keeping the order the same as the tree you are replicating can make it easier to double-check that you have correctly copied the tree. (Note that some programs you open the tree in may disregard this order.)

It is *very important* to not use a branch point until you have define what it contains! In this example, it means not defining 'b' before you have defined 'a':
How NOT to code
If you do this, your tree will be incorrect, with missing branches and leaves. To prevent this, it is best to work from the deepest level of the tree outward.
More Complex Tree
There are two good ways of doing this with more complex trees:
A - Start from the top of the tree, and label branch points inwards until you come to a branch point that includes branch points not yet defined - go out to these and work inwards again.
B - Divide the tree into branching 'levels' and label each level, starting at the leaves, working inwards.


The applet will give you two types of code: phyloXML and Nexus (.nexus, .nex). Copy the resulting text out of the applet and into notepad or wordpad, but ensure you save it as type 'All Files' and with the extension '.xml' or '.nex' after the name.
I would recommend Archaeopteryx for viewing your file, as it opens both types of file and allows you to save them in phyloXML, NHX, Nexus, and New Hampshire (Newick) formats, as well as export graphic images as PDF, PNG, GIF, BMP, and JPG. You can also use it to rearrange your tree. If you would like to add colour/labels to your tree, I recommend FigTree. To reorganize 'tanglegrams' or host-parasite relationship phylogenies, I would recommend TreeMap(v1.0). It will allow you to import two trees and then define relationships between them. TreeMap2 is available for Mac usrs only. TreeMap3 has an automatic 'detangling' function that can be useful, but is unfinished and a little tricky to run.*


*To run in Windows, download the files from the TreeMap3 website and unzip them somewhere. Download this .bat file and place it in the TreeMap3.0b.app/Contents/Resources/Java folder. You can then double-click it to run.
If you're hesitant downloading the file from this site, create a new file called 'run.bat' in the folder and put the following text in it (all on one line):
java -Xms256M -Xmx1024M -classpath "jar_0.jar;jar_1.jar;junit.jar;junit.jar;iText-2.1.5.jar;iText-rtf-2.1.5.jar;iText-rups-2.1.5.jar" treemap.TreeMap

Code never lies, comments sometimes do.

Design downloaded from free website templates.