- residueHash = new Hashtable();\r
- maxCount = 0;\r
- maxResidue = "-";\r
- nongap = 0;\r
-\r
- for (j = 0; j < jSize; j++)\r
- {\r
- if (sequences.elementAt(j) instanceof Sequence)\r
- {\r
- sequence = ((Sequence) sequences.elementAt(j)).getSequence();\r
-\r
- if (sequence.length() > i)\r
- {\r
- res = String.valueOf(Character.toUpperCase(sequence.charAt(i)));\r
-\r
- if (jalview.util.Comparison.isGap(res.charAt(0)))\r
- {\r
- res = "-"; // we always use this for gaps in the property vectors\r
- }\r
- else\r
- { nongap++; }\r
-\r
- if (residueHash.containsKey(res))\r
- {\r
- count = ((Integer) residueHash.get(res)).intValue();\r
- count++;\r
-\r
- if (!jalview.util.Comparison.isGap(res.charAt(0)) &&\r
- (count >= maxCount))\r
- {\r
- if (count > maxCount)\r
- {\r
- maxResidue = res;\r
- }\r
- else if (maxResidue.indexOf(res) == -1)\r
- {\r
- maxResidue += res;\r
- }\r
-\r
- maxCount = count;\r
- }\r
-\r
- residueHash.put(res, new Integer(count));\r
- }\r
- else\r
- {\r
- residueHash.put(res, new Integer(1));\r
- }\r
- }\r
- else\r
- {\r
- if (residueHash.containsKey("-"))\r
- {\r
- count = ((Integer) residueHash.get("-")).intValue();\r
- count++;\r
- residueHash.put("-", new Integer(count));\r
- }\r
- else\r
- {\r
- residueHash.put("-", new Integer(1));\r
- }\r
- }\r
- }\r
- }\r
-\r
- residueHash.put("maxCount", new Integer(maxCount));\r
- residueHash.put("maxResidue", maxResidue);\r
-\r
-\r
- //Size is redundant at present if we calculate percentage here\r
- //residueHash.put("size", new Integer(jSize));\r
- //residueHash.put("nogaps", new Integer(nongap));\r
-\r
- percentage = ((float)maxCount*100) / (float)jSize;\r
- residueHash.put("pid_gaps", new Float(percentage) );\r
-\r
- percentage = ((float)maxCount*100) / (float)nongap;\r
- residueHash.put("pid_nogaps", new Float(percentage) );\r
- result.addElement(residueHash);\r