*/\r
private void calcSeqNums()\r
{\r
- for (int i = 0; i < sequences.size(); i++)\r
+ int i=0, iSize=sequences.size();\r
+ for (i=0; i < iSize; i++)\r
{\r
calcSeqNum(i);\r
}\r
*/\r
public void calculate()\r
{\r
- for (int i = start; i <= end; i++)\r
- {\r
- Hashtable resultHash = null;\r
- Hashtable residueHash = null;\r
+ Hashtable resultHash, residueHash, ht;\r
+ int count, thresh, j, jSize = sequences.size();\r
+ String sequence, res, type;\r
+ Enumeration enumeration, enumeration2;\r
\r
+ for (int i = start; i <= end; i++)\r
+ {\r
resultHash = new Hashtable();\r
residueHash = new Hashtable();\r
\r
- for (int j = 0; j < sequences.size(); j++)\r
+ for (j = 0; j < jSize; j++)\r
{\r
// JBPNote - have to make sure elements of the sequences vector\r
// are tested like this everywhere...\r
if (sequences.elementAt(j) instanceof Sequence)\r
{\r
- Sequence s = (Sequence) sequences.elementAt(j);\r
+ sequence = ((Sequence) sequences.elementAt(j)).getSequence();\r
\r
- if (s.getLength() > i)\r
+ if (sequence.length() > i)\r
{\r
- String res = s.getSequence().substring(i, i + 1);\r
+ res = sequence.substring(i, i + 1);\r
\r
if (residueHash.containsKey(res))\r
{\r
- int count = ((Integer) residueHash.get(res)).intValue();\r
+ count = ((Integer) residueHash.get(res)).intValue();\r
count++;\r
residueHash.put(res, new Integer(count));\r
}\r
{\r
if (residueHash.containsKey("-"))\r
{\r
- int count = ((Integer) residueHash.get("-")).intValue();\r
+ count = ((Integer) residueHash.get("-")).intValue();\r
count++;\r
residueHash.put("-", new Integer(count));\r
}\r
}\r
\r
//What is the count threshold to count the residues in residueHash()\r
- int thresh = (threshold * (sequences.size())) / 100;\r
+ thresh = (threshold * (sequences.size())) / 100;\r
\r
//loop over all the found residues\r
- Enumeration e = residueHash.keys();\r
+ enumeration = residueHash.keys();\r
\r
- while (e.hasMoreElements())\r
+ while (enumeration.hasMoreElements())\r
{\r
- String res = (String) e.nextElement();\r
+ res = (String) enumeration.nextElement();\r
\r
if (((Integer) residueHash.get(res)).intValue() > thresh)\r
{\r
//Now loop over the properties\r
- Enumeration e2 = propHash.keys();\r
+ enumeration2 = propHash.keys();\r
\r
- while (e2.hasMoreElements())\r
+ while (enumeration2.hasMoreElements())\r
{\r
- String type = (String) e2.nextElement();\r
- Hashtable ht = (Hashtable) propHash.get(type);\r
+ type = (String) enumeration2.nextElement();\r
+ ht = (Hashtable) propHash.get(type);\r
\r
//Have we ticked this before?\r
if (!resultHash.containsKey(type))\r
int nres = 0;\r
int[] r = new int[2];\r
char f = '$';\r
+ int i, iSize = sequences.size();\r
+ char c;\r
\r
- for (int i = 0; i < sequences.size(); i++)\r
+ for (i = 0; i < iSize; i++)\r
{\r
- if (j >= ((Sequence) sequences.elementAt(i)).getSequence().length())\r
+ if (j >= ((Sequence) sequences.elementAt(i)).getLength())\r
{\r
count++;\r
-\r
continue;\r
}\r
\r
- char c = ((Sequence) sequences.elementAt(i)).getSequence().charAt(j);\r
+ c = ((Sequence) sequences.elementAt(i)).getCharAt(j);\r
\r
if (jalview.util.Comparison.isGap((c)))\r
{\r
*/\r
public void verdict(boolean consflag, float percentageGaps)\r
{\r
- String consString = "";\r
+ StringBuffer consString = new StringBuffer();\r
+ String type;\r
+ Integer result;\r
+ int[] gapcons;\r
+ int totGaps, count;\r
+ float pgaps;\r
+ Hashtable resultHash ;\r
+ Enumeration enumeration;\r
+\r
\r
for (int i = start; i <= end; i++)\r
{\r
- int[] gapcons = countConsNGaps(i);\r
- int totGaps = gapcons[1];\r
- float pgaps = ((float) totGaps * 100) / (float) sequences.size();\r
+ gapcons = countConsNGaps(i);\r
+ totGaps = gapcons[1];\r
+ pgaps = ((float) totGaps * 100) / (float) sequences.size();\r
\r
- // System.out.println("percentage gaps = "+pgaps+"\n");\r
if (percentageGaps > pgaps)\r
{\r
- Hashtable resultHash = (Hashtable) total.elementAt(i - start);\r
+ resultHash = (Hashtable) total.elementAt(i - start);\r
\r
//Now find the verdict\r
- int count = 0;\r
- Enumeration e3 = resultHash.keys();\r
+ count = 0;\r
+ enumeration = resultHash.keys();\r
\r
- while (e3.hasMoreElements())\r
+ while (enumeration.hasMoreElements())\r
{\r
- String type = (String) e3.nextElement();\r
- Integer result = (Integer) resultHash.get(type);\r
+ type = (String) enumeration.nextElement();\r
+ result = (Integer) resultHash.get(type);\r
\r
//Do we want to count +ve conservation or +ve and -ve cons.?\r
if (consflag)\r
\r
if (count < 10)\r
{\r
- consString = consString + String.valueOf(count); // Conserved props!=Identity\r
+ consString.append(count); // Conserved props!=Identity\r
}\r
else\r
{\r
- consString = consString + ((gapcons[0] == 1) ? "*" : "+");\r
+ consString.append((gapcons[0] == 1) ? "*" : "+");\r
}\r
}\r
else\r
{\r
- consString = consString + "-";\r
+ consString.append("-");\r
}\r
}\r
\r
- consSequence = new Sequence(name, consString, start, end);\r
+ consSequence = new Sequence(name, consString.toString(), start, end);\r
}\r
\r
/**\r
quality = new Vector();\r
\r
double max = -10000;\r
- String s = "";\r
int[][] BLOSUM62 = jalview.schemes.ResidueProperties.getBLOSUM62();\r
\r
//Loop over columns // JBPNote Profiling info\r
\r
int size = seqNums.size();\r
int[] lengths = new int[size];\r
+ double tot, bigtot, sr, tmp;\r
+ double [] x, xx;\r
+ int l, j, i, ii, seqNum;\r
\r
- for (int l = 0; l < size; l++)\r
+ for (l = 0; l < size; l++)\r
lengths[l] = ((int[]) seqNums.elementAt(l)).length - 1;\r
\r
- for (int j = start; j <= end; j++)\r
+\r
+ for (j = start; j <= end; j++)\r
{\r
- double bigtot = 0;\r
+ bigtot = 0;\r
\r
// First Xr = depends on column only\r
- double[] x = new double[24];\r
+ x = new double[24];\r
\r
- for (int ii = 0; ii < 24; ii++)\r
+ for (ii = 0; ii < 24; ii++)\r
{\r
x[ii] = 0;\r
\r
// Now calculate D for each position and sum\r
for (int k = 0; k < size; k++)\r
{\r
- double tot = 0;\r
- double[] xx = new double[24];\r
- int seqNum = (j < lengths[k])\r
+ tot = 0;\r
+ xx = new double[24];\r
+ seqNum = (j < lengths[k])\r
? ((int[]) seqNums.elementAt(k))[j + 1] : 23; // Sequence, or gap at the end\r
\r
// This is a loop over r\r
- for (int i = 0; i < 23; i++)\r
+ for (i = 0; i < 23; i++)\r
{\r
- double sr = 0;\r
+ sr = 0;\r
\r
try\r
{\r
// bigtot = bigtot * (size-cons2[j][23])/size;\r
quality.addElement(new Double(bigtot));\r
\r
- s += "-";\r
\r
// Need to normalize by gaps\r
}\r
\r
double newmax = -10000;\r
\r
- for (int j = start; j <= end; j++)\r
+ for (j = start; j <= end; j++)\r
{\r
- double tmp = ((Double) quality.elementAt(j)).doubleValue();\r
+ tmp = ((Double) quality.elementAt(j)).doubleValue();\r
tmp = ((max - tmp) * (size - cons2[j][23])) / size;\r
\r
// System.out.println(tmp+ " " + j);\r