Trees
Class TreeFigure

java.lang.Object
  extended by Trees.TreeFigure

public class TreeFigure
extends java.lang.Object

Class for visualising trees. Produces a SVG file.
Note this class is still being developed. It works but may not have all appropiate error checking nor have all needed methods been written. I make no guarantees that future versions will have the same methods.

Version:
1.1

Constructor Summary
TreeFigure(Tree t)
          Constructor
 
Method Summary
 void printSVG(java.io.File f, boolean showLengths)
          Prints the tree to the given file
 void setBranchColors(java.util.Map<Branch,java.lang.String> colors)
          Sets the color of branches.
 void setLeafColor(java.util.Map<java.lang.String,java.lang.String> colors)
          Sets the color of the leaf text.
 void setLeavesText(java.util.Map<java.lang.String,java.lang.String> names)
          Overwrites the default leaf text (the taxa names).
 void setRootBranchColor(java.lang.String color)
          Sets the color of the root branch.
 void setVerticalSpacing(int spacing)
          Sets the spacing (in co-ordinate terms) between the horizontal lines
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeFigure

public TreeFigure(Tree t)
           throws TreeException
Constructor

Parameters:
t - The tree to visualize
Throws:
TreeException - If the tree does not have branch lengths
Method Detail

setBranchColors

public void setBranchColors(java.util.Map<Branch,java.lang.String> colors)
Sets the color of branches. Default is black, either if this method is not called at all or it is not bassed a color for a branch. Colors should be defined as in a SVG file.

Parameters:
colors - Map from branch to color

setLeafColor

public void setLeafColor(java.util.Map<java.lang.String,java.lang.String> colors)
Sets the color of the leaf text. Default is black, either if this method is not called at all or it is not bassed a color for a branch

Parameters:
colors - Map from leaf name to color. Colors should be defined as in a SVG file.

setRootBranchColor

public void setRootBranchColor(java.lang.String color)
Sets the color of the root branch. Defaults to black if this method is not called

Parameters:
color - The color of the branch. Color should be defined as in a SVG file.

setLeavesText

public void setLeavesText(java.util.Map<java.lang.String,java.lang.String> names)
Overwrites the default leaf text (the taxa names).

Parameters:
names - Map from taxa name to string where the string is the new text for each leaf. Should include new text for every leaf.

setVerticalSpacing

public void setVerticalSpacing(int spacing)
Sets the spacing (in co-ordinate terms) between the horizontal lines

Parameters:
spacing - The spacing to use

printSVG

public void printSVG(java.io.File f,
                     boolean showLengths)
              throws java.io.IOException,
                     TreeException
Prints the tree to the given file

Parameters:
f - The file to print to
showLengths - Display branch lengths on output
Throws:
java.io.IOException - Thrown if there is a problem writing the file
TreeException - Thrown if there is a problem with the tree