From bec86286aeecc7008a006e56efe3816a509cc593 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 7 Apr 2005 13:17:34 +0000 Subject: [PATCH] checkfor gap characters --- src/jalview/analysis/AAFrequency.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index c8e6388..c61e7ef 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -28,7 +28,7 @@ public class AAFrequency { { Hashtable residueHash = new Hashtable(); - int maxCount = -1; + int maxCount = 0; String maxResidue = "-"; int nongap = 0; for (int j=0; j < sequences.size(); j++) @@ -41,9 +41,9 @@ public class AAFrequency { if (s.getSequence().length() > i) { - String res = s.getSequence().substring(i,i+1); + String res = s.getSequence().charAt(i)+""; - if (!res.equals("-")) + if (!jalview.util.Comparison.isGap(res.charAt(0))) nongap++; if (residueHash.containsKey(res)) @@ -52,7 +52,7 @@ public class AAFrequency { int count = ((Integer)residueHash.get(res)).intValue() ; count++; - if (!res.equals("-") && count >= maxCount) + if (!jalview.util.Comparison.isGap(res.charAt(0)) && count >= maxCount) { if(count>maxCount) @@ -84,7 +84,10 @@ public class AAFrequency { } } } + residueHash.put("maxCount",new Integer(maxCount)); + if(maxCount<0) + System.out.println("asasa "+maxCount); residueHash.put("maxResidue", maxResidue); residueHash.put("size", new Integer(sequences.size())); residueHash.put("nongap", new Integer(nongap)); -- 1.7.10.2