From: kjvdheide Date: Fri, 17 Nov 2017 13:34:22 +0000 (+0000) Subject: Merge branch 'kjvdh/features/PhylogenyViewer' of X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=91bea2a1185e438bfd52fc1848cf615068016192;p=jalview.git Merge branch 'kjvdh/features/PhylogenyViewer' of https://source.jalview.org/git/jalview.git into kjvdh/features/PhylogenyViewer Conflicts: src/jalview/ext/archaeopteryx/AptxBinding.java src/jalview/ext/forester/io/ExternalTreeParserI.java src/jalview/ext/forester/io/ForesterTreeParser.java --- 91bea2a1185e438bfd52fc1848cf615068016192 diff --cc _aptx_jalview_configuration_file.txt index 03788f9,03788f9..ec248ac --- a/_aptx_jalview_configuration_file.txt +++ b/_aptx_jalview_configuration_file.txt @@@ -266,7 -266,7 +266,7 @@@ click_to: select_nodes disp click_to: get_ext_descendents_data display # Default click-to option (any of the above if set to "display") --default_click_to: display_node_data ++default_click_to: select_nodes @@@ -283,8 -283,8 +283,8 @@@ display_color: branc display_color: node_box 0x000000 display_color: collapsed 0x000000 display_color: matching_a 0xCC6600 --display_color: matching_b 0x0000CC --display_color: matching_a_and_b 0xCC70CC ++display_color: matching_b 0xCC70CC ++display_color: matching_a_and_b 0x0000CC display_color: duplication 0xFF00FF display_color: speciation 0xFFFF00 display_color: duplication_or_specation 0xFFAA20 diff --cc forester index b977efb,b977efb..eb22dac --- a/forester +++ b/forester @@@ -1,1 -1,1 +1,1 @@@ --Subproject commit b977efb66f2d0b539bd433e80762737925035edc ++Subproject commit eb22dac14771c467104f57362e3a624d0140f897 diff --cc src/jalview/ext/archaeopteryx/Aptx.java index 0000000,0000000..640dd31 new file mode 100644 --- /dev/null +++ b/src/jalview/ext/archaeopteryx/Aptx.java @@@ -1,0 -1,0 +1,17 @@@ ++package jalview.ext.archaeopteryx; ++ ++import jalview.ext.treeviewer.ExternalTreeViewerI; ++ ++import org.forester.archaeopteryx.MainFrame; ++ ++public class Aptx implements ExternalTreeViewerI ++{ ++ private final MainFrame aptxApp; ++ ++ public Aptx(MainFrame aptx) ++ { ++ aptxApp = aptx; ++ ++ ++ } ++} diff --cc src/jalview/ext/archaeopteryx/AptxInit.java index 602d472,364260e..ce34573 --- a/src/jalview/ext/archaeopteryx/AptxInit.java +++ b/src/jalview/ext/archaeopteryx/AptxInit.java @@@ -22,7 -20,7 +22,7 @@@ import org.forester.phylogeny.Phylogeny * @author kjvanderheide * */ --public final class ArchaeopteryxInit ++public final class AptxInit { /** * Test method, should generally not be used as it does not bind the tree to @@@ -56,7 -54,7 +56,7 @@@ public static MainFrame createInstance( final TreeBuilder calculatedTree) // very dense method, to be split up { -- ExternalTreeBuilderI aptxTreeBuilder = new ArchaeopteryxTreeBuilder( ++ ExternalTreeBuilderI aptxTreeBuilder = new AptxTreeBuilder( calculatedTree); Phylogeny aptxTree = aptxTreeBuilder.buildTree(); @@@ -99,6 -97,6 +99,8 @@@ int width = 400; int height = 550; aptxApp.setMinimumSize(new Dimension(width, height)); ++ // aptxApp.setFont(Desktop.instance.getFont()); ++ // aptxApp.getMainPanel().setFont(Desktop.instance.getFont()); Desktop.addInternalFrame(aptxApp, "Archaeopteryx Tree View", true, width, height, true, true); diff --cc src/jalview/ext/archaeopteryx/AptxTreeBuilder.java index 7a2ee64,f010450..7b03d5c --- a/src/jalview/ext/archaeopteryx/AptxTreeBuilder.java +++ b/src/jalview/ext/archaeopteryx/AptxTreeBuilder.java @@@ -26,7 -25,7 +26,7 @@@ import org.forester.phylogeny.data.Sequ * @author kjvanderheide * */ --public class ArchaeopteryxTreeBuilder ++public class AptxTreeBuilder implements ExternalTreeBuilderI { protected final SequenceI[] sequences; @@@ -45,7 -44,7 +45,7 @@@ private final Map nodesWithAlignment; -- public ArchaeopteryxTreeBuilder(final TreeBuilder calculatedTree) ++ public AptxTreeBuilder(final TreeBuilder calculatedTree) { jalviewTree = calculatedTree; sequences = jalviewTree.getSequences(); diff --cc src/jalview/ext/archaeopteryx/AptxTreePanel.java index 0000000,0000000..631ff15 new file mode 100644 --- /dev/null +++ b/src/jalview/ext/archaeopteryx/AptxTreePanel.java @@@ -1,0 -1,0 +1,14 @@@ ++package jalview.ext.archaeopteryx; ++ ++import jalview.ext.treeviewer.ExternalTreePanelI; ++ ++public class AptxTreePanel implements ExternalTreePanelI ++{ ++ private final org.forester.archaeopteryx.TreePanel treeView; ++ ++ public AptxTreePanel(org.forester.archaeopteryx.TreePanel aptxTreePanel) ++ { ++ treeView = aptxTreePanel; ++ ++ } ++} diff --cc src/jalview/ext/archaeopteryx/JalviewBinding.java index 19a66f8,24f75bc..ee349b6 --- a/src/jalview/ext/archaeopteryx/JalviewBinding.java +++ b/src/jalview/ext/archaeopteryx/JalviewBinding.java @@@ -178,12 -177,11 +178,12 @@@ public final class JalviewBindin @Override public void showMatchingChildSequences(final PhylogenyNode parentNode) { -- final List childNodes = PhylogenyMethods ++ List childNodes = PhylogenyMethods .getAllDescendants(parentNode); for (PhylogenyNode childNode : childNodes) { ++ SequenceI matchingSequence = nodesBoundToSequences.get(childNode); if (matchingSequence != null) { @@@ -227,7 -224,81 +227,79 @@@ { this.parentAvport = parentAvport; } -- + // av.setCurrentTree(tree); + // + // /* + // * isPopupTrigger is set for mousePressed (Mac) + // * or mouseReleased (Windows) + // */ + // if (e.isPopupTrigger()) + // { + // if (highlightNode != null) + // { + // chooseSubtreeColour(); + // } + // return; + // } + // + // /* + // * defer right-click handling on Windows to + // * mouseClicked; note isRightMouseButton + // * also matches Cmd-click on Mac which should do + // * nothing here + // */ + // if (SwingUtilities.isRightMouseButton(e)) + // { + // return; + // } + // + // int x = e.getX(); + // int y = e.getY(); + // + // Object ob = findElement(x, y); + // + // if (ob instanceof SequenceI) + // { + // treeSelectionChanged((Sequence) ob); + // PaintRefresher.Refresh(tp, ap.av.getSequenceSetId()); + // repaint(); + // av.sendSelection(); + // return; + // } + // else if (!(ob instanceof SequenceNode)) + // { + // // Find threshold + // if (tree.getMaxHeight() != 0) + // { + // threshold = (float) (x - offx) + // / (float) (getWidth() - labelLength - (2 * offx)); + // + // List groups = tree.groupNodes(threshold); + // setColor(tree.getTopNode(), Color.black); + // + // AlignmentPanel[] aps = getAssociatedPanels(); + // + // // TODO push calls below into a single AlignViewportI method? + // // see also AlignViewController.deleteGroups + // for (int a = 0; a < aps.length; a++) + // { + // aps[a].av.setSelectionGroup(null); + // aps[a].av.getAlignment().deleteAllGroups(); + // aps[a].av.clearSequenceColours(); + // if (aps[a].av.getCodingComplement() != null) + // { + // aps[a].av.getCodingComplement().setSelectionGroup(null); + // aps[a].av.getCodingComplement().getAlignment() + // .deleteAllGroups(); + // aps[a].av.getCodingComplement().clearSequenceColours(); + // } + // } + // colourGroups(groups); + // } + // + // PaintRefresher.Refresh(tp, ap.av.getSequenceSetId()); + // repaint(); + // } - } diff --cc src/jalview/ext/archaeopteryx/LoadedTreeAssociation.java index 3255c69,b1dc106..adea693 --- a/src/jalview/ext/archaeopteryx/LoadedTreeAssociation.java +++ b/src/jalview/ext/archaeopteryx/LoadedTreeAssociation.java @@@ -79,6 -77,6 +79,8 @@@ public class LoadedTreeAssociatio } ++ ++ public Map getAlignmentWithNodes() { return alignmentWithNodes; diff --cc src/jalview/ext/forester/io/TreeParser.java index 2c08e99,411f5a2..54f79bc --- a/src/jalview/ext/forester/io/TreeParser.java +++ b/src/jalview/ext/forester/io/TreeParser.java @@@ -1,9 -1,8 +1,9 @@@ package jalview.ext.forester.io; -import jalview.ext.archaeopteryx.AptxBinding; -import jalview.ext.archaeopteryx.AptxNodeAssociation; -import jalview.ext.archaeopteryx.ArchaeopteryxInit; ++import jalview.ext.archaeopteryx.AptxInit; +import jalview.ext.archaeopteryx.JalviewBinding; +import jalview.ext.archaeopteryx.LoadedTreeAssociation; - import jalview.ext.archaeopteryx.ArchaeopteryxInit; +import jalview.ext.treeviewer.ExternalTreeParserI; import jalview.gui.Desktop; import jalview.gui.JvOptionPane; import jalview.util.MessageManager; @@@ -64,10 -63,10 +64,11 @@@ public class TreeParser implements Exte aptx.getMainPanel().getCurrentTreePanel().getPhylogeny()); bindAptxNodes.associateLeavesToSequences(); - new AptxBinding(aptx, viewport, bindAptxNodes.getAlignmentWithNodes(), ++ + new JalviewBinding(aptx, viewport, bindAptxNodes.getAlignmentWithNodes(), bindAptxNodes.getNodesWithAlignment()); -- ArchaeopteryxInit.bindFrameToJalview(aptx); ++ AptxInit.bindFrameToJalview(aptx); return aptx; diff --cc src/jalview/ext/treeviewer/ExternalTreeViewerI.java index 0000000,0000000..20c47f6 new file mode 100644 --- /dev/null +++ b/src/jalview/ext/treeviewer/ExternalTreeViewerI.java @@@ -1,0 -1,0 +1,6 @@@ ++package jalview.ext.treeviewer; ++ ++public interface ExternalTreeViewerI ++{ ++ ++} diff --cc src/jalview/gui/AlignFrame.java index 5dbfb41,1c19eb1..71f240b --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@@ -60,9 -60,9 +60,9 @@@ import jalview.datamodel.SeqCigar import jalview.datamodel.Sequence; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; - import jalview.ext.forester.io.TreeParser; -import jalview.ext.forester.io.ExternalTreeParserI; -import jalview.ext.forester.io.ForesterTreeParser; import jalview.ext.forester.io.SupportedTreeFileFilter; ++import jalview.ext.forester.io.TreeParser; +import jalview.ext.treeviewer.ExternalTreeParserI; import jalview.gui.ColourMenuHelper.ColourChangeListener; import jalview.gui.ViewSelectionMenu.ViewSetProvider; import jalview.io.AlignmentProperties; @@@ -3904,9 -3903,9 +3904,9 @@@ public class AlignFrame extends GAlignF NewickFile fin = null; try { - ExternalTreeParserI treeParser = new ForesterTreeParser( + ExternalTreeParserI treeParser = new TreeParser( filePath); - treeParser.loadTree(viewport); + treeParser.loadTreeFile(viewport); diff --cc src/jalview/gui/CalculationChooser.java index 11ee1a0,11ee1a0..30a9b3d --- a/src/jalview/gui/CalculationChooser.java +++ b/src/jalview/gui/CalculationChooser.java @@@ -28,7 -28,7 +28,7 @@@ import jalview.analysis.scoremodels.Sim import jalview.api.analysis.ScoreModelI; import jalview.api.analysis.SimilarityParamsI; import jalview.datamodel.SequenceGroup; --import jalview.ext.archaeopteryx.ArchaeopteryxInit; ++import jalview.ext.archaeopteryx.AptxInit; import jalview.util.MessageManager; import java.awt.BorderLayout; @@@ -497,7 -497,7 +497,7 @@@ public class CalculationChooser extend substitutionMatrix, params); TreeBuilder calculatedTree = treeCalculator.makeTree(af.getViewport()); -- ArchaeopteryxInit.createInstance(calculatedTree); ++ AptxInit.createInstance(calculatedTree); TreeModel tree = new TreeModel(calculatedTree); openTreePanel(tree, treeAlgo, substitutionMatrix); diff --cc test/jalview/ext/archaeopteryx/AptxJalviewSequenceTreeTest.java index 569855c,569855c..e7324eb --- a/test/jalview/ext/archaeopteryx/AptxJalviewSequenceTreeTest.java +++ b/test/jalview/ext/archaeopteryx/AptxJalviewSequenceTreeTest.java @@@ -60,7 -60,7 +60,7 @@@ public class AptxJalviewSequenceTreeTes @BeforeClass(dependsOnMethods = { "setUpTree" }) public void createTreeView() { -- treeView = ArchaeopteryxInit.createInstance(jalviewTree); ++ treeView = AptxInit.createInstance(jalviewTree); aptx = (MainFrame) treeView; // still pretty ugly treePanel = aptx.getMainPanel().getCurrentTreePanel(); diff --cc test/jalview/ext/archaeopteryx/AptxPhylogenyTreeTest.java index 921150c,921150c..9d62eb1 --- a/test/jalview/ext/archaeopteryx/AptxPhylogenyTreeTest.java +++ b/test/jalview/ext/archaeopteryx/AptxPhylogenyTreeTest.java @@@ -61,7 -61,7 +61,7 @@@ public class AptxPhylogenyTreeTest exte @BeforeClass(dependsOnMethods = { "setUpJalview", "setUpTree" }) public void createTreeView() { -- treeView = ArchaeopteryxInit.createUnboundInstance(inputTree); ++ treeView = AptxInit.createUnboundInstance(inputTree); aptx = (MainFrame) treeView; // pretty ugly treePanel = aptx.getMainPanel().getCurrentTreePanel(); tree = treePanel.getPhylogeny();