formatting
[jalview.git] / src / jalview / analysis / AAFrequency.java
index f409f8c..4a68f81 100755 (executable)
@@ -53,6 +53,11 @@ public class AAFrequency
 \r
      Hashtable [] reply = new Hashtable[width];\r
 \r
+     if(end>=width)\r
+     {\r
+       end = width;\r
+     }\r
+\r
      calculate(seqs, start, end, reply);\r
 \r
      return reply;\r
@@ -68,9 +73,9 @@ public static final void calculate(SequenceI[] sequences,
   char c;\r
   float percentage;\r
 \r
-  int[] values = new int[132];\r
+  int[] values = new int[255];\r
 \r
-  String seq;\r
+  char [] seq;\r
 \r
   for (i = start; i < end; i++)\r
   {\r
@@ -78,14 +83,14 @@ public static final void calculate(SequenceI[] sequences,
     maxCount = 0;\r
     maxResidue = "";\r
     nongap = 0;\r
-    values = new int[132];\r
+    values = new int[255];\r
 \r
     for (j = 0; j < jSize; j++)\r
     {\r
       seq = sequences[j].getSequence();\r
-      if (seq.length() > i)\r
+      if (seq.length > i)\r
       {\r
-        c = seq.charAt(i);\r
+        c = seq[i];\r
 \r
         if(c == '.' || c==' ')\r
           c = '-';\r