From: James Procter Date: Fri, 24 Mar 2023 13:29:40 +0000 (+0000) Subject: JAL-4134 - store colours in annotation row, so colour by annotation can be used to... X-Git-Tag: Release_2_11_3_0~14^2~3^2^2~38 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=207a0da1aff8dbeabb81b4cf01d5a6ba64cf6602;p=jalview.git JAL-4134 - store colours in annotation row, so colour by annotation can be used to shade sequence or alignment by PAE groups. Not working - see comments --- diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index 29826f0..8de161f 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -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(); + } + } + } } }