JAL-1813 only pair up A-Z with a-z if annotation is RNA
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 15 Jul 2015 11:03:28 +0000 (12:03 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 15 Jul 2015 11:03:28 +0000 (12:03 +0100)
src/jalview/renderer/AnnotationRenderer.java

index 3359678..61194ce 100644 (file)
@@ -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;
               }
             }