residueHash = new Hashtable();\r
\r
for (int j=0; j < sequences.size(); 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
Sequence s = (Sequence)sequences.elementAt(j);\r
\r
}\r
}\r
}\r
+ \r
total.addElement(resultHash);\r
}\r
}\r
}\r
return count;\r
}\r
+ /*** \r
+ * countConsNGaps\r
+ * returns gap count in int[0], and conserved residue count in int[1]\r
+ */\r
+ public int[] countConsNGaps(int j)\r
+ {\r
+ int count = 0;\r
+ int cons=0;\r
+ int nres = 0;\r
+ int[] r = new int[2];\r
+ char f='$';\r
+ for (int i = 0; i < sequences.size();i++)\r
+ {\r
+ if( j >= ((Sequence)sequences.elementAt(i)).getSequence().length())\r
+ { count++; \r
+ continue;}\r
+\r
+ char c = ((Sequence)sequences.elementAt(i)).getSequence().charAt(j);\r
+ if (jalview.util.Comparison.isGap((c)))\r
+ count++;\r
+ else {\r
+ nres++;\r
+ if (nres==1) {\r
+ f = c;\r
+ cons++;\r
+ } else\r
+ if (f == c) {\r
+ cons++;\r
+ }\r
+ }\r
+ }\r
+ r[0] = (nres==cons) ? 1 : 0;\r
+ r[1] = count;\r
+\r
+ \r
+ return r;\r
+ }\r
\r
public void verdict(boolean consflag, float percentageGaps) {\r
String consString = "";\r
\r
for (int i=start; i <= end; i++) {\r
- int totGaps = countGaps(i);\r
+ int[] gapcons = countConsNGaps(i);\r
+ boolean cons = (gapcons[0]==1) ? true : false;\r
+ int totGaps = gapcons[1];\r
float 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
}\r
\r
if (count < 10)\r
- consString = consString + String.valueOf(count);\r
+ consString = consString + String.valueOf(count);// Conserved props!=Identity\r
else\r
- consString = consString + "*";\r
+ consString = consString + ((gapcons[0]==1) ? "*" : "+");\r
\r
}\r
else\r
try {\r
sr = (double)BLOSUM62[i][seqNum]+4;\r
} catch (Exception e) {\r
- System.out.println("Exception in sr " + e);\r
+ System.out.println("Exception in sr: " + e);\r
}\r
//Calculate X with another loop over residues\r
\r