import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.datamodel.SequenceNode;
-import jalview.ext.treeviewer.ExternalTreeI;
-import jalview.ext.treeviewer.ExternalTreeNodeI;
+import jalview.ext.treeviewer.TreeI;
+import jalview.ext.treeviewer.TreeNodeI;
import jalview.util.QuickSort;
import java.util.ArrayList;
static TreeModel lastTree = null;
- static ExternalTreeI lastExternalTree = null;
+ static TreeI lastExternalTree = null;
static boolean sortTreeAscending = true;
- private static List<SequenceI> getOrderByTree(ExternalTreeI aptxTree,
- Map<ExternalTreeNodeI, SequenceI> nodesWithBoundSeqs)
+ private static List<SequenceI> getOrderByTree(TreeI aptxTree,
+ Map<TreeNodeI, SequenceI> nodesWithBoundSeqs)
{
List<SequenceI> seqsByTreeOrder = new ArrayList<>();
if (!aptxTree.isEmpty())
{
- for (final Iterator<ExternalTreeNodeI> iter = aptxTree
+ for (final Iterator<TreeNodeI> iter = aptxTree
.iterateInPreOrder(); iter.hasNext();)
{
- ExternalTreeNodeI treeNode = iter.next();
+ TreeNodeI treeNode = iter.next();
seqsByTreeOrder.add(nodesWithBoundSeqs.get(treeNode));
}
* tree which has
*/
public static void sortByTree(AlignmentI align,
- Map<ExternalTreeNodeI, SequenceI> nodesBoundToSequences,
- ExternalTreeI externalTreeI) throws IllegalArgumentException
+ Map<TreeNodeI, SequenceI> nodesBoundToSequences,
+ TreeI treeI) throws IllegalArgumentException
{
- List<SequenceI> tmp = getOrderByTree(externalTreeI, nodesBoundToSequences);
+ List<SequenceI> tmp = getOrderByTree(treeI, nodesBoundToSequences);
if (!tmp.isEmpty())
{
- if (lastExternalTree != externalTreeI)
+ if (lastExternalTree != treeI)
{
sortTreeAscending = true;
- lastExternalTree = externalTreeI;
+ lastExternalTree = treeI;
}
else
{
package jalview.ext.archaeopteryx;
-import jalview.ext.treeviewer.ExternalTreeControlsI;
+import jalview.ext.treeviewer.TreeControlsI;
import org.forester.archaeopteryx.ControlPanel;
-public class AptxControlPanel implements ExternalTreeControlsI
+public class AptxControlPanel implements TreeControlsI
{
ControlPanel aptxCp;
package jalview.ext.archaeopteryx;
import jalview.bin.Cache;
-import jalview.ext.treeviewer.ExternalTreeControlsI;
-import jalview.ext.treeviewer.ExternalTreeFrame;
-import jalview.ext.treeviewer.ExternalTreeI;
-import jalview.ext.treeviewer.ExternalTreePanel;
+import jalview.ext.treeviewer.TreeControlsI;
+import jalview.ext.treeviewer.TreeFrameI;
+import jalview.ext.treeviewer.TreeI;
+import jalview.ext.treeviewer.TreePanelI;
import jalview.gui.Desktop;
import jalview.gui.EPSOptions;
import jalview.io.JalviewFileChooser;
import org.forester.phylogeny.Phylogeny;
import org.jibble.epsgraphics.EpsGraphics2D;
-public class AptxFrame implements ExternalTreeFrame
+public class AptxFrame implements TreeFrameI
{
private final MainFrame aptxFrame;
- private ExternalTreePanel aptxPanel;
+ private TreePanelI aptxPanel;
- private ExternalTreeControlsI aptxControls;
+ private TreeControlsI aptxControls;
public AptxFrame(Phylogeny tree, Configuration aptxConfig,
}
}
@Override
- public ExternalTreePanel getTreePanel()
+ public TreePanelI getTreePanel()
{
return aptxPanel;
}
@Override
- public ExternalTreeI getTree()
+ public TreeI getTree()
{
return aptxPanel.getTree();
}
}
@Override
- public ExternalTreeControlsI getTreeControls()
+ public TreeControlsI getTreeControls()
{
return aptxControls;
}
import jalview.analysis.TreeBuilder;
import jalview.datamodel.SequenceI;
import jalview.ext.forester.UtilityMethods;
-import jalview.ext.treeviewer.ExternalLoadedTreeAssociationI;
-import jalview.ext.treeviewer.ExternalTreeBuilderI;
-import jalview.ext.treeviewer.ExternalTreeFrame;
-import jalview.ext.treeviewer.ExternalTreeI;
-import jalview.ext.treeviewer.ExternalTreeNodeI;
-import jalview.ext.treeviewer.ExternalTreeViewerBindingI;
+import jalview.ext.treeviewer.LoadedTreeAssociationI;
+import jalview.ext.treeviewer.TreeBuilderI;
+import jalview.ext.treeviewer.TreeFrameI;
+import jalview.ext.treeviewer.TreeI;
+import jalview.ext.treeviewer.TreeNodeI;
+import jalview.ext.treeviewer.TreeViewerBindingI;
import jalview.ext.treeviewer.LoadedTreeSequenceAssociation;
import jalview.gui.Desktop;
import jalview.gui.JvOptionPane;
private final static NHXParser.TAXONOMY_EXTRACTION TAXONOMY_EXTRACTION = APTX_CONFIG
.getTaxonomyExtraction();
- private static Map<ExternalTreeFrame, ExternalTreeViewerBindingI> activeAptx = new HashMap<>();
+ private static Map<TreeFrameI, TreeViewerBindingI> activeAptx = new HashMap<>();
- public static ExternalTreeFrame createInstanceFromCalculation(
+ public static TreeFrameI createInstanceFromCalculation(
final TreeBuilder calculatedTree)
{
- ExternalTreeBuilderI aptxTreeBuilder = new AptxTreeBuilder(
+ TreeBuilderI aptxTreeBuilder = new AptxTreeBuilder(
calculatedTree);
- ExternalTreeI aptxTree = aptxTreeBuilder.buildTree();
+ TreeI aptxTree = aptxTreeBuilder.buildTree();
- ExternalTreeFrame aptxApp = createAptxFrame(aptxTree,
+ TreeFrameI aptxApp = createAptxFrame(aptxTree,
calculatedTree.getAvport(), null);
return aptxApp;
* @throws IOException
* @throws FileNotFoundException
*/
- public static ExternalTreeFrame[] createInstancesFromFile(
+ public static TreeFrameI[] createInstancesFromFile(
String filePath,
AlignmentViewport viewport)
throws FileNotFoundException, IOException
{
File treeFile = new File(filePath);
- ExternalTreeFrame[] aptxFrames = null;
+ TreeFrameI[] aptxFrames = null;
if (UtilityMethods.canForesterReadFile(treeFile))
{
}
Phylogeny[] trees = PhylogenyMethods.readPhylogenies(parser,
treeFile);
- aptxFrames = new ExternalTreeFrame[trees.length];
+ aptxFrames = new TreeFrameI[trees.length];
for (int i = 0; i < trees.length; i++)
}
- public static ExternalTreeFrame[] createInstancesFromUrl(URL treeUrl,
+ public static TreeFrameI[] createInstancesFromUrl(URL treeUrl,
AlignmentViewport viewport)
throws FileNotFoundException, IOException, RuntimeException
{
REPLACE_NHX_UNDERSCORES, INTERNAL_NUMBERS_AS_CONFIDENCE,
TAXONOMY_EXTRACTION, MIDPOINT_REROOT);
- ExternalTreeFrame[] aptxFrames = new ExternalTreeFrame[trees.length];
+ TreeFrameI[] aptxFrames = new TreeFrameI[trees.length];
for (int i = 0; i < trees.length; i++)
{
Phylogeny aptxTree = trees[i];
* @param viewport
* @return
*/
- public static ExternalTreeFrame[] createInstancesFromDb(
+ public static TreeFrameI[] createInstancesFromDb(
PhylogeniesWebserviceClient treeDbClient, String identifier,
AlignmentViewport viewport)
{
URL url = null;
Phylogeny[] trees = null;
- ExternalTreeFrame[] aptxFrames = null;
+ TreeFrameI[] aptxFrames = null;
if ((identifier != null) && (identifier.trim().length() > 0))
{
{ identifier }),
MessageManager.getString("label.invalid_url"),
JvOptionPane.ERROR_MESSAGE);
- return new ExternalTreeFrame[0];
+ return new TreeFrameI[0];
}
identifier = id + "";
}
// _main_frame.getMainPanel().setWaitCursor();
// }
trees = ForesterUtil.readPhylogeniesFromUrl(url, parser);
- aptxFrames = new ExternalTreeFrame[trees.length];
+ aptxFrames = new TreeFrameI[trees.length];
} catch (final MalformedURLException e)
{
exception = true;
// new File(url.getFile()).getName(), url.toString());
- ExternalTreeFrame aptxApp = createAptxFrame(aptxTree,
+ TreeFrameI aptxApp = createAptxFrame(aptxTree,
viewport,
url.getFile());
String my_name_for_file = "";
- public static ExternalTreeFrame createAptxFrame(ExternalTreeI aptxTree,
+ public static TreeFrameI createAptxFrame(TreeI aptxTree,
AlignmentViewport jalviewAlignport, String treeTitle)
{
validateConfig(APTX_CONFIG);
- ExternalTreeFrame aptxApp = aptxTree
+ TreeFrameI aptxApp = aptxTree
.createTreeViewerFromTree(treeTitle);
- ExternalTreeI jalviewTree = aptxApp.getTree();
- ExternalLoadedTreeAssociationI bindAptxNodes = new LoadedTreeSequenceAssociation(
+ TreeI jalviewTree = aptxApp.getTree();
+ LoadedTreeAssociationI bindAptxNodes = new LoadedTreeSequenceAssociation(
jalviewAlignport.getAlignment().getSequencesArray(),
jalviewTree);
bindAptxNodes.associateLeavesToSequences();
}
- protected static ExternalTreeFrame createAptxFrame(
+ protected static TreeFrameI createAptxFrame(
final Phylogeny aptxTree,
final AlignmentViewport jalviewAlignport, String treeTitle)
{
validateConfig(APTX_CONFIG);
- ExternalTreeFrame aptxApp = new AptxFrame(aptxTree, APTX_CONFIG,
+ TreeFrameI aptxApp = new AptxFrame(aptxTree, APTX_CONFIG,
treeTitle);
- ExternalTreeI jalviewTree = aptxApp.getTree();
- ExternalLoadedTreeAssociationI bindAptxNodes = new LoadedTreeSequenceAssociation(
+ TreeI jalviewTree = aptxApp.getTree();
+ LoadedTreeAssociationI bindAptxNodes = new LoadedTreeSequenceAssociation(
jalviewAlignport.getAlignment().getSequencesArray(),
jalviewTree);
bindAptxNodes.associateLeavesToSequences();
}
- protected static ExternalTreeViewerBindingI bindNodesToJalviewSequences(
- final ExternalTreeFrame aptxApp,
+ protected static TreeViewerBindingI bindNodesToJalviewSequences(
+ final TreeFrameI aptxApp,
final AlignmentViewport jalviewAlignViewport,
- final Map<SequenceI, ExternalTreeNodeI> alignMappedToNodes,
- final Map<ExternalTreeNodeI, SequenceI> nodesMappedToAlign)
+ final Map<SequenceI, TreeNodeI> alignMappedToNodes,
+ final Map<TreeNodeI, SequenceI> nodesMappedToAlign)
{
- ExternalTreeViewerBindingI treeBinding = new JalviewBinding(aptxApp,
+ TreeViewerBindingI treeBinding = new JalviewBinding(aptxApp,
jalviewAlignViewport,
alignMappedToNodes, nodesMappedToAlign);
activeAptx.put(aptxApp, treeBinding);
}
- protected static ExternalTreeFrame bindTreeViewFrameToJalview(
- final ExternalTreeFrame aptxApp)
+ protected static TreeFrameI bindTreeViewFrameToJalview(
+ final TreeFrameI aptxApp)
{
int width = 400;
int height = 550;
- public static Map<ExternalTreeFrame, ExternalTreeViewerBindingI> getAllAptxFrames()
+ public static Map<TreeFrameI, TreeViewerBindingI> getAllAptxFrames()
{
return activeAptx;
}
import jalview.analysis.TreeBuilder;
import jalview.datamodel.SequenceI;
import jalview.ext.forester.ForesterMatrix;
-import jalview.ext.treeviewer.ExternalTreeBuilderI;
-import jalview.ext.treeviewer.ExternalTreeI;
-import jalview.ext.treeviewer.ExternalTreeNodeI;
+import jalview.ext.treeviewer.TreeBuilderI;
+import jalview.ext.treeviewer.TreeI;
+import jalview.ext.treeviewer.TreeNodeI;
import jalview.util.MappingUtils;
import jalview.util.MessageManager;
*
*/
public class AptxTreeBuilder
- implements ExternalTreeBuilderI
+ implements TreeBuilderI
{
protected final SequenceI[] sequences;
public String treeTitle;
- private final ExternalTreeI aptxTree;
+ private final TreeI aptxTree;
- private ExternalTreeNodeI rootNode;
+ private TreeNodeI rootNode;
- private final Map<SequenceI, ExternalTreeNodeI> alignmentWithNodes;
+ private final Map<SequenceI, TreeNodeI> alignmentWithNodes;
- private final Map<ExternalTreeNodeI, SequenceI> nodesWithAlignment;
+ private final Map<TreeNodeI, SequenceI> nodesWithAlignment;
public AptxTreeBuilder(final TreeBuilder calculatedTree)
{
}
@Override
- public ExternalTreeI buildTree(final ExternalTreeNodeI treeRoot)
+ public TreeI buildTree(final TreeNodeI treeRoot)
{
if (treeRoot != null)
@Override
- public ExternalTreeI buildTree()
+ public TreeI buildTree()
{
for (SequenceI sequence : sequences)
{
- ExternalTreeNodeI sequenceNode = TreeNode
+ TreeNodeI sequenceNode = TreeNode
.getUniqueWrapper(
new PhylogenyNode(sequence.getName()));
}
@Override
- public Map<SequenceI, ExternalTreeNodeI> getAlignmentBoundNodes()
+ public Map<SequenceI, TreeNodeI> getAlignmentBoundNodes()
{
return alignmentWithNodes;
}
@Override
- public Map<ExternalTreeNodeI, SequenceI> getNodesBoundAlignment()
+ public Map<TreeNodeI, SequenceI> getNodesBoundAlignment()
{
return nodesWithAlignment;
}
package jalview.ext.archaeopteryx;
-import jalview.ext.treeviewer.ExternalTreeI;
-import jalview.ext.treeviewer.ExternalTreeNodeI;
-import jalview.ext.treeviewer.ExternalTreePanel;
+import jalview.ext.treeviewer.TreeI;
+import jalview.ext.treeviewer.TreeNodeI;
+import jalview.ext.treeviewer.TreePanelI;
import jalview.gui.PaintRefresher;
import java.awt.Event;
import javax.accessibility.AccessibleContext;
-public class AptxTreePanel implements ExternalTreePanel
+public class AptxTreePanel implements TreePanelI
{
private final org.forester.archaeopteryx.TreePanel treeView;
- private final ExternalTreeI tree;
+ private final TreeI tree;
private String sequenceSetId;
protected AptxTreePanel(
org.forester.archaeopteryx.TreePanel aptxTreePanel,
- ExternalTreeI aptxTree)
+ TreeI aptxTree)
{
treeView = aptxTreePanel;
tree = aptxTree;
}
@Override
- public ExternalTreeI getTree()
+ public TreeI getTree()
{
return tree;
}
}
@Override
- public ExternalTreeNodeI findNode(int x, int y)
+ public TreeNodeI findNode(int x, int y)
{
return TreeNode.getUniqueWrapper(treeView.findNode(x, y));
}
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.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)
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));
package jalview.ext.archaeopteryx;
-import jalview.ext.treeviewer.ExternalTreeFrame;
-import jalview.ext.treeviewer.ExternalTreeI;
-import jalview.ext.treeviewer.ExternalTreeNodeI;
+import jalview.ext.treeviewer.TreeFrameI;
+import jalview.ext.treeviewer.TreeI;
+import jalview.ext.treeviewer.TreeNodeI;
import java.util.Iterator;
import org.forester.phylogeny.PhylogenyMethods;
import org.forester.phylogeny.PhylogenyNode;
-public class Tree implements ExternalTreeI
+public class Tree implements TreeI
{
private final Phylogeny tree;
.iteratorPostorder(); iterator.hasNext();)
{
PhylogenyNode foresterNode = iterator.next();
- ExternalTreeNodeI treeNode = TreeNode
+ TreeNodeI treeNode = TreeNode
.getUniqueWrapper(foresterNode);
}
}
@Override
- public ExternalTreeNodeI getRoot()
+ public TreeNodeI getRoot()
{
- ExternalTreeNodeI root = TreeNode.getUniqueWrapper(tree.getRoot());
+ TreeNodeI root = TreeNode.getUniqueWrapper(tree.getRoot());
return root;
}
}
@Override
- public ExternalTreeNodeI getNodeWithName(String name)
+ public TreeNodeI getNodeWithName(String name)
{
return TreeNode.getUniqueWrapper(tree.getNode(name));
}
@Override
- public void setRoot(ExternalTreeNodeI rootNode)
+ public void setRoot(TreeNodeI rootNode)
{
PhylogenyNode treeRoot = TreeNode.unwrapNode(rootNode);
tree.setRoot(treeRoot);
}
@Override
- public Iterator<ExternalTreeNodeI> iterateInPreOrder()
+ public Iterator<TreeNodeI> iterateInPreOrder()
{
- Iterator<ExternalTreeNodeI> iter = new TreeIterator(
+ Iterator<TreeNodeI> iter = new TreeIterator(
tree.iteratorPreorder());
return iter;
}
@Override
- public Iterator<ExternalTreeNodeI> iterateInLevelOrder()
+ public Iterator<TreeNodeI> iterateInLevelOrder()
{
- Iterator<ExternalTreeNodeI> iter = new TreeIterator(
+ Iterator<TreeNodeI> iter = new TreeIterator(
tree.iteratorLevelOrder());
return iter;
}
@Override
- public Iterator<ExternalTreeNodeI> iterateInPostOrder()
+ public Iterator<TreeNodeI> iterateInPostOrder()
{
- Iterator<ExternalTreeNodeI> iter = new TreeIterator(
+ Iterator<TreeNodeI> iter = new TreeIterator(
tree.iteratorPostorder());
return iter;
}
@Override
- public ExternalTreeNodeI getFurthestNode()
+ public TreeNodeI getFurthestNode()
{
PhylogenyNode furthestNode = PhylogenyMethods
.calculateNodeWithMaxDistanceToRoot(tree);
}
@Override
- public ExternalTreeFrame createTreeViewerFromTree(String instanceTitle)
+ public TreeFrameI createTreeViewerFromTree(String instanceTitle)
{
return new AptxFrame(Archaeopteryx.createApplication(tree,
AptxInit.APTX_CONFIG,
package jalview.ext.archaeopteryx;
-import jalview.ext.treeviewer.ExternalTreeNodeI;
+import jalview.ext.treeviewer.TreeNodeI;
import java.util.Iterator;
import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
-public class TreeIterator implements Iterator<ExternalTreeNodeI>
+public class TreeIterator implements Iterator<TreeNodeI>
{
private final PhylogenyNodeIterator iter;
}
@Override
- public ExternalTreeNodeI next()
+ public TreeNodeI next()
{
- ExternalTreeNodeI node = TreeNode.getUniqueWrapper(iter.next());
+ TreeNodeI node = TreeNode.getUniqueWrapper(iter.next());
return node;
}
package jalview.ext.archaeopteryx;
import jalview.datamodel.SequenceI;
-import jalview.ext.treeviewer.ExternalTreeNodeI;
+import jalview.ext.treeviewer.TreeNodeI;
import java.awt.Color;
import java.util.ArrayList;
import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.data.BranchColor;
-public class TreeNode implements ExternalTreeNodeI
+public class TreeNode implements TreeNodeI
{
private final PhylogenyNode node;
private SequenceI nodeSeq;
- private static Map<PhylogenyNode, ExternalTreeNodeI> originalNodes = new HashMap<>(
+ private static Map<PhylogenyNode, TreeNodeI> originalNodes = new HashMap<>(
500); // prolly make this size dynamic
- private static Map<ExternalTreeNodeI, PhylogenyNode> wrappedNodes = new HashMap<>(
+ private static Map<TreeNodeI, PhylogenyNode> wrappedNodes = new HashMap<>(
500);
private TreeNode(PhylogenyNode aptxNode)
@Override
- public List<ExternalTreeNodeI> getAllDescendants()
+ public List<TreeNodeI> getAllDescendants()
{
List<PhylogenyNode> descNodes = PhylogenyMethods
}
@Override
- public List<ExternalTreeNodeI> getExternalDescendants()
+ public List<TreeNodeI> getExternalDescendants()
{
List<PhylogenyNode> extDescNodes = node.getAllExternalDescendants();
return getUniqueWrappers(extDescNodes);
@Override
- public List<ExternalTreeNodeI> getDirectChildren()
+ public List<TreeNodeI> getDirectChildren()
{
List<PhylogenyNode> childNodes = node.getDescendants();
return getUniqueWrappers(childNodes);
}
@Override
- public void addAsChild(ExternalTreeNodeI childNode)
+ public void addAsChild(TreeNodeI childNode)
{
PhylogenyNode aptxNode = unwrapNode(childNode);
return node.isInternal();
}
- public static List<ExternalTreeNodeI> getUniqueWrappers(
+ public static List<TreeNodeI> getUniqueWrappers(
List<PhylogenyNode> aptxNodes)
{
- List<ExternalTreeNodeI> wrappedNodes = new ArrayList<>(
+ List<TreeNodeI> wrappedNodes = new ArrayList<>(
aptxNodes.size());
for (PhylogenyNode aptxNode : aptxNodes)
* @param aptxNode
* @return
*/
- public static ExternalTreeNodeI getUniqueWrapper(
+ public static TreeNodeI getUniqueWrapper(
PhylogenyNode aptxNode)
{
if (aptxNode == null)
{
return null;
}
- ExternalTreeNodeI wrappedNode = originalNodes.get(aptxNode);
+ TreeNodeI wrappedNode = originalNodes.get(aptxNode);
if (wrappedNode == null)
{
wrappedNode = new TreeNode(aptxNode);
* @param wrappedNode
* @return
*/
- protected static PhylogenyNode unwrapNode(ExternalTreeNodeI wrappedNode)
+ protected static PhylogenyNode unwrapNode(TreeNodeI wrappedNode)
{
if (wrappedNode == null)
{
package jalview.ext.archaeopteryx;
-import jalview.ext.treeviewer.ExternalTreeI;
-import jalview.ext.treeviewer.ExternalTreeParserI;
+import jalview.ext.treeviewer.TreeI;
+import jalview.ext.treeviewer.TreeParserI;
import java.io.IOException;
import org.forester.io.parsers.PhylogenyParser;
import org.forester.phylogeny.Phylogeny;
-public class TreeParser implements ExternalTreeParserI
+public class TreeParser implements TreeParserI
{
private final PhylogenyParser parser;
}
@Override
- public ExternalTreeI[] parse() throws IOException
+ public TreeI[] parse() throws IOException
{
Phylogeny[] foresterTrees = parser.parse();
- ExternalTreeI[] jalviewTrees = new ExternalTreeI[foresterTrees.length];
+ TreeI[] jalviewTrees = new TreeI[foresterTrees.length];
for (int i = 0; i < foresterTrees.length; i++)
{
+++ /dev/null
-package jalview.ext.treeviewer;
-
-import jalview.datamodel.SequenceI;
-
-import java.util.Map;
-
-/**
- * @author kjvanderheide
- *
- */
-public interface ExternalTreeBuilderI
-{
- public ExternalTreeI buildTree(ExternalTreeNodeI treeRoot);
-
- public ExternalTreeI buildTree();
-
- public Map<SequenceI, ExternalTreeNodeI> getAlignmentBoundNodes();
-
- public Map<ExternalTreeNodeI, SequenceI> getNodesBoundAlignment();
-
- public String generateTreeName();
-
-}
+++ /dev/null
-package jalview.ext.treeviewer;
-
-import java.util.Iterator;
-
-public interface ExternalTreeI
-{
- public ExternalTreeNodeI getRoot();
-
- public ExternalTreeNodeI getNodeWithName(String name);
-
- public ExternalTreeNodeI getFurthestNode();
-
- public String[] getAllLeafNames();
-
- public void setTreeName(String treeTitle);
-
- public void setRerootable(boolean b);
-
- public void setRooted(boolean b);
-
- public boolean isEmpty();
-
- public String getTreeName();
-
- public void setRoot(ExternalTreeNodeI rootNode);
-
- public double getHeight(boolean adjustForCollapsedSubtrees);
-
- public Iterator<ExternalTreeNodeI> iterateInPreOrder();
-
- public Iterator<ExternalTreeNodeI> iterateInLevelOrder();
-
- public Iterator<ExternalTreeNodeI> iterateInPostOrder();
-
- ExternalTreeFrame createTreeViewerFromTree(String instanceTitle);
-
-}
+++ /dev/null
-package jalview.ext.treeviewer;
-
-public interface ExternalTreeViewerConfigI
-{
-
-}
*
*
*/
-public interface ExternalLoadedTreeAssociationI
+public interface LoadedTreeAssociationI
{
public void associateLeavesToSequences();
- public Map<SequenceI, ExternalTreeNodeI> getAlignmentWithNodes();
+ public Map<SequenceI, TreeNodeI> getAlignmentWithNodes();
- public Map<ExternalTreeNodeI, SequenceI> getNodesWithAlignment();
+ public Map<TreeNodeI, SequenceI> getNodesWithAlignment();
}
import java.util.Map;
public class LoadedTreeSequenceAssociation
- implements ExternalLoadedTreeAssociationI
+ implements LoadedTreeAssociationI
{
SequenceI[] alignSequences;
- ExternalTreeI tree;
+ TreeI tree;
- Map<SequenceI, ExternalTreeNodeI> alignmentWithNodes;
+ Map<SequenceI, TreeNodeI> alignmentWithNodes;
- Map<ExternalTreeNodeI, SequenceI> nodesWithAlignment;
+ Map<TreeNodeI, SequenceI> nodesWithAlignment;
public LoadedTreeSequenceAssociation(SequenceI[] alignmentSequences,
- ExternalTreeI extTree)
+ TreeI extTree)
{
alignSequences = alignmentSequences;
tree = extTree;
if (!tree.isEmpty())
{
- for (final Iterator<ExternalTreeNodeI> iter = tree
+ for (final Iterator<TreeNodeI> iter = tree
.iterateInPreOrder(); iter
.hasNext();)
{
- ExternalTreeNodeI treeNode = iter.next();
+ TreeNodeI treeNode = iter.next();
nodeSequenceName = treeNode.getNodeName();
nodeSequence = algnIds.findIdMatch(nodeSequenceName);
@Override
- public Map<SequenceI, ExternalTreeNodeI> getAlignmentWithNodes()
+ public Map<SequenceI, TreeNodeI> getAlignmentWithNodes()
{
return alignmentWithNodes;
}
@Override
- public Map<ExternalTreeNodeI, SequenceI> getNodesWithAlignment()
+ public Map<TreeNodeI, SequenceI> getNodesWithAlignment()
{
return nodesWithAlignment;
}
--- /dev/null
+package jalview.ext.treeviewer;
+
+import jalview.datamodel.SequenceI;
+
+import java.util.Map;
+
+/**
+ * @author kjvanderheide
+ *
+ */
+public interface TreeBuilderI
+{
+ public TreeI buildTree(TreeNodeI treeRoot);
+
+ public TreeI buildTree();
+
+ public Map<SequenceI, TreeNodeI> getAlignmentBoundNodes();
+
+ public Map<TreeNodeI, SequenceI> getNodesBoundAlignment();
+
+ public String generateTreeName();
+
+}
package jalview.ext.treeviewer;
-public interface ExternalTreeControlsI
+public interface TreeControlsI
{
public void defaultSettings();
import javax.swing.WindowConstants;
import javax.swing.event.InternalFrameListener;
-public interface ExternalTreeFrame
+public interface TreeFrameI
extends Accessible, WindowConstants, RootPaneContainer,
ImageObserver, MenuContainer
{
- public abstract ExternalTreePanel getTreePanel();
+ public abstract TreePanelI getTreePanel();
- public abstract ExternalTreeI getTree();
+ public abstract TreeI getTree();
public abstract void checkMultipleTrees();
public abstract int getNumberOfTrees();
- public ExternalTreeControlsI getTreeControls();
+ public TreeControlsI getTreeControls();
public void addFrameListener(InternalFrameListener listener);
--- /dev/null
+package jalview.ext.treeviewer;
+
+import java.util.Iterator;
+
+public interface TreeI
+{
+ public TreeNodeI getRoot();
+
+ public TreeNodeI getNodeWithName(String name);
+
+ public TreeNodeI getFurthestNode();
+
+ public String[] getAllLeafNames();
+
+ public void setTreeName(String treeTitle);
+
+ public void setRerootable(boolean b);
+
+ public void setRooted(boolean b);
+
+ public boolean isEmpty();
+
+ public String getTreeName();
+
+ public void setRoot(TreeNodeI rootNode);
+
+ public double getHeight(boolean adjustForCollapsedSubtrees);
+
+ public Iterator<TreeNodeI> iterateInPreOrder();
+
+ public Iterator<TreeNodeI> iterateInLevelOrder();
+
+ public Iterator<TreeNodeI> iterateInPostOrder();
+
+ TreeFrameI createTreeViewerFromTree(String instanceTitle);
+
+}
import java.awt.Color;
import java.util.List;
-public interface ExternalTreeNodeI
+public interface TreeNodeI
{
public String getNodeName();
- public List<ExternalTreeNodeI> getAllDescendants();
+ public List<TreeNodeI> getAllDescendants();
- public List<ExternalTreeNodeI> getExternalDescendants();
+ public List<TreeNodeI> getExternalDescendants();
- public List<ExternalTreeNodeI> getDirectChildren();
+ public List<TreeNodeI> getDirectChildren();
public void setSequence(SequenceI seq);
public SequenceI getSequence();
- public void addAsChild(ExternalTreeNodeI childNode);
+ public void addAsChild(TreeNodeI childNode);
public long getId();
import javax.accessibility.Accessible;
-public interface ExternalTreePanel extends Accessible, MenuContainer
+public interface TreePanelI extends Accessible, MenuContainer
{
public abstract File getTreeFile();
- public abstract ExternalTreeI getTree();
+ public abstract TreeI getTree();
- public abstract ExternalTreeNodeI findNode(int x, int y);
+ public abstract TreeNodeI findNode(int x, int y);
public abstract void setMatchingNodes(Set<Long> matchingNodes);
import java.io.IOException;
-public interface ExternalTreeParserI
+public interface TreeParserI
{
- public ExternalTreeI[] parse() throws IOException;
+ public TreeI[] parse() throws IOException;
public void setSource(Object source) throws IOException;
*
*
*/
-public interface ExternalTreeViewerBindingI
+public interface TreeViewerBindingI
extends ActionListener, MouseListener, SelectionListener,
SelectionSource
{
* corresponding sequence in the Jalview alignment view. If an internal node
* is selected all child sequences get highlighted as well.
*/
- public void showNodeSelectionOnAlign(ExternalTreeNodeI node);
+ public void showNodeSelectionOnAlign(TreeNodeI node);
public void treeSelectionChanged(SequenceI sequence);
- public void showMatchingSequence(ExternalTreeNodeI nodeToMatch);
+ public void showMatchingSequence(TreeNodeI nodeToMatch);
- public void showMatchingChildSequences(ExternalTreeNodeI parentNode);
+ public void showMatchingChildSequences(TreeNodeI parentNode);
public void sortByTree_actionPerformed();
--- /dev/null
+package jalview.ext.treeviewer;
+
+public interface TreeViewerConfigI
+{
+
+}
import jalview.ext.archaeopteryx.AptxInit;
import jalview.ext.forester.io.SupportedTreeFileFilter;
import jalview.ext.forester.io.TreeParser;
-import jalview.ext.treeviewer.ExternalTreeFrame;
-import jalview.ext.treeviewer.ExternalTreeViewerBindingI;
+import jalview.ext.treeviewer.TreeFrameI;
+import jalview.ext.treeviewer.TreeViewerBindingI;
import jalview.gui.ColourMenuHelper.ColourChangeListener;
import jalview.gui.ViewSelectionMenu.ViewSetProvider;
import jalview.io.AlignmentProperties;
.get(viewport.getSequenceSetId());
List<TreePanel> treePanels = new ArrayList<>();
- Map<ExternalTreeFrame, ExternalTreeViewerBindingI> aptxFrames = AptxInit
+ Map<TreeFrameI, TreeViewerBindingI> aptxFrames = AptxInit
.getAllAptxFrames();
for (Component comp : comps)
sortByTreeMenu.setVisible(true);
- for (Entry<ExternalTreeFrame, ExternalTreeViewerBindingI> aptxFrameWithBinding : aptxFrames
+ for (Entry<TreeFrameI, TreeViewerBindingI> aptxFrameWithBinding : aptxFrames
.entrySet())
{
- ExternalTreeFrame aptxFrame = aptxFrameWithBinding.getKey();
- ExternalTreeViewerBindingI binding = aptxFrameWithBinding.getValue();
+ TreeFrameI aptxFrame = aptxFrameWithBinding.getKey();
+ TreeViewerBindingI binding = aptxFrameWithBinding.getValue();
// future support for multiple tabs
// for (org.forester.archaeopteryx.TreePanel aptxTree : aptxFrame
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
-import jalview.ext.treeviewer.ExternalTreeI;
+import jalview.ext.treeviewer.TreeI;
import jalview.renderer.ResidueShader;
import jalview.renderer.ResidueShaderI;
import jalview.schemes.ColourSchemeI;
protected TreeModel currentTree = null;
- protected ExternalTreeI currentExtTree = null;
+ protected TreeI currentExtTree = null;
@Override
public boolean hasSearchResults()
return currentTree;
}
- public ExternalTreeI getCurrentExtTree()
+ public TreeI getCurrentExtTree()
{
return currentExtTree;
}
- public void setCurrentExtTree(ExternalTreeI externalTree)
+ public void setCurrentExtTree(TreeI externalTree)
{
currentExtTree = externalTree;
}
import static org.testng.Assert.assertTrue;
import jalview.bin.Jalview;
-import jalview.ext.treeviewer.ExternalTreeFrame;
+import jalview.ext.treeviewer.TreeFrameI;
import jalview.gui.Desktop;
import jalview.gui.JvOptionPane;
{
Jalview jalview;
- ExternalTreeFrame treeView;
+ TreeFrameI treeView;
@BeforeClass(alwaysRun = true)
public void setUpJvOptionPane()