import jalview.datamodel.HiddenColumns;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
-import jalview.ext.treeviewer.ExternalTreeFrame;
-import jalview.ext.treeviewer.ExternalTreeI;
-import jalview.ext.treeviewer.ExternalTreeNodeI;
-import jalview.ext.treeviewer.ExternalTreePanel;
-import jalview.ext.treeviewer.ExternalTreeViewerBindingI;
+import jalview.ext.treeviewer.TreeFrameI;
+import jalview.ext.treeviewer.TreeI;
+import jalview.ext.treeviewer.TreeNodeI;
+import jalview.ext.treeviewer.TreePanelI;
+import jalview.ext.treeviewer.TreeViewerBindingI;
+import jalview.ext.treeviewer.TreeViewerUtils;
import jalview.ext.treeviewer.LoadedTreeSequenceAssociation;
import jalview.gui.AlignViewport;
import jalview.gui.AlignmentPanel;
*
*/
public final class JalviewBinding
- implements ExternalTreeViewerBindingI
+ implements TreeViewerBindingI
{
- private final ExternalTreeFrame aptxFrame;
+ private final TreeFrameI aptxFrame;
- private ExternalTreePanel treeView;
+ private TreePanelI treeView;
private AlignmentViewport parentAvport;
private AlignmentPanel[] associatedPanels;
- private Map<SequenceI, ExternalTreeNodeI> sequencesBoundToNodes;
+ private Map<SequenceI, TreeNodeI> sequencesBoundToNodes;
- private Map<ExternalTreeNodeI, SequenceI> nodesBoundToSequences;
+ private Map<TreeNodeI, SequenceI> nodesBoundToSequences;
private float rootX;
* map with tree nodes and matching sequences used to calculate the
* tree as key, value pair respectively.
*/
- public JalviewBinding(final ExternalTreeFrame archaeopteryx,
+ public JalviewBinding(final TreeFrameI archaeopteryx,
final AlignmentViewport jalviewAlignmentViewport,
- final Map<SequenceI, ExternalTreeNodeI> alignMappedToNodes,
- final Map<ExternalTreeNodeI, SequenceI> nodesMappedToAlign)
+ final Map<SequenceI, TreeNodeI> alignMappedToNodes,
+ final Map<TreeNodeI, SequenceI> nodesMappedToAlign)
{
if (archaeopteryx.getNumberOfTrees() > 1)
@Override
public void internalFrameClosed(InternalFrameEvent e)
{
- AptxInit.getAllAptxFrames().remove(aptxFrame);
+ TreeViewerUtils.getActiveTreeViews().remove(aptxFrame);
ssm.removeSelectionListener(JalviewBinding.this);
}
bindAptxNodes.associateLeavesToSequences();
sequencesBoundToNodes = bindAptxNodes.getAlignmentWithNodes();
nodesBoundToSequences = bindAptxNodes.getNodesWithAlignment();
- AptxInit.bindNodesToJalviewSequences(aptxFrame, parentAvport,
+ TreeViewerUtils.associateNodesWithJalviewSequences(aptxFrame, parentAvport,
sequencesBoundToNodes, nodesBoundToSequences);
Rectangle visibleView = treeView.getVisibleArea();
- for (ExternalTreeNodeI node : treeView.getTree().getRoot()
+ for (TreeNodeI node : treeView.getTree().getRoot()
.getAllDescendants())
{
if (!(node.getXcoord() > visibleView.getMinX()
*/
public void run()
{
- final ExternalTreeNodeI node = treeView.findNode(e.getX(),
+ final TreeNodeI node = treeView.findNode(e.getX(),
e.getY());
if (node != null)
{
for (SequenceI selectedSequence : seqsel.getSequences())
{
- ExternalTreeNodeI matchingNode = sequencesBoundToNodes
+ TreeNodeI matchingNode = sequencesBoundToNodes
.get(selectedSequence);
if (matchingNode != null)
{
*/
public void partitionTree(final int x)
{
- ExternalTreeI tree = treeView.getTree();
+ TreeI tree = treeView.getTree();
if (!tree.isEmpty())
{
// should be calculated on each partition as the tree can theoretically
// change in the meantime
- ExternalTreeNodeI furthestNode = tree.getFurthestNode();
+ TreeNodeI furthestNode = tree.getFurthestNode();
furthestNodeX = furthestNode.getXcoord();
rootX = tree.getRoot().getXcoord();
if (furthestNodeX != rootX && !(x > furthestNodeX))
{
float threshold = (x - rootX) / (furthestNodeX - rootX);
- List<ExternalTreeNodeI> foundNodes = getNodesAboveThreshold(
+ List<TreeNodeI> foundNodes = getNodesAboveThreshold(
threshold,
tree.getRoot());
}
- public List<ExternalTreeNodeI> getNodesAboveThreshold(double threshold,
- ExternalTreeNodeI node)
+ public List<TreeNodeI> getNodesAboveThreshold(double threshold,
+ TreeNodeI node)
{
- List<ExternalTreeNodeI> nodesAboveThreshold = new ArrayList<>();
+ List<TreeNodeI> nodesAboveThreshold = new ArrayList<>();
parentAvport.setSelectionGroup(null);
parentAvport.getAlignment().deleteAllGroups();
* @param node
* @return
*/
- private List<ExternalTreeNodeI> colourNodesAboveThreshold(
- List<ExternalTreeNodeI> nodeList, double threshold,
- ExternalTreeNodeI node)
+ private List<TreeNodeI> colourNodesAboveThreshold(
+ List<TreeNodeI> nodeList, double threshold,
+ TreeNodeI node)
{
- for (ExternalTreeNodeI childNode : node.getDirectChildren())
+ for (TreeNodeI childNode : node.getDirectChildren())
{
childNode.setBranchColor(Color.black);
float nodeCutoff = (childNode.getXcoord() - rootX)
parentAvport.setSequenceColour(seq, randomColour);
}
- List<ExternalTreeNodeI> descendantNodes = childNode
+ List<TreeNodeI> descendantNodes = childNode
.getAllDescendants();
// .forEach instead?
- for (ExternalTreeNodeI descNode : descendantNodes)
+ for (TreeNodeI descNode : descendantNodes)
{
seq = nodesBoundToSequences.get(descNode);
if (seq != null)
* does)
*/
@Override
- public void showNodeSelectionOnAlign(final ExternalTreeNodeI node)
+ public void showNodeSelectionOnAlign(final TreeNodeI node)
{
if (node.isInternal())
@Override
- public void showMatchingSequence(final ExternalTreeNodeI nodeToMatch)
+ public void showMatchingSequence(final TreeNodeI nodeToMatch)
{
SequenceI matchingSequence = nodesBoundToSequences.get(nodeToMatch);
if (matchingSequence != null)
}
@Override
- public void showMatchingChildSequences(final ExternalTreeNodeI parentNode)
+ public void showMatchingChildSequences(final TreeNodeI parentNode)
{
// redundancy here, Forester already iterates through tree to get all
// descendants
- List<ExternalTreeNodeI> childNodes = parentNode.getAllDescendants();
+ List<TreeNodeI> childNodes = parentNode.getAllDescendants();
- for (ExternalTreeNodeI childNode : childNodes)
+ for (TreeNodeI childNode : childNodes)
{
// childNode.getBranchData().setBranchColor(new BranchColor(Color.BLUE));