JAL-2844 added colouring to partition selection
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Wed, 29 Nov 2017 02:28:54 +0000 (02:28 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Wed, 29 Nov 2017 02:28:54 +0000 (02:28 +0000)
forester
src/jalview/ext/archaeopteryx/AptxInit.java
src/jalview/ext/archaeopteryx/JalviewBinding.java

index de67a09..b8121ed 160000 (submodule)
--- a/forester
+++ b/forester
@@ -1 +1 @@
-Subproject commit de67a099c57ee0483368de2880771cc1b755db65
+Subproject commit b8121ed04b4ec52eeb0361dd7417717a4c455d25
index 732e85a..9f2817e 100644 (file)
@@ -472,6 +472,8 @@ public final class AptxInit
     MainFrame aptxApp = Archaeopteryx.createApplication(aptxTree,
             APTX_CONFIG, treeTitle);
     // addPartitioningSlider(aptxApp);
+
+
     LoadedTreeAssociation bindAptxNodes = new LoadedTreeAssociation(
             jalviewAlignport.getAlignment().getSequencesArray(), aptxTree);
 
index 07d45c5..0e77243 100644 (file)
@@ -13,6 +13,7 @@ import jalview.structure.StructureSelectionManager;
 import jalview.util.MessageManager;
 import jalview.viewmodel.AlignmentViewport;
 
+import java.awt.Color;
 import java.awt.Graphics;
 import java.awt.event.ActionEvent;
 import java.awt.event.InputEvent;
@@ -29,9 +30,11 @@ import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
 import org.forester.archaeopteryx.MainFrame;
+import org.forester.archaeopteryx.TreePanelUtil;
 import org.forester.phylogeny.Phylogeny;
 import org.forester.phylogeny.PhylogenyMethods;
 import org.forester.phylogeny.PhylogenyNode;
+import org.forester.phylogeny.data.BranchColor;
 
 /**
  * Class for binding the Archaeopteryx tree viewer to the Jalview alignment that
@@ -241,16 +244,19 @@ public final class JalviewBinding
         //
         // System.out.println(relativeTreeWidth);
 
-        float xRoot = tree.getRoot().getXcoord();
-        double threshold = ((double) x - xRoot) / longestBranch;
-        System.out.println(threshold);
+        float rootX = tree.getRoot().getXcoord();
+        double threshold = ((double) x - rootX) / longestBranch;
         List<PhylogenyNode> foundNodes = getNodesAboveThreshold(threshold,
                 longestBranch, tree.getRoot());
         for (PhylogenyNode foundNode : foundNodes)
         {
-          System.out.println(foundNode);
+          Color randomColor = new Color((int) (Math.random() * 255),
+                  (int) (Math.random() * 255), (int) (Math.random() * 255));
+          TreePanelUtil.colorizeSubtree(foundNode,
+                  new BranchColor(randomColor));
         }
 
+
         // groupNodes(threshold, tree.getRoot(), longestBranch);
 
 
@@ -284,7 +290,7 @@ public final class JalviewBinding
 
       if (nodeCutoff > threshold)
       {
-        nodeList.add(node);
+        nodeList.add(childNode);
       }
 
       else