|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.olduvai.treejuxtaposer.TreeJuxtaposer
public class TreeJuxtaposer
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".
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 |
---|
public static final java.lang.String versionNumber
protected java.awt.Frame mainFrame
private java.lang.String title
protected StateFrame stateFrame
protected SettingsFrame settingsFrame
private IncrementalSearch searchFrame
protected net.sourceforge.olduvai.treejuxtaposer.DebugFrame debugFrame
private java.awt.Panel drawPanel
private java.awt.GridLayout drawLayout
protected java.util.ArrayList treeDrawers
trees
).
private java.util.ArrayList ATDMatrix
protected java.util.ArrayList trees
treeDrawers
).
protected java.util.LinkedList groups
groupsByIndex
for
the marking group list by index.
private java.util.Vector groupsByIndex
groups
for the rearrangeable priority list.
private TreePairs TPs
private java.awt.Color backgroundColor
private java.awt.Color objectColor
private java.awt.Color labelColor
private java.awt.Color labelBackColor
private java.awt.Color labelHiColor
private java.awt.Color labelBackHiColor
protected static int treeCount
private CellGeom flashGeomOld
private boolean matrix
protected int linethickness
private int treeArgs
private boolean quasimode
private AccordionTreeDrawer wantsFocusATD
private int edgeweightLevels
private int edgeweightLevelUsed
private UI ui
private float bcnScore
public java.util.ArrayList lcaNode
Constructor Detail |
---|
public TreeJuxtaposer()
Method Detail |
---|
protected void wantsFocusInQuasi(AccordionTreeDrawer atd)
atd
- The last drawer that had focus, prior to the cursor leaving. For
remembering how to undraw an old flash draw.protected void setQuasimode(boolean on)
wantsFocusATD
) if quasimode
was on and is being turned off.
on
- protected boolean getQuasimode()
public void updateTitle()
public void addTree(Tree newTree, javax.swing.JProgressBar jpb)
newTree
- New tree to add. Each existing tree will be compared with this new one.jpb
- Progress bar.Tree
,
TreePairs.addTree(Tree, int, boolean)
public void addOneTreeStructuralDiffs()
doOneDiff(int, int)
with each tree vs the last tree.
public void redoStructuralDiffs()
doOneDiff(int, int)
with each possible pair of trees.
public void doOneDiff(int oneIndex, int twoIndex)
redoStructuralDiffs()
and addOneTreeStructuralDiffs()
.
oneIndex
- Index of first tree.twoIndex
- Index of second tree.private AccordionTreeDrawerFinal addATD(Tree newTree, int width, int height, javax.swing.JProgressBar jpb)
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.
public void deleteTrees(int[] treeNums)
treeNums
- List of indices of trees to delete.public void postDeleteTrees()
public Tree getTreeByName(java.lang.String name)
name
- String representation of a tree by its file name.
protected void addAction()
UI
object.
protected void quitAction()
UI
object.
public void requestRedrawAll()
AccordionDrawer.requestRedraw()
.
public boolean isLoaded()
public void addNamesToSearchList()
public RangeList addGroup(int groupNum, boolean thisTreeOnly)
groups
.
thisTreeOnly
- True if the marks for this group apply only to a single tree.
public void setGroupPriority(int group)
group
- Group to make the newest top-drawn, all others shift down 1 spot.public void clearDrawers()
private void ascendTreeMark(AccordionTreeDrawer atd, AccordionTreeDrawer currTree, TreeNode n, RangeList addToGroup)
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).private void descendTreeMark(AccordionTreeDrawer atd, AccordionTreeDrawer currTree, TreeNode n, RangeList addToGroup)
atd
- Drawer that marked node (subtree) is in, used to reference the tree pair objectcurrTree
- Target tree (drawer), where the node to be marked (indirectly marked node) isn
- 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.public void addNodesToGroup(int min, int max, int group, AccordionTreeDrawer atd)
Tree2Tree
.
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.public java.awt.Color getGroupColor(int group)
group
- Group ID, from StateFrame
constants for group ID.
public void clearGroup(int group)
group
- Key of group to clear.public void unmarkGroup(int group)
group
- Key of the group to unmark.protected RangeList getGroupByID(int groupID)
groupID
- ID of the marking group, as defined in StateFrame
.
private void seedGroups(AccordionTreeDrawerFinal atd)
atd
- Drawer to use for group marking lookup.private int[] getStaticSeedBounds(StaticSplitLine sl, int maxSplitIndex)
sl
- Split line to get movement restricting split lines.maxSplitIndex
- Maximum split index for the seeding range.
protected void seedQueue(AccordionTreeDrawerFinal atd)
atd
- Drawer that we are seeding.protected java.util.ArrayList getColorsForRange(int objMin, int objMax, AccordionTreeDrawer callingTreeDrawer)
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.
protected void doFlashGeom(CellGeom flashGeom, int group, AccordionTreeDrawerFinal thisTree, int x, int y)
AccordionTreeDrawer.flashDraw()
, do lightweight frontbuffer drawing per item not whole
screen redraw.
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.Tree
,
TreeNode
,
RangeList
protected void doSelectGeom(TreeNode g, boolean selectSubtree, int group, AccordionTreeDrawer thisTree)
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.protected void doLCAGeom(int group, AccordionTreeDrawer thisTree)
group
- LCA group key.thisTree
- Tree drawer to use for searching for the best LCA skeleton.protected void doStructuralDiff(AccordionTreeDrawer atd1, AccordionTreeDrawer atd2, int group)
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.Tree
,
TreeNode
,
TreePairs
protected void setFocus(CellGeom g, AccordionTreeDrawer atd)
g
- Tree node to focus on.atd
- Drawer that has the tree node.public java.lang.String getLabelByFQName(java.lang.String FQName)
FQName
- The full name of a node.
public void setDimBrite(boolean on)
on
- True if we draw deeper nodes more grey (default), false for solid black coloring.public void toggleDimBrite()
public boolean getDimBrite()
public void setDimColors(boolean on)
on
- True if we draw deeper nodes dimmer, false for solid coloring (default).public void toggleDimColors()
public boolean getDimColors()
public void toggleDumpStats()
AccordionDrawer.dumpstats
public void increaseLabelBuffer(int xy)
xy
- Direction of interest.public void decreaseLabelBuffer(int xy)
xy
- Direction of interest.public void toggleLabelDrawBack()
public void toggleLabelPosRight()
public void toggleDrawSplits()
public void increaseLineThickness()
public void decreaseLineThickness()
public void setLinkedNav(boolean on)
on
- New value for linked navigation: true = do linked navigation.public void toggleLinkedNav()
public boolean getLinkedNav()
AccordionDrawer.linkednav
.
public void increaseMaxFontHeight()
public void decreaseMaxFontHeight()
public void increaseMinFontHeight()
public void decreaseMinFontHeight()
public void toggleNoFlash()
public void setDrawLabels(boolean on)
on
- True: draw labels for each visible tree node (default). False: do not draw the tree labels.public void setDrawGeoms(boolean on)
on
- True: draw edges for each visible tree node (default). False: do not draw the tree nodes.public void toggleDrawGeoms()
public void setDrawGrid(boolean on)
on
- True: draw the grid lines for all trees. False: no grid (default).public void toggleDrawGrid()
public boolean getLCAGroup()
public boolean getLCAMark()
stateFrame
.
public void reset()
public java.util.ArrayList getGroupForest(int groupindex, AccordionTreeDrawer atd)
groupindex
- Index of group (from StateFrame.getActionGroup()
) to resize.atd
- Drawer to resize in. Objects returned will all be from this drawer.
public void resizeGroup(RangeList group, int numSteps, boolean grow, AccordionTreeDrawer atd)
group
- Marked list of objects to grow.numSteps
- Number of animation steps.grow
- Growing if true, shrinking if false.atd
- Drawer to resize in.public void resizeGroup(RangeList group, int numSteps, boolean grow)
resizeGroup(RangeList, int, boolean, AccordionTreeDrawer)
on each drawer.
group
- Marked list of objects to grow.numSteps
- Number of animation steps.grow
- Growing if true, shrinking if false.public void resizeRectOthers(TreeNode tn, double[] changeRatio, int numAnimSteps, AccordionTreeDrawer thisatd)
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.protected void loadTree(java.lang.String fileName, java.util.Vector nexusNumbers)
fileName
- Name of the nexus file.nexusNumbers
- List of indices to load from the nexus file. All trees are loaded if this is null.private void loadNewickTree(java.lang.String fileName)
loadTree(String)
if nexus is not detected.
fileName
- File name for the newick tree.protected void loadTree(java.lang.String fname) throws java.io.FileNotFoundException
fname
- File name to load.
java.io.FileNotFoundException
public static void main(java.lang.String[] args)
args
- See README file for full set of supported command line arguments.public void setBcnScore(float score)
bcnScore
.
Set by the slider in settings.
score
- New filtering score.public float getBcnScore()
public void setProgressiveOn(boolean on)
on
- New state of progressive rendering: true == active.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |