From 5e59e8410d369c7ee653f1442c28198d75efbb30 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 8 Jul 2024 12:02:00 +0100 Subject: [PATCH] JAL-4392 check if we are rendering a ss-consensus logo *just once* per row --- src/jalview/renderer/AnnotationRenderer.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index 3235624..1ab9e48 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -1508,6 +1508,14 @@ public class AnnotationRenderer int column; int aaMax = aa_annotations.length - 1; + + /** + * TODO Should really set this using a constant local to AlignmentAnnotation + * in the same way as the cDNA and rna structure profiles are typed + */ + boolean _aa_is_dssp3 = _aa.autoCalculated && _aa.label + .startsWith(Constants.SECONDARY_STRUCTURE_CONSENSUS_LABEL); + while (x < eRes - sRes) { column = sRes + x; @@ -1563,6 +1571,7 @@ public class AnnotationRenderer // just try to draw the logo if profl is not null if (profl != null && profl[2] != 0) { + // TODO do we ever have different profiles for different columns ? Move up to where we set _aa_is_dssp3 boolean isStructureProfile = profl[0] == AlignmentAnnotation.STRUCTURE_PROFILE; boolean isCdnaProfile = profl[0] == AlignmentAnnotation.CDNA_PROFILE; float ht = normaliseProfile ? y - _aa.graphHeight : y1; @@ -1639,15 +1648,13 @@ public class AnnotationRenderer .codonTranslate(s); colour = profcolour.findColour(codonTranslation.charAt(0), column, null); - } - if(_aa.label.startsWith(Constants.SECONDARY_STRUCTURE_CONSENSUS_LABEL)) { + } else if(_aa_is_dssp3) { + // TODO - would be nice to get rid of the special 'findSSColour' here ? colour = profcolour.findSSColour(dc[0], column); } else { - colour = profcolour.findColour(dc[0], column, null); - } g.setColor(colour == Color.white ? Color.lightGray : colour); -- 1.7.10.2