Search in sources :

Example 1 with TreeDrawerNode

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);
}
Also used : TreeDrawerNode(edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeDrawerNode) TVModel(edu.ucsf.rbvi.clusterMaker2.internal.treeview.model.TVModel) AtrTVModel(edu.ucsf.rbvi.clusterMaker2.internal.treeview.model.AtrTVModel) Observable(java.util.Observable)

Example 2 with TreeDrawerNode

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;
    }
}
Also used : TreeDrawerNode(edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeDrawerNode)

Example 3 with TreeDrawerNode

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();
        }
    }
}
Also used : TreeDrawerNode(edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeDrawerNode)

Example 4 with TreeDrawerNode

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();
}
Also used : TreeDrawerNode(edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeDrawerNode)

Example 5 with TreeDrawerNode

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();
    }
}
Also used : TreeDrawerNode(edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeDrawerNode) TreeSelectionI(edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeSelectionI)

Aggregations

TreeDrawerNode (edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeDrawerNode)17 AtrTVModel (edu.ucsf.rbvi.clusterMaker2.internal.treeview.model.AtrTVModel)2 TVModel (edu.ucsf.rbvi.clusterMaker2.internal.treeview.model.TVModel)2 HeaderInfo (edu.ucsf.rbvi.clusterMaker2.internal.treeview.HeaderInfo)1 TreeSelectionI (edu.ucsf.rbvi.clusterMaker2.internal.treeview.TreeSelectionI)1 Observable (java.util.Observable)1