From: Jim Procter Date: Mon, 1 Jun 2015 16:04:01 +0000 (+0100) Subject: JAL-1370 group and alignment reference sequences are not replaced with '.' X-Git-Tag: Release_2_10_0~564^2~3^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6966b639be33cdd34480c877fffbc45810ea1534;p=jalview.git JAL-1370 group and alignment reference sequences are not replaced with '.' when show Unconserved display is enabled --- diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 70acb7b..21286ad 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -323,11 +323,17 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer { boolean srep = av.isDisplayReferenceSeq(); boolean getboxColour = false; + boolean isarep = av.getAlignment().getSeqrep() == seq; + boolean isgrep = currentSequenceGroup != null ? currentSequenceGroup + .getSeqrep() == seq : false; + char sr_c; for (int i = start; i <= end; i++) { + graphics.setColor(av.getTextColour()); getboxColour = false; s = seq.getCharAt(i); + if (!renderGaps && jalview.util.Comparison.isGap(s)) { continue; @@ -364,11 +370,12 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer { graphics.setColor(currentSequenceGroup.textColour); } - if (currentSequenceGroup.getShowNonconserved()) // todo optimize + if (!isarep && !isgrep + && currentSequenceGroup.getShowNonconserved()) // todo + // optimize { // todo - use sequence group consensus - s = getDisplayChar(srep, i, s, - '.'); + s = getDisplayChar(srep, i, s, '.', currentSequenceGroup); } @@ -408,10 +415,9 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer graphics.setColor(av.getTextColour2()); } } - if (av.getShowUnconserved()) + if (!isarep && av.getShowUnconserved()) { - s = getDisplayChar(srep, i, s, - '.'); + s = getDisplayChar(srep, i, s, '.', currentSequenceGroup); } @@ -438,12 +444,20 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer * @return */ private char getDisplayChar(final boolean usesrep, int position, - char sequenceChar, char conservedChar) + char sequenceChar, char conservedChar, SequenceGroup currentGroup) { // TODO - use currentSequenceGroup rather than alignment // currentSequenceGroup.getConsensus() - char conschar = (usesrep) ? av.getAlignment().getSeqrep().getCharAt(position) : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter - .charAt(0); + char conschar = (usesrep) ? (currentGroup == null ? av.getAlignment() + .getSeqrep().getCharAt(position) + : (currentGroup.getSeqrep() != null ? currentGroup.getSeqrep() + .getCharAt(position) : av.getAlignment().getSeqrep() + .getCharAt(position))) + : (currentGroup != null && currentGroup.getConsensus() != null) ? currentGroup + .getConsensus().annotations[position].displayCharacter + .charAt(0) + : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter + .charAt(0); if (conschar != '-' && (sequenceChar == conschar || sequenceChar + CHAR_TO_UPPER == conschar)) {