Class TreeDrawing
- java.lang.Object
-
- edu.rit.compbio.phyl.TreeDrawing
-
public class TreeDrawing extends java.lang.ObjectClass TreeDrawing provides an object that draws a picture of a phylogenetic tree. The tree is specified either as a DnaSequenceTree object or as a string in a subset of Newick Standard format.Note: Class TreeDrawing is not multiple thread safe.
Newick Standard format. The subset of Newick Standard format class TreeDrawing supports is described by this BNF syntax. Nonterminal symbols are in italic font, terminal symbols are in typewriter font, | designates alternatives.
tree ::= node ;
node ::= ( childList ) nameLength
childList ::= child | child , childList
child ::= tip | node
tip ::= nameLength
nameLength ::= empty | name | : length | name : length
name ::= Any sequence of non-whitespace characters except ( ) , : ;
length ::= Floating point number, as in the Double.valueOf() methodThis subset only supports non-quoted names with no whitespace; however, any underscore character _ in a name is replaced with a space character. The full Newick Standard format supports quoted names including whitespace. For further information about Newick Standard format, see:
Here is an example tree:
"(Gibbon:10,(Orangutan:8,(Gorilla:6,(Chimp:4,Human:4)))apes)primates;"
Here is the resulting drawing:

-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classTreeDrawing.SyntaxExceptionClass TreeDrawing.SyntaxException is an exception thrown if there was a syntax error in a tree string.
-
Constructor Summary
Constructors Constructor and Description TreeDrawing()Construct a new tree drawing object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddraw(DnaSequenceTree tree)Draw a picture of the given tree.voiddraw(DnaSequenceTree tree, Drawing dwg)Draw a picture of the given tree.voiddraw(DnaSequenceTree tree, Group group)Draw a picture of the given tree.voiddraw(java.lang.String tree)Draw a picture of the given tree string.voiddraw(java.lang.String tree, Drawing dwg)Draw a picture of the given tree string.voiddraw(java.lang.String tree, Group group)Draw a picture of the given tree string.voidsetBranchLengthFormat(java.lang.String format)Specify the format with which to draw branch lengths.
-
-
-
Method Detail
-
setBranchLengthFormat
public void setBranchLengthFormat(java.lang.String format)
Specify the format with which to draw branch lengths. The format string is used to construct a java.text.DecimalFormat object. If not specified, the default format string is "0.00".- Parameters:
format- Format string.
-
draw
public void draw(DnaSequenceTree tree)
Draw a picture of the given tree. The picture is added to the default Drawing object.- Parameters:
tree- DNA sequence tree.
-
draw
public void draw(DnaSequenceTree tree, Drawing dwg)
Draw a picture of the given tree. The picture is added to the given Drawing object.- Parameters:
tree- DNA sequence tree.dwg- Drawing object.
-
draw
public void draw(DnaSequenceTree tree, Group group)
Draw a picture of the given tree. The picture is added to the given Group object.- Parameters:
tree- DNA sequence tree.group- Drawing group object.
-
draw
public void draw(java.lang.String tree) throws TreeDrawing.SyntaxExceptionDraw a picture of the given tree string. The picture is added to the default Drawing object.- Parameters:
tree- Tree as a string in Newick Standard format.- Throws:
TreeDrawing.SyntaxException- Thrown if there was a syntax error in tree.
-
draw
public void draw(java.lang.String tree, Drawing dwg) throws TreeDrawing.SyntaxExceptionDraw a picture of the given tree string. The picture is added to the given Drawing object.- Parameters:
tree- Tree as a string in Newick Standard format.dwg- Drawing object.- Throws:
TreeDrawing.SyntaxException- Thrown if there was a syntax error in tree.
-
draw
public void draw(java.lang.String tree, Group group) throws TreeDrawing.SyntaxExceptionDraw a picture of the given tree string. The picture is added to the given Group object.- Parameters:
tree- Tree as a string in Newick Standard format.group- Drawing group object.- Throws:
TreeDrawing.SyntaxException- Thrown if there was a syntax error in tree.
-
-
DMelt 3.0 © DataMelt by jWork.ORG