use of edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeDrawerNode in project clusterMaker2 by RBVI.
the class DendroView method flipSelectedATRNode.
/**
* Finds the currently selected arrays, mirror image flips them, and then
* rebuilds all necessary trees and saved data to the .jtv file.
*/
private void flipSelectedATRNode() {
int leftIndex, rightIndex;
String selectedID;
TreeDrawerNode arrayNode = invertedTreeDrawer.getNodeById(getArraySelection().getSelectedNode());
if (arrayNode == null || arrayNode.isLeaf()) {
return;
}
selectedID = arrayNode.getId();
// find the starting index of the left array tree, the ending index of the right array tree
leftIndex = getDataModel().getArrayHeaderInfo().getHeaderIndex(arrayNode.getLeft().getLeftLeaf().getId());
rightIndex = getDataModel().getArrayHeaderInfo().getHeaderIndex(arrayNode.getRight().getRightLeaf().getId());
int num = getDataModel().getDataMatrix().getNumUnappendedCol();
int[] newOrder = new int[num];
for (int i = 0; i < num; i++) {
newOrder[i] = i;
}
for (int i = 0; i <= (rightIndex - leftIndex); i++) {
newOrder[leftIndex + i] = rightIndex - i;
}
/*System.out.print("Fliping to: ");
for(int i = 0; i < newOrder.length; i++)
{
System.out.print(newOrder[i] + " ");
}
System.out.println("");*/
((TVModel) getDataModel()).reorderArrays(newOrder);
((TVModel) getDataModel()).saveOrder(newOrder);
((Observable) getDataModel()).notifyObservers();
updateATRDrawer(selectedID);
}
use of edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeDrawerNode in project clusterMaker2 by RBVI.
the class GTRView method keyPressed.
// method from KeyListener
public void keyPressed(KeyEvent e) {
if (selectedNode == null) {
return;
}
int c = e.getKeyCode();
switch(c) {
case KeyEvent.VK_UP:
selectParent();
break;
case KeyEvent.VK_LEFT:
if (selectedNode.isLeaf() == false)
selectLeft();
break;
case KeyEvent.VK_RIGHT:
if (selectedNode.isLeaf() == false)
selectRight();
break;
case KeyEvent.VK_DOWN:
if (selectedNode.isLeaf() == false) {
TreeDrawerNode right = selectedNode.getRight();
TreeDrawerNode left = selectedNode.getLeft();
if (right.getRange() > left.getRange()) {
selectRight();
} else {
selectLeft();
}
}
break;
}
}
use of edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeDrawerNode in project clusterMaker2 by RBVI.
the class GTRView method scrollToNode.
/**
* @param nodeName
*/
public void scrollToNode(String nodeName) {
TreeDrawerNode node = drawer.getNodeById(nodeName);
if (node != null) {
int index = (int) node.getIndex();
if (map.isVisible(index) == false) {
map.scrollToIndex(index);
map.notifyObservers();
}
}
}
use of edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeDrawerNode in project clusterMaker2 by RBVI.
the class GTRView method selectParent.
private void selectParent() {
TreeDrawerNode current = selectedNode;
selectedNode = current.getParent();
if (selectedNode == null) {
selectedNode = current;
return;
}
if (current == selectedNode.getLeft())
current = selectedNode.getRight();
else
current = selectedNode.getLeft();
drawer.paintSubtree(offscreenGraphics, getXScaleEq(), getYScaleEq(), destRect, current, true);
drawer.paintSingle(offscreenGraphics, getXScaleEq(), getYScaleEq(), destRect, selectedNode, true);
synchMap();
repaint();
}
use of edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeDrawerNode in project clusterMaker2 by RBVI.
the class GraphicsExportPanel method getMinGeneCorr.
/**
* This method returns the minimum correlation for the gene nodes which will be drawn.
*/
protected double getMinGeneCorr() {
if (drawSelected()) {
// if (geneTreeDrawer == null) logger.error("ExportPanel.getMinGeneCorr: geneTreeDrawer null");
TreeSelectionI selection = getGeneSelection();
// if (selection == null) logger.error("ExportPanel.getMinGeneCorr: selection null");
String selectedId = selection.getSelectedNode();
// if (selectedId == null) logger.error("ExportPanel.getMinGeneCorr: selectedId null");
TreeDrawerNode selectedNode = geneTreeDrawer.getNodeById(selectedId);
// if (selectedNode == null) logger.error("ExportPanel.getMinGeneCorr: selectedNode null , id " + selectedId);
return selectedNode.getCorr();
} else {
return geneTreeDrawer.getCorrMin();
}
}
Aggregations