From ef7288c0cdbcb714f7c0cb4acbdb35e8f33ecfc6 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 6 Jan 2017 14:42:40 +0000 Subject: [PATCH] JAL-2371 correct Clustal, Blosum, PID colouring of consensus logo --- src/jalview/renderer/AnnotationRenderer.java | 27 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index e30fb0c..5973710 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -29,8 +29,12 @@ import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.Annotation; import jalview.datamodel.ColumnSelection; import jalview.datamodel.ProfilesI; +import jalview.schemes.CollectionColourScheme; +import jalview.schemes.CollectionColourSchemeI; import jalview.schemes.ColourSchemeI; +import jalview.schemes.NucleotideColourScheme; import jalview.schemes.ResidueProperties; +import jalview.schemes.ZappoColourScheme; import jalview.util.Platform; import java.awt.BasicStroke; @@ -70,7 +74,7 @@ public class AnnotationRenderer boolean av_renderHistogram = true, av_renderProfile = true, av_normaliseProfile = false; - ColourSchemeI profcolour = null; + CollectionColourSchemeI profcolour = null; private ColumnSelection columnSelection; @@ -312,13 +316,17 @@ public class AnnotationRenderer av_renderHistogram = av.isShowConsensusHistogram(); av_renderProfile = av.isShowSequenceLogo(); av_normaliseProfile = av.isNormaliseSequenceLogo(); - profcolour = av.getGlobalColourScheme(); - if (profcolour == null) + profcolour = av.getViewportColourScheme(); + if (profcolour == null || profcolour.getColourScheme() == null) { - // Set the default colour for sequence logo if the alignment has no - // colourscheme set - profcolour = av.getAlignment().isNucleotide() ? new jalview.schemes.NucleotideColourScheme() - : new jalview.schemes.ZappoColourScheme(); + /* + * Use default colour for sequence logo if + * the alignment has no colourscheme set + * (would like to use user preference but n/a for applet) + */ + ColourSchemeI col = av.getAlignment().isNucleotide() ? new NucleotideColourScheme() + : new ZappoColourScheme(); + profcolour = new CollectionColourScheme(col); } columnSelection = av.getColumnSelection(); hconsensus = av.getSequenceConsensusHash(); @@ -1423,11 +1431,12 @@ hconsensus.get(column), { final String codonTranslation = ResidueProperties .codonTranslate(new String(dc)); - colour = profcolour.findColour(codonTranslation.charAt(0)); + colour = profcolour.findColour(codonTranslation.charAt(0), + column, null); } else { - colour = profcolour.findColour(dc[0]); + colour = profcolour.findColour(dc[0], column, null); } g.setColor(colour == Color.white ? Color.lightGray : colour); -- 1.7.10.2