TreeViewJ: An application for viewing and analyzing phylogenetic trees
© Peterson and Colosimo; licensee BioMed Central Ltd. 2007
Received: 09 July 2007
Accepted: 31 October 2007
Published: 31 October 2007
Phylogenetic trees are widely used to visualize evolutionary relationships between different organisms or samples of the same organism. There exists a variety of both free and commercial tree visualization software available, but limitations in these programs often require researchers to use multiple programs for analysis, annotation, and the production of publication-ready images.
We present TreeViewJ, a Java tool for visualizing, editing and analyzing phylogenetic trees. The software allows researchers to color and change the width of branches that they wish to highlight, and add names to nodes. If collection dates are available for taxa, the software can map them onto a timeline, and sort the tree in ascending or descending date order.
TreeViewJ is a tool for researchers to visualize, edit, "decorate," and produce publication-ready images of phylogenetic trees. It is open-source, and released under an GPL license, and available at http://treeviewj.sourceforge.net.
Phylogenetic trees are widely used to visualize evolutionary relationships between different organisms or samples of the same organism. There is a variety of both free and commercial tree visualization software [1–5] available, but limitations in these programs often require the user to use multiple programs for analysis, annotation, and display for publication. For some applications, such as epidemiological studies, the visualization of sample collection dates along with the tree would provide further insight into relationships. However, no currently available visualization packages provide this functionality.
A variety of file formats exist for the storage of phylogenetic trees. Some, like the New Hampshire format store only the node name and branch length information. Others, like the New Hampshire Extended  and Nexus formats, can be used to store other data such as formatting and sequence data. Other file formats, such as the Lucid  and Structure of Descriptive Data (SDD)  formats have been used for the description of taxonomic data. Recently, a draft standard for an XML-based format, PhyloXML , has been released. XML-based formats are ideal for storing phylogenetic data because they can be easily interpreted by readily available general purpose software (thus eliminating the need for customized parsers), easily allow for annotation, and are extensible.
We have designed a visualization program, TreeViewJ, which will allow researchers to annotate, edit and produce publication-ready figures of phylogenetic trees, and to visualize sample collection date information using a timeline. With the use of PhyloXML, there is more flexibility for editing trees – trees can be edited before visualization with an XML parser, as well as within the tool. We have also implemented an algorithm for sorting taxa by date, while keeping the structure of the tree the same.
TreeViewJ is written in Java, against JDK 1.5. The Swing and Abstract Windowing Toolkit (AWT) libraries are used for the graphical user interface, and the Java2D libraries are used for drawing tasks. This allows the application to be platform independent. While it is meant to be a standalone application, the object-oriented design of TreeViewJ allows straightforward integration with other Java applets or applications.
Results and discussion
Graphical User Interface
File Input and Output
TreeViewJ offers full read support for Newick and PhyloXML formatted files. Trees in Nexus  and Extended Newick  format can be imported, though some information contained in these files may be lost. Currently, there is no support for Lucid or SDD file formats, but these could easily be added in the future. PhyloXML files are read using the Apache Xerces Document Object Model (DOM) parser . Newick files are parsed using code adapted from the Phylogenetic Analysis Library (PAL) , and Nexus files are parsed with a custom parser. Files are written to XML documents using Xerces.
Each file may contain multiple phylogenies. Forests may be saved to PhyloXML format, and individual trees can be exported to Newick format.
TreeViewJ can represent phylogenies as slanted cladograms, rectangular cladograms, circular cladograms, and phylograms. The tree drawing code was adapted from TreeViewX , an open source project based on TreeView . Trees are drawn using the Java2D libraries.
Once a tree is drawn the user can zoom in and out, change the draw color, and toggle internal and leaf labels on and off. Zooming and resizing are achieved using affine transforms to avoid redraws. Nodes of the tree can be selected by right clicking or clicking and dragging and their labels may be copied to the clipboard and pasted into other applications.
Once the tree is drawn, it can be printed or exported to either Scalable Vector Graphics (SVG) or JPEG format. The Apache Batik  toolkit is used to create SVG documents.
Node editing is started by clicking on one of the nodes in the tree. At this point, the node editing dialog is shown. The editor allows changes to be made to node name and font color, as well as the branch width and color. Possible uses for this functionality would be easily highlighting parts of the tree that are described in the text, or adding label to the parent node of a clade. Once editing is completed, the changes are made to the XML document and the tree is refreshed to display the changes made. Nodes can also be searched for using Java regular expressions or plain string mapping.
Currently, the PhyloXML standard does not provide any way to store date information. We have proposed an addition to the schema which allows for the addition of sample dates, using the ISO 8601 date format. Dates stored in the XML document as such are mapped to the leaf nodes using a timeline, as shown in Figure 1. The JFreeChart  library, along with some additional code, was used to create timelines. Java2D libraries were used to draw lines from the leaf nodes to their dates. Dates are mapped at a minimum resolution. For example, if the dates span less than two years, dates are displayed as mm/yyyy. If the dates span less than a year, then the dates are displayed as mm/dd/yyyy.
We present TreeViewJ, an easy to install, easy to use, open source tool for visualizing and editing phylogenetic trees. It is written in Java, and therefore is platform independent. It is the first tree viewer to include support for date mapping and sorting. The ability to draw, edit, analyze, and produce publication-ready vector graphics makes TreeViewJ an ideal tool for phylogenetic visualization, and an excellent complement to full-featured phylogenetic suites such as Mesquite  and PAUP .
Availability and requirements
Project Name: TreeViewJ
Project Home Page: http://treeviewj.sourceforge.net/
Operating System: Platform Independent
Programming Language: Java
Other Requirements: Java Runtime 1.5 or greater, Apache Maven
Any restrictions to use by non-academics: None
The authors would like to thank Penny Chase, Scott Mardis, and Stan Barr for their testing and feedback on early versions of the tool, and Matt Coarr for his help in packaging the source code using Maven.
©2007 The MITRE Corporation. All rights reserved.
Approved for Public Release; Distribution Unlimited: 07-0891
- Gu S, Anderson I, Kunin V, Cipriano M, Minovitsky S, Weber G, Amenta N, Hamann B, Dubchak I: TreeQ-VISTA: an interactive tree visualization tool with functional annotation query capabilities. Bioinformatics. 2007, 23 (6): 764-766. 10.1093/bioinformatics/btl643.View ArticlePubMedGoogle Scholar
- Hughes T, Hyun Y, Liberles DA: Visualising very large phylogenetic trees in three dimensional hyperbolic space. BMC Bioinformatics. 2004, 5: 48-10.1186/1471-2105-5-48.PubMed CentralView ArticlePubMedGoogle Scholar
- Page RD: TreeView: an application to display phylogenetic trees on personal computers. Comput Appl Biosci. 1996, 12 (4): 357-358.PubMedGoogle Scholar
- Page RD: TreeViewX. [http://darwin.zoology.gla.ac.uk/~rpage/treeviewx/index.html]
- Zmasek CM, Eddy SR: ATV: display and manipulation of annotated phylogenetic trees. Bioinformatics. 2001, 17 (4): 383-384. 10.1093/bioinformatics/17.4.383.View ArticlePubMedGoogle Scholar
- Felsenstein J: PHYLIP: the PHYLogeny Inference Package. [http://www.evolution.genetics.washington.edu/phylip.html]
- Maddison DR, Swofford DL, Maddison WP: NEXUS: an extensible file format for systematic information. Syst Biol. 1997, 46 (4): 590-621. 10.2307/2413497.View ArticlePubMedGoogle Scholar
- Lucidcentral. [http://www.lucidcentral.org]
- Structure of Descriptive Data (SDD). [http://www.diversitycampus.net/Projects/TDWG-SDD/]
- Zmasek CM: PhyloXML - an XML language for phylogenetics. [http://www.phyloxml.org]
- Xerces XML Parser,. [http://www.xerces.apache.org]
- Drummond A, Strimmer K: PAL: an object-oriented programming library for molecular evolution and phylogenetics. Bioinformatics. 2001, 17 (7): 662-663. 10.1093/bioinformatics/17.7.662.View ArticlePubMedGoogle Scholar
- Batik SVG Toolkit. [http://batik.apache.org]
- Gilbert D M: JFreeChart, a free Java class library for generating charts. [http://www.jfree.org/jfreechart/]
- Maddison WP: Mesquite: a modular system for evolutionary analysis. 2006, [http://www.mesquiteproject.org]1.12Google Scholar
- Swofford DL: PAUP*: Phylogenetic Analysis Using Parsimony (*and Other Methods). 2003, Sinauer Associates, Sunderland, MassachusettsGoogle Scholar
This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.