checkfor gap characters
[jalview.git] / src / jalview / analysis / AAFrequency.java
index c8e6388..c61e7ef 100755 (executable)
@@ -28,7 +28,7 @@ public class AAFrequency {
     {\r
 \r
       Hashtable residueHash = new Hashtable();\r
-      int       maxCount    = -1;\r
+      int       maxCount    = 0;\r
       String    maxResidue  = "-";\r
       int       nongap      = 0;\r
       for (int j=0; j < sequences.size(); j++)\r
@@ -41,9 +41,9 @@ public class AAFrequency {
           if (s.getSequence().length() > i)\r
           {\r
 \r
-            String res = s.getSequence().substring(i,i+1);\r
+            String res = s.getSequence().charAt(i)+"";\r
 \r
-            if (!res.equals("-"))\r
+            if (!jalview.util.Comparison.isGap(res.charAt(0)))\r
               nongap++;\r
 \r
             if (residueHash.containsKey(res))\r
@@ -52,7 +52,7 @@ public class AAFrequency {
               int count = ((Integer)residueHash.get(res)).intValue() ;\r
               count++;\r
 \r
-             if (!res.equals("-") && count >= maxCount)\r
+             if (!jalview.util.Comparison.isGap(res.charAt(0)) && count >= maxCount)\r
               {\r
 \r
                   if(count>maxCount)\r
@@ -84,7 +84,10 @@ public class AAFrequency {
           }\r
         }\r
       }\r
+\r
       residueHash.put("maxCount",new Integer(maxCount));\r
+      if(maxCount<0)\r
+        System.out.println("asasa "+maxCount);\r
       residueHash.put("maxResidue", maxResidue);\r
       residueHash.put("size", new Integer(sequences.size()));\r
       residueHash.put("nongap", new Integer(nongap));\r