Merge branch 'releases/Release_2_10_4_Branch' into develop
[jalview.git] / src / jalview / analysis / Dna.java
index d534c8f..2ad8487 100644 (file)
@@ -437,6 +437,7 @@ public class Dna
   {
     List<int[]> skip = new ArrayList<>();
     int[] skipint = null;
+
     int npos = 0;
     int vc = 0;
 
@@ -574,7 +575,7 @@ public class Dna
             skip.add(skipint);
             skipint = null;
           }
-          if (aa.equals("STOP"))
+          if (aa.equals(ResidueProperties.STOP))
           {
             aa = STOP_ASTERIX;
           }
@@ -881,6 +882,23 @@ public class Dna
   }
 
   /**
+   * Answers the reverse complement of the input string
+   * 
+   * @see #getComplement(char)
+   * @param s
+   * @return
+   */
+  public static String reverseComplement(String s)
+  {
+    StringBuilder sb = new StringBuilder(s.length());
+    for (int i = s.length() - 1; i >= 0; i--)
+    {
+      sb.append(Dna.getComplement(s.charAt(i)));
+    }
+    return sb.toString();
+  }
+
+  /**
    * Returns dna complement (preserving case) for aAcCgGtTuU. Ambiguity codes
    * are treated as on http://reverse-complement.com/. Anything else is left
    * unchanged.