javadoc
[jalview.git] / src / jalview / schemes / ResidueProperties.java
index 77938dd..69b43a2 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
- * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
+ * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -1138,8 +1138,14 @@ public class ResidueProperties
     return null;
   }
 
-  public static String codonTranslate(String codon)
+  public static String codonTranslate(String lccodon)
   {
+    String codon=lccodon.toUpperCase();
+    // all base ambiguity codes yield an 'X' amino acid residue
+    if (codon.indexOf('X')>-1 || codon.indexOf('N')>-1)
+    {
+      return "X";
+    }
     Enumeration e = codonHash.keys();
 
     while (e.hasMoreElements())
@@ -1147,7 +1153,7 @@ public class ResidueProperties
       String key = (String) e.nextElement();
       Vector tmp = (Vector) codonHash.get(key);
 
-      if (tmp.contains(codon.toUpperCase()))
+      if (tmp.contains(codon))
       {
         return key;
       }