net.sourceforge.olduvai.treejuxtaposer
Class TreeJuxtaposer

java.lang.Object
  extended by net.sourceforge.olduvai.treejuxtaposer.TreeJuxtaposer

public class TreeJuxtaposer
extends java.lang.Object

A class representing a tree juxtaposer. This is the main application class, which controls all the drawer objects and trees within those drawers. A TreeJuxtaposer takes a set of trees and build the data structures for each pair for best corresponding nodes lookup and range intersection queries. The TreePairs class encapsulates all the Tree2Tree classes required to relate pairs of trees in the list "trees".

Version:
2.1
Author:
Tamara Munzner, Serdar Tasiran, Li Zhang, Yunhong Zhou
See Also:
Tree, TreeNode, CellGeom, TreePairs, AccordionTreeDrawer, AccordionTreeDrawerFinal

Field Summary
private  java.util.ArrayList ATDMatrix
          List of lists of tree drawers, each list is a row of drawers in the matrix layout.
private  java.awt.Color backgroundColor
          Background color for the canvas.
private  float bcnScore
          BCN filtering score for the entire tree.
protected  net.sourceforge.olduvai.treejuxtaposer.DebugFrame debugFrame
          Debugging frame, for reporting information that is meant to be hidden on releases.
private  java.awt.GridLayout drawLayout
          Layout manager for the drawing panel.
private  java.awt.Panel drawPanel
          Drawing panel (canvas panel) for the main frame.
private  int edgeweightLevels
          Number of edge weights increments to compute.
private  int edgeweightLevelUsed
          Use a subset of the edge weight levels, to a maximum of this value.
private  CellGeom flashGeomOld
          "Old" geometry from a previous flash action, which is stored in its original state in the pixel buffer.
protected  java.util.LinkedList groups
          Rearrangable list of RangeLists (groups).
private  java.util.Vector groupsByIndex
          List of marking groups by index.
private  java.awt.Color labelBackColor
          Color for label background of normal (not highlighted) nodes.
private  java.awt.Color labelBackHiColor
          Color for the label background for highlighted nodes.
private  java.awt.Color labelColor
          Color for labels of normal (not highlighted) nodes.
private  java.awt.Color labelHiColor
          Color for labels for highlighted nodes.
 java.util.ArrayList lcaNode
          List of TreeNodes that are marked with the LCA group color.
protected  int linethickness
          Thickness of tree edge lines for default non-marked nodes.
protected  java.awt.Frame mainFrame
          Frame object for holding everything.
private  boolean matrix
          True for matrix mode, not supported.
private  java.awt.Color objectColor
          Default node color.
private  boolean quasimode
          Quasimode: true when resizing subtrees with linked navigation control.
private  IncrementalSearch searchFrame
          Incremental search frame, for doing text searches.
protected  SettingsFrame settingsFrame
          Settings frame object, for changing font size, progressive rendering, and other options.
protected  StateFrame stateFrame
          State frame object, for manipulating which marking group is active for resizing or coloring.
private  java.lang.String title
          Title for the application.
private  TreePairs TPs
          An array of TreePairs objects: each TreePair contains the necessary data structures for the differences and node correspondences between nodes in a pair of trees.
private  int treeArgs
          Number of arguments passed to application.
protected static int treeCount
          Number of tree objects.
protected  java.util.ArrayList treeDrawers
          Resizeable array of AccordionTreeDrawerFinal objects (not trees, which are trees).
protected  java.util.ArrayList trees
          Resizeable array of Tree objects (not drawers, which are treeDrawers).
private  UI ui
          Object for controlling user interface functions directed from the top menu (FILE, HELP, etc), to separate the menu functionality handling (string names, setup, etc) from the application.
static java.lang.String versionNumber
          Version string for this application.
private  AccordionTreeDrawer wantsFocusATD
          The last used accordion tree drawer, which will be the drawer that gets focus if focus is regained after being lost.
 
Constructor Summary
TreeJuxtaposer()
          Main constructor for the TJ object, initializes states, and user interfaces.
 
Method Summary
protected  void addAction()
          Wrapper for calling the add tree option in the UI object.
private  AccordionTreeDrawerFinal addATD(Tree newTree, int width, int height, javax.swing.JProgressBar jpb)
          Utility function to make new AccordionTreeDrawer, set initial parameters and do treeDrawer list bookkeeping.
 RangeList addGroup(int groupNum, boolean thisTreeOnly)
          Add a group to the set of all markable groups groups.
 void addNamesToSearchList()
          Initialize the searching dialog with the set of tree node labels.
 void addNodesToGroup(int min, int max, int group, AccordionTreeDrawer atd)
          Add nodes indirectly marked in each tree.
 void addOneTreeStructuralDiffs()
          Helper to process the last tree as a special case, do diffs for tree n-1 wrt each of the others.
 void addTree(Tree newTree, javax.swing.JProgressBar jpb)
          Adds a new tree to "trees", performs all the pairwise tree comparisons and stores results.
private  void ascendTreeMark(AccordionTreeDrawer atd, AccordionTreeDrawer currTree, TreeNode n, RangeList addToGroup)
          Ascend from the given node and add nodes to the marking group if the BCN of ancestors have been marked before.
 void clearDrawers()
          Clear state in all accordion drawers.
 void clearGroup(int group)
          Force clear the contents of the given group without unmarking the LCA group.
 void decreaseLabelBuffer(int xy)
          Decrement the label buffer (the minimum distance between two labels) in the given direction.
 void decreaseLineThickness()
          Decrement the width of tree edge lines in each drawer.
 void decreaseMaxFontHeight()
          Decrement the maximum font height in each drawer.
 void decreaseMinFontHeight()
          Decrement the minimum font height by one in each drawer.
 void deleteTrees(int[] treeNums)
          Delete a tree from "trees", clean up all the data structures constructed for tree comparisons.
private  void descendTreeMark(AccordionTreeDrawer atd, AccordionTreeDrawer currTree, TreeNode n, RangeList addToGroup)
          Recursively descend subtree and mark descendants, including BCN for each node marked in each drawer.
protected  void doFlashGeom(CellGeom flashGeom, int group, AccordionTreeDrawerFinal thisTree, int x, int y)
          Callback function from cursor movement highlighting.
protected  void doLCAGeom(int group, AccordionTreeDrawer thisTree)
          Find the LCA skeleton (minimal paths) for the nodes marked while the LCA box is active.
 void doOneDiff(int oneIndex, int twoIndex)
          A single diff process.
protected  void doSelectGeom(TreeNode g, boolean selectSubtree, int group, AccordionTreeDrawer thisTree)
          Wrapper for adding nodes to a group when user selects a subtree or node for user-directed marking.
protected  void doStructuralDiff(AccordionTreeDrawer atd1, AccordionTreeDrawer atd2, int group)
          Compute best matching nodes between two trees A node X is perfectly matched by a node Y if they have exactly the same leaf set.
 float getBcnScore()
          Access the bcn filtering score for this tree.
protected  java.util.ArrayList getColorsForRange(int objMin, int objMax, AccordionTreeDrawer callingTreeDrawer)
          Get the list of colors for a range of tree nodes.
 boolean getDimBrite()
          Get state of the non-colored node rendering, either dimmed edges according to a node's tree depth (true) or all black (false).
 boolean getDimColors()
          Get state of the color rendering, either dimmed colors according to a node's tree depth (true) or equal saturation (false).
protected  RangeList getGroupByID(int groupID)
          Get the marked group (a rangelist) by the given id tag.
 java.awt.Color getGroupColor(int group)
          Get the color for the chosen group.
 java.util.ArrayList getGroupForest(int groupindex, AccordionTreeDrawer atd)
          Return an array of tree nodes to resize per group range item.
 java.lang.String getLabelByFQName(java.lang.String FQName)
          Return the label for a node, given its full name.
 boolean getLCAGroup()
          Test to see if LCA group resize is active.
 boolean getLCAMark()
          Get state of LCA marking from the stateFrame.
 boolean getLinkedNav()
          Get the state of the linked navigation flag, which is stored in the first tree drawer, AccordionDrawer.linkednav.
protected  boolean getQuasimode()
          Returns state of the quasi-mode flag.
private  int[] getStaticSeedBounds(StaticSplitLine sl, int maxSplitIndex)
          Get the split line boundaries for the given split line, properly ordered in the return value [min, max].
 Tree getTreeByName(java.lang.String name)
          Fetch a tree by its name.
 void increaseLabelBuffer(int xy)
          Increment the label buffer (the minimum distance between two labels) in the given direction.
 void increaseLineThickness()
          Increment the width of tree edge lines in each drawer.
 void increaseMaxFontHeight()
          Increment the maximum font height in each drawer.
 void increaseMinFontHeight()
          Increment the minimum font height in each drawer.
 boolean isLoaded()
          Detect loading status of tree files, initially set to false, sets to true after all trees have been loaded and first drawing cycles can start.
private  void loadNewickTree(java.lang.String fileName)
          Load a newick tree.
protected  void loadTree(java.lang.String fname)
          Wrapper for loading all type of supported trees.
protected  void loadTree(java.lang.String fileName, java.util.Vector nexusNumbers)
          For loading specific nexus trees from the command line (or all trees if vector is null).
static void main(java.lang.String[] args)
          Main application function.
 void postDeleteTrees()
          Post-processing following a tree delete.
protected  void quitAction()
          Wrapper for calling the quit option in the UI object.
 void redoStructuralDiffs()
          Complete do-over of structural diffs with all pairs of all trees.
 void requestRedrawAll()
          Initiate a redraw in all drawer objects by calling AccordionDrawer.requestRedraw().
 void reset()
          Reset iterator: resets all drawers.
 void resizeGroup(RangeList group, int numSteps, boolean grow)
          Grow a marked group of objects in all drawers.
 void resizeGroup(RangeList group, int numSteps, boolean grow, AccordionTreeDrawer atd)
          Resize the group in the given drawer.
 void resizeRectOthers(TreeNode tn, double[] changeRatio, int numAnimSteps, AccordionTreeDrawer thisatd)
          Linked navigation function to iterate changes over all drawers.
private  void seedGroups(AccordionTreeDrawerFinal atd)
          Seed the marked groups for the given accordion drawer.
protected  void seedQueue(AccordionTreeDrawerFinal atd)
          Seed the queue for the given drawer.
 void setBcnScore(float score)
          Sets bcn filtering score, shows differences if nodeBCNScore < bcnScore.
 void setDimBrite(boolean on)
          Set state of the non-colored node rendering, either dimmed edges according to a node's tree depth (true) or all black (false).
 void setDimColors(boolean on)
          Set state of the color rendering, either dimmed colors according to a node's tree depth (true) or equal saturation (false).
 void setDrawGeoms(boolean on)
          Turn on/off tree nodes.
 void setDrawGrid(boolean on)
          Turn on/off grid drawing.
 void setDrawLabels(boolean on)
          Turn on/off tree labels.
protected  void setFocus(CellGeom g, AccordionTreeDrawer atd)
          Set the focus, for each drawer, to the given tree node in the given drawer.
 void setGroupPriority(int group)
          Change the priority of user mark groups, to layer the most important (latest) changed marks over previously changed groups.
 void setLinkedNav(boolean on)
          Set the state of linked navigation to the given value.
 void setProgressiveOn(boolean on)
          Toggles progressive rendering.
protected  void setQuasimode(boolean on)
          Turns the quasimode to the value of "on".
 void toggleDimBrite()
          Toggle state of the non-colored node rendering, either dimmed edges according to a node's tree depth (true) or all black (false).
 void toggleDimColors()
          Toggle state of the color rendering, either dimmed colors according to a node's tree depth (true) or equal saturation (false).
 void toggleDrawGeoms()
          Toggle state of drawing tree nodes (geoms).
 void toggleDrawGrid()
          Toggle state of drawing grid on all drawers.
 void toggleDrawSplits()
          Toggle for drawing split lines (grid lines).
 void toggleDumpStats()
          Toggle debug state of sending rendering time information or other real-time information to a log file.
 void toggleLabelDrawBack()
          Toggle the drawing of the label background (for non-highlighted nodes).
 void toggleLabelPosRight()
          Toggle for drawing labels on the right side of edges, or by the node junction between tree edges.
 void toggleLinkedNav()
          Toggle the state of linked navigation in all drawers.
 void toggleNoFlash()
          Toggle state of flash (mouse-over) drawing on all drawers.
 void unmarkGroup(int group)
          Remove LCA marked objects from the given group, then clear the contents of the group, which will force the previously marked objects to not be marked by that group's color.
 void updateTitle()
          Update the title bar for the application.
protected  void wantsFocusInQuasi(AccordionTreeDrawer atd)
          Called back when the mouse re-enters the main frame, gives focus to the last drawer to have it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionNumber

public static final java.lang.String versionNumber
Version string for this application.

See Also:
Constant Field Values

mainFrame

protected java.awt.Frame mainFrame
Frame object for holding everything.


title

private java.lang.String title
Title for the application. This changes depending on what trees are loaded.


stateFrame

protected StateFrame stateFrame
State frame object, for manipulating which marking group is active for resizing or coloring.


settingsFrame

protected SettingsFrame settingsFrame
Settings frame object, for changing font size, progressive rendering, and other options.


searchFrame

private IncrementalSearch searchFrame
Incremental search frame, for doing text searches.


debugFrame

protected net.sourceforge.olduvai.treejuxtaposer.DebugFrame debugFrame
Debugging frame, for reporting information that is meant to be hidden on releases.


drawPanel

private java.awt.Panel drawPanel
Drawing panel (canvas panel) for the main frame.


drawLayout

private java.awt.GridLayout drawLayout
Layout manager for the drawing panel. Makes new tree drawers appear to the right of old ones.


treeDrawers

protected java.util.ArrayList treeDrawers
Resizeable array of AccordionTreeDrawerFinal objects (not trees, which are trees).


ATDMatrix

private java.util.ArrayList ATDMatrix
List of lists of tree drawers, each list is a row of drawers in the matrix layout.


trees

protected java.util.ArrayList trees
Resizeable array of Tree objects (not drawers, which are treeDrawers).


groups

protected java.util.LinkedList groups
Rearrangable list of RangeLists (groups). See groupsByIndex for the marking group list by index.


groupsByIndex

private java.util.Vector groupsByIndex
List of marking groups by index. This is static once initialized. See groups for the rearrangeable priority list.


TPs

private TreePairs TPs
An array of TreePairs objects: each TreePair contains the necessary data structures for the differences and node correspondences between nodes in a pair of trees.


backgroundColor

private java.awt.Color backgroundColor
Background color for the canvas.


objectColor

private java.awt.Color objectColor
Default node color.


labelColor

private java.awt.Color labelColor
Color for labels of normal (not highlighted) nodes.


labelBackColor

private java.awt.Color labelBackColor
Color for label background of normal (not highlighted) nodes.


labelHiColor

private java.awt.Color labelHiColor
Color for labels for highlighted nodes.


labelBackHiColor

private java.awt.Color labelBackHiColor
Color for the label background for highlighted nodes.


treeCount

protected static int treeCount
Number of tree objects. Used to set the key for trees.


flashGeomOld

private CellGeom flashGeomOld
"Old" geometry from a previous flash action, which is stored in its original state in the pixel buffer.


matrix

private boolean matrix
True for matrix mode, not supported. Matrix mode is pair-wise differences between trees, and n^2 drawers for n loaded trees. Trees on the diagonal are original trees, and differences are computed everywhere else.


linethickness

protected int linethickness
Thickness of tree edge lines for default non-marked nodes.


treeArgs

private int treeArgs
Number of arguments passed to application.


quasimode

private boolean quasimode
Quasimode: true when resizing subtrees with linked navigation control.


wantsFocusATD

private AccordionTreeDrawer wantsFocusATD
The last used accordion tree drawer, which will be the drawer that gets focus if focus is regained after being lost.


edgeweightLevels

private int edgeweightLevels
Number of edge weights increments to compute.


edgeweightLevelUsed

private int edgeweightLevelUsed
Use a subset of the edge weight levels, to a maximum of this value.


ui

private UI ui
Object for controlling user interface functions directed from the top menu (FILE, HELP, etc), to separate the menu functionality handling (string names, setup, etc) from the application.


bcnScore

private float bcnScore
BCN filtering score for the entire tree. Nodes with BCN less than this value are marked as different.


lcaNode

public java.util.ArrayList lcaNode
List of TreeNodes that are marked with the LCA group color. Redundant with the LCA group?

Constructor Detail

TreeJuxtaposer

public TreeJuxtaposer()
Main constructor for the TJ object, initializes states, and user interfaces.

Method Detail

wantsFocusInQuasi

protected void wantsFocusInQuasi(AccordionTreeDrawer atd)
Called back when the mouse re-enters the main frame, gives focus to the last drawer to have it.

Parameters:
atd - The last drawer that had focus, prior to the cursor leaving. For remembering how to undraw an old flash draw.

setQuasimode

protected void setQuasimode(boolean on)
Turns the quasimode to the value of "on". Also sets the focus (wantsFocusATD) if quasimode was on and is being turned off.

Parameters:
on -

getQuasimode

protected boolean getQuasimode()
Returns state of the quasi-mode flag.

Returns:
True if quasimode is set, false if the quasimode is not set.

updateTitle

public void updateTitle()
Update the title bar for the application. The title will be a version string, followed by the names of the trees in order.


addTree

public void addTree(Tree newTree,
                    javax.swing.JProgressBar jpb)
Adds a new tree to "trees", performs all the pairwise tree comparisons and stores results.

Parameters:
newTree - New tree to add. Each existing tree will be compared with this new one.
jpb - Progress bar.
See Also:
Tree, TreePairs.addTree(Tree, int, boolean)

addOneTreeStructuralDiffs

public void addOneTreeStructuralDiffs()
Helper to process the last tree as a special case, do diffs for tree n-1 wrt each of the others. Uses doOneDiff(int, int) with each tree vs the last tree.


redoStructuralDiffs

public void redoStructuralDiffs()
Complete do-over of structural diffs with all pairs of all trees. Must be done after a node has been relabeled (leaf nodes, to be exact) to get accurate differences. Uses doOneDiff(int, int) with each possible pair of trees.


doOneDiff

public void doOneDiff(int oneIndex,
                      int twoIndex)
A single diff process. Used by redoStructuralDiffs() and addOneTreeStructuralDiffs().

Parameters:
oneIndex - Index of first tree.
twoIndex - Index of second tree.

addATD

private AccordionTreeDrawerFinal addATD(Tree newTree,
                                        int width,
                                        int height,
                                        javax.swing.JProgressBar jpb)
Utility function to make new AccordionTreeDrawer, set initial parameters and do treeDrawer list bookkeeping.

Parameters:
newTree - Tree that will belong to the new drawer.
width - Width of the new drawer window/canvas.
height - Height of the new drawer window/canvas.
jpb - Progress bar for this tree.
Returns:
New drawer object for the given tree.

deleteTrees

public void deleteTrees(int[] treeNums)
Delete a tree from "trees", clean up all the data structures constructed for tree comparisons.

Parameters:
treeNums - List of indices of trees to delete.

postDeleteTrees

public void postDeleteTrees()
Post-processing following a tree delete. Clears marked groups and recomputes differences on all tree pairs.


getTreeByName

public Tree getTreeByName(java.lang.String name)
Fetch a tree by its name. This is done by linear search as we do not expect to have many trees in memory.

Parameters:
name - String representation of a tree by its file name.
Returns:
Tree object that matches the string, or null if not found.

addAction

protected void addAction()
Wrapper for calling the add tree option in the UI object.


quitAction

protected void quitAction()
Wrapper for calling the quit option in the UI object.


requestRedrawAll

public void requestRedrawAll()
Initiate a redraw in all drawer objects by calling AccordionDrawer.requestRedraw().


isLoaded

public boolean isLoaded()
Detect loading status of tree files, initially set to false, sets to true after all trees have been loaded and first drawing cycles can start. Avoids any attempts by the drawing thread to pre-emptively draw before grids have been consructed.

Returns:
True: all data files have been loaded and trees may be drawn, false: data still being loaded/processed, drawing is delayed.

addNamesToSearchList

public void addNamesToSearchList()
Initialize the searching dialog with the set of tree node labels.


addGroup

public RangeList addGroup(int groupNum,
                          boolean thisTreeOnly)
Add a group to the set of all markable groups groups.

Parameters:
thisTreeOnly - True if the marks for this group apply only to a single tree.
Returns:
The group that was added

setGroupPriority

public void setGroupPriority(int group)
Change the priority of user mark groups, to layer the most important (latest) changed marks over previously changed groups.

Parameters:
group - Group to make the newest top-drawn, all others shift down 1 spot.

clearDrawers

public void clearDrawers()
Clear state in all accordion drawers. Does not erase the drawn edges, only resets interaction boxes.


ascendTreeMark

private void ascendTreeMark(AccordionTreeDrawer atd,
                            AccordionTreeDrawer currTree,
                            TreeNode n,
                            RangeList addToGroup)
Ascend from the given node and add nodes to the marking group if the BCN of ancestors have been marked before. Stop looping when a node is found to be marked (assume that ancestor checks have already been done in that case).

Parameters:
atd - Directly marked tree, where the direct marks were made that led to finding the indirectly marked input node/tree combination.
currTree - Indirectly marked tree that contains the given indirectly marked node.
n - Indirectly marked node that is found in currTree.
addToGroup - Group that marked nodes will be added to (and checked for previous marks).

descendTreeMark

private void descendTreeMark(AccordionTreeDrawer atd,
                             AccordionTreeDrawer currTree,
                             TreeNode n,
                             RangeList addToGroup)
Recursively descend subtree and mark descendants, including BCN for each node marked in each drawer. This takes a drawer target and a seed node, and descends the subtree of that node, looking for previously marked nodes. The backwards checking done here reflects the original implementation of BCN from TJ 1.0.

Parameters:
atd - Drawer that marked node (subtree) is in, used to reference the tree pair object
currTree - Target tree (drawer), where the node to be marked (indirectly marked node) is
n - The BCN of a node in the indirectly marked tree (belonging to currTree), that will have its children (and additional descendants) examined for marking potential.
addToGroup - Marking group to add the indirectly marked nodes.

addNodesToGroup

public void addNodesToGroup(int min,
                            int max,
                            int group,
                            AccordionTreeDrawer atd)
Add nodes indirectly marked in each tree. The best corresponding node lookups use the previously initialized results from Tree2Tree.

Parameters:
min - Minimum node in the range of nodes to add.
max - Maximum node in the range of nodes to add.
group - Group to add nodes in range to.
atd - Drawer that contained tree for the given range of marked nodes.

getGroupColor

public java.awt.Color getGroupColor(int group)
Get the color for the chosen group.

Parameters:
group - Group ID, from StateFrame constants for group ID.
Returns:
Color stored by the marking group, in its RangeList object.

clearGroup

public void clearGroup(int group)
Force clear the contents of the given group without unmarking the LCA group.

Parameters:
group - Key of group to clear.

unmarkGroup

public void unmarkGroup(int group)
Remove LCA marked objects from the given group, then clear the contents of the group, which will force the previously marked objects to not be marked by that group's color.

Parameters:
group - Key of the group to unmark.

getGroupByID

protected RangeList getGroupByID(int groupID)
Get the marked group (a rangelist) by the given id tag.

Parameters:
groupID - ID of the marking group, as defined in StateFrame.
Returns:
A valid marked group object, that contains a list of ranges of tree nodes and a color that they should be marked in.

seedGroups

private void seedGroups(AccordionTreeDrawerFinal atd)
Seed the marked groups for the given accordion drawer. Add one leaf node in each marked subtree, or internal nodes for individually marked nodes. A skeleton is drawn for marked nodes, so we don't waste time rendering entire marked subtrees, but draw a single path from one of the deepest nodes (such as a leaf) to the root. This gives fast visual indications of group location during partially drawn frames of a progressively rendered scene.

Parameters:
atd - Drawer to use for group marking lookup.

getStaticSeedBounds

private int[] getStaticSeedBounds(StaticSplitLine sl,
                                  int maxSplitIndex)
Get the split line boundaries for the given split line, properly ordered in the return value [min, max].

Parameters:
sl - Split line to get movement restricting split lines.
maxSplitIndex - Maximum split index for the seeding range.
Returns:
Pair of indices that are positions of split lines that bound the input split line.

seedQueue

protected void seedQueue(AccordionTreeDrawerFinal atd)
Seed the queue for the given drawer. Order matters: first the interaction box, then marked groups, then everything else.

Parameters:
atd - Drawer that we are seeding.

getColorsForRange

protected java.util.ArrayList getColorsForRange(int objMin,
                                                int objMax,
                                                AccordionTreeDrawer callingTreeDrawer)
Get the list of colors for a range of tree nodes. A built-in group precedence ordering determines which group color wins out. This function stops when it finds the first valid drawing color. We guarantee that the results of this function are necessary to represent the accurate drawing of the tree, as if all nodes are drawn, but only one representative object is drawn in this range.

Parameters:
objMin - Minimum value for object keys in range.
objMax - Maximum value for object keys in range.
callingTreeDrawer - Tree drawer to use for object index lookups.
Returns:
List of colors, each color representing a group that is between objMin and objMax.

doFlashGeom

protected void doFlashGeom(CellGeom flashGeom,
                           int group,
                           AccordionTreeDrawerFinal thisTree,
                           int x,
                           int y)
Callback function from cursor movement highlighting. Acts as a toggle on group members in the flash drawing group: turn off (remove) old ones, turn on (add) new ones. In the drawing function AccordionTreeDrawer.flashDraw(), do lightweight frontbuffer drawing per item not whole screen redraw.

Parameters:
flashGeom - Geometry (tree node) that we are currently highlighting with the cursor.
group - Index for the flash drawing group.
thisTree - Tree drawer that the geometry is within.
x - Cursor X position.
y - Cursor Y position.
See Also:
Tree, TreeNode, RangeList

doSelectGeom

protected void doSelectGeom(TreeNode g,
                            boolean selectSubtree,
                            int group,
                            AccordionTreeDrawer thisTree)
Wrapper for adding nodes to a group when user selects a subtree or node for user-directed marking.

Parameters:
g - TreeNode that was marked.
selectSubtree - True if subtree marking mode is on (false for single node marking).
group - Index of group to add node(s) to.
thisTree - Tree in which the node was marked.

doLCAGeom

protected void doLCAGeom(int group,
                         AccordionTreeDrawer thisTree)
Find the LCA skeleton (minimal paths) for the nodes marked while the LCA box is active.

Parameters:
group - LCA group key.
thisTree - Tree drawer to use for searching for the best LCA skeleton.

doStructuralDiff

protected void doStructuralDiff(AccordionTreeDrawer atd1,
                                AccordionTreeDrawer atd2,
                                int group)
Compute best matching nodes between two trees A node X is perfectly matched by a node Y if they have exactly the same leaf set. The matching for a pair of nodes is the ratio between the number of common nodes (nodes in each set) to the number of total nodes (nodes in both sets).

Parameters:
atd1 - First tree drawer to use as the basis of comparison.
atd2 - Second tree drawer to compare with the first.
group - Group number for computed differences.
See Also:
Tree, TreeNode, TreePairs

setFocus

protected void setFocus(CellGeom g,
                        AccordionTreeDrawer atd)
Set the focus, for each drawer, to the given tree node in the given drawer.

Parameters:
g - Tree node to focus on.
atd - Drawer that has the tree node.

getLabelByFQName

public java.lang.String getLabelByFQName(java.lang.String FQName)
Return the label for a node, given its full name. Search each tree for the node, and return the label of the first match.

Parameters:
FQName - The full name of a node.
Returns:
The label that is shown for the found node, or null if the full name was not found.

setDimBrite

public void setDimBrite(boolean on)
Set state of the non-colored node rendering, either dimmed edges according to a node's tree depth (true) or all black (false).

Parameters:
on - True if we draw deeper nodes more grey (default), false for solid black coloring.

toggleDimBrite

public void toggleDimBrite()
Toggle state of the non-colored node rendering, either dimmed edges according to a node's tree depth (true) or all black (false).


getDimBrite

public boolean getDimBrite()
Get state of the non-colored node rendering, either dimmed edges according to a node's tree depth (true) or all black (false).

Returns:
True if we draw deeper nodes more grey (default), false for solid black coloring.

setDimColors

public void setDimColors(boolean on)
Set state of the color rendering, either dimmed colors according to a node's tree depth (true) or equal saturation (false).

Parameters:
on - True if we draw deeper nodes dimmer, false for solid coloring (default).

toggleDimColors

public void toggleDimColors()
Toggle state of the color rendering, either dimmed colors according to a node's tree depth (true) or equal saturation (false).


getDimColors

public boolean getDimColors()
Get state of the color rendering, either dimmed colors according to a node's tree depth (true) or equal saturation (false).

Returns:
True if we draw deeper nodes dimmer, false for solid coloring (default).

toggleDumpStats

public void toggleDumpStats()
Toggle debug state of sending rendering time information or other real-time information to a log file.

See Also:
AccordionDrawer.dumpstats

increaseLabelBuffer

public void increaseLabelBuffer(int xy)
Increment the label buffer (the minimum distance between two labels) in the given direction.

Parameters:
xy - Direction of interest.

decreaseLabelBuffer

public void decreaseLabelBuffer(int xy)
Decrement the label buffer (the minimum distance between two labels) in the given direction.

Parameters:
xy - Direction of interest.

toggleLabelDrawBack

public void toggleLabelDrawBack()
Toggle the drawing of the label background (for non-highlighted nodes). Default is off (false).


toggleLabelPosRight

public void toggleLabelPosRight()
Toggle for drawing labels on the right side of edges, or by the node junction between tree edges.


toggleDrawSplits

public void toggleDrawSplits()
Toggle for drawing split lines (grid lines).


increaseLineThickness

public void increaseLineThickness()
Increment the width of tree edge lines in each drawer.


decreaseLineThickness

public void decreaseLineThickness()
Decrement the width of tree edge lines in each drawer.


setLinkedNav

public void setLinkedNav(boolean on)
Set the state of linked navigation to the given value. All drawers are updated to the value.

Parameters:
on - New value for linked navigation: true = do linked navigation.

toggleLinkedNav

public void toggleLinkedNav()
Toggle the state of linked navigation in all drawers.


getLinkedNav

public boolean getLinkedNav()
Get the state of the linked navigation flag, which is stored in the first tree drawer, AccordionDrawer.linkednav.

Returns:
State of linked navigation, true for linked (default), false for no linked navigation.

increaseMaxFontHeight

public void increaseMaxFontHeight()
Increment the maximum font height in each drawer.


decreaseMaxFontHeight

public void decreaseMaxFontHeight()
Decrement the maximum font height in each drawer.


increaseMinFontHeight

public void increaseMinFontHeight()
Increment the minimum font height in each drawer.


decreaseMinFontHeight

public void decreaseMinFontHeight()
Decrement the minimum font height by one in each drawer.


toggleNoFlash

public void toggleNoFlash()
Toggle state of flash (mouse-over) drawing on all drawers.


setDrawLabels

public void setDrawLabels(boolean on)
Turn on/off tree labels.

Parameters:
on - True: draw labels for each visible tree node (default). False: do not draw the tree labels.

setDrawGeoms

public void setDrawGeoms(boolean on)
Turn on/off tree nodes.

Parameters:
on - True: draw edges for each visible tree node (default). False: do not draw the tree nodes.

toggleDrawGeoms

public void toggleDrawGeoms()
Toggle state of drawing tree nodes (geoms).


setDrawGrid

public void setDrawGrid(boolean on)
Turn on/off grid drawing.

Parameters:
on - True: draw the grid lines for all trees. False: no grid (default).

toggleDrawGrid

public void toggleDrawGrid()
Toggle state of drawing grid on all drawers.


getLCAGroup

public boolean getLCAGroup()
Test to see if LCA group resize is active.

Returns:
True if the LCA group will be resized if group resizing is selected.

getLCAMark

public boolean getLCAMark()
Get state of LCA marking from the stateFrame.

Returns:
True if LCA marking is active.

reset

public void reset()
Reset iterator: resets all drawers.


getGroupForest

public java.util.ArrayList getGroupForest(int groupindex,
                                          AccordionTreeDrawer atd)
Return an array of tree nodes to resize per group range item.

Parameters:
groupindex - Index of group (from StateFrame.getActionGroup()) to resize.
atd - Drawer to resize in. Objects returned will all be from this drawer.
Returns:
List of top level tree nodes (forest roots) to resize.

resizeGroup

public void resizeGroup(RangeList group,
                        int numSteps,
                        boolean grow,
                        AccordionTreeDrawer atd)
Resize the group in the given drawer.

Parameters:
group - Marked list of objects to grow.
numSteps - Number of animation steps.
grow - Growing if true, shrinking if false.
atd - Drawer to resize in.

resizeGroup

public void resizeGroup(RangeList group,
                        int numSteps,
                        boolean grow)
Grow a marked group of objects in all drawers. Calls resizeGroup(RangeList, int, boolean, AccordionTreeDrawer) on each drawer.

Parameters:
group - Marked list of objects to grow.
numSteps - Number of animation steps.
grow - Growing if true, shrinking if false.

resizeRectOthers

public void resizeRectOthers(TreeNode tn,
                             double[] changeRatio,
                             int numAnimSteps,
                             AccordionTreeDrawer thisatd)
Linked navigation function to iterate changes over all drawers. This only works with a single node resizing that has a best corresponding node in other drawers.

Parameters:
tn - Linking node that was selected for resizing.
changeRatio - Size of drag in X and Y (0 and 1) for the navigation.
numAnimSteps - Number of steps to animate through.
thisatd - Do not resize this drawer (where the node tn is found) since it is already done.

loadTree

protected void loadTree(java.lang.String fileName,
                        java.util.Vector nexusNumbers)
For loading specific nexus trees from the command line (or all trees if vector is null).

Parameters:
fileName - Name of the nexus file.
nexusNumbers - List of indices to load from the nexus file. All trees are loaded if this is null.

loadNewickTree

private void loadNewickTree(java.lang.String fileName)
Load a newick tree. This is called following the general loading function loadTree(String) if nexus is not detected.

Parameters:
fileName - File name for the newick tree.

loadTree

protected void loadTree(java.lang.String fname)
                 throws java.io.FileNotFoundException
Wrapper for loading all type of supported trees. Nexus detection done first, then fall back to newick. Tree is loaded into a new tree drawer.

Parameters:
fname - File name to load.
Throws:
java.io.FileNotFoundException

main

public static void main(java.lang.String[] args)
Main application function. See README for commandline arguments.

Parameters:
args - See README file for full set of supported command line arguments.

setBcnScore

public void setBcnScore(float score)
Sets bcn filtering score, shows differences if nodeBCNScore < bcnScore. Set by the slider in settings.

Parameters:
score - New filtering score.

getBcnScore

public float getBcnScore()
Access the bcn filtering score for this tree.

Returns:
BCN filtering score, stored in this class as well as on the slider.

setProgressiveOn

public void setProgressiveOn(boolean on)
Toggles progressive rendering. Changes state for each drawer for this application.

Parameters:
on - New state of progressive rendering: true == active.