From 2fa35cedbc936e82f7d2ccee409e4afa41a7b6db Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 15 Jul 2015 12:03:28 +0100 Subject: [PATCH] JAL-1813 only pair up A-Z with a-z if annotation is RNA --- src/jalview/renderer/AnnotationRenderer.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index 3359678..61194ce 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -47,6 +47,12 @@ import com.stevesoft.pat.Regex; public class AnnotationRenderer { + private static final int UPPER_TO_LOWER = 'a' - 'A'; // 32 + + private static final int CHAR_A = 'A'; // 65 + + private static final int CHAR_Z = 'Z'; // 90 + /** * flag indicating if timing and redraw parameter info should be output */ @@ -715,14 +721,14 @@ public class AnnotationRenderer } } - if (ss >= 65) + if (isRNA && (ss >= CHAR_A) && (ss <= CHAR_Z)) { // distinguish between forward/backward base-pairing - if (displayChar.indexOf(ss + 32) > -1) + int ssLowerCase = ss + UPPER_TO_LOWER; + // TODO would .equals() be safer here? or charAt(0)? + if (displayChar.indexOf(ssLowerCase) > -1) { - - ss = (char) (ss + 32); - + ss = (char) ssLowerCase; } } -- 1.7.10.2