Merge branch 'features/JAL-4134_treeviewerforcolumns' into features/JAL-4134_use_anno...
authorJames Procter <j.procter@dundee.ac.uk>
Mon, 1 May 2023 09:57:51 +0000 (10:57 +0100)
committerJames Procter <j.procter@dundee.ac.uk>
Mon, 1 May 2023 09:57:51 +0000 (10:57 +0100)
src/jalview/gui/TreeCanvas.java

index 29826f0..8de161f 100755 (executable)
@@ -54,6 +54,7 @@ import jalview.analysis.Conservation;
 import jalview.analysis.TreeModel;
 import jalview.api.AlignViewportI;
 import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
 import jalview.datamodel.BinaryNode;
 import jalview.datamodel.ColumnSelection;
 import jalview.datamodel.ContactMatrixI;
@@ -1028,6 +1029,21 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
             cm.setColorForGroup(gp, colors.get(gp));
           }
         }
+        // stash colors in linked annotation row.
+        // doesn't work yet. TESTS!
+        int sstart=aa.sequenceRef!=null ? aa.sequenceRef.getStart()-1 : 0;
+        for (BitSet gp : colors.keySet())
+        {
+          Color gpcol = colors.get(gp);
+          for (int p = gp.nextSetBit(0); p >= 0; p = gp.nextSetBit(p + 1))
+          {
+            Annotation ae = aa.getAnnotationForPosition(p+sstart);
+            if (ae != null)
+            {
+              ae.colour = gpcol.brighter().darker();
+            }
+          }
+        }
       }
     }