+ AlignmentAnnotation consensus;\r
+ AlignmentAnnotation conservation;\r
+ public void updateConservation()\r
+ {\r
+ Annotation [] annotations = new Annotation[alignment.getWidth()];\r
+\r
+ Conservation cons = new jalview.analysis.Conservation("All",\r
+ jalview.schemes.ResidueProperties.propHash, 3,\r
+ alignment.getSequences(), 0,\r
+ alignment.getWidth());\r
+ cons.calculate();\r
+ cons.verdict(false, 100);\r
+\r
+ String sequence = cons.getConsSequence().getSequence();\r
+ for (int i = 0; i < alignment.getWidth(); i++)\r
+ {\r
+ int value = 0;\r
+ try\r
+ {\r
+ value = Integer.parseInt(sequence.charAt(i) + "");\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ if (sequence.charAt(i) == '*') value = 10;\r
+ }\r
+\r
+ annotations[i] = new Annotation(sequence.charAt(i) + "",\r
+ "Conservation graph", ' ', value);\r
+ }\r
+\r
+ if(conservation==null)\r
+ {\r
+ conservation = new AlignmentAnnotation("Conservation",\r
+ "Conservation of total alignment",\r
+ annotations, 0, 10, 1);\r
+ alignment.addAnnotation(conservation);\r
+ }\r
+ else\r
+ conservation.annotations = annotations;\r
+\r
+ }\r
+\r
+ public void updateConsensus()\r
+ {\r
+ Annotation [] annotations = new Annotation[alignment.getWidth()];\r
+\r
+ Vector cons = alignment.getAAFrequency();\r
+ Hashtable hash = null;\r
+ for (int i = 0; i < alignment.getWidth(); i++)\r
+ {\r
+ hash = (Hashtable) cons.elementAt(i);\r
+ float value = Float.parseFloat(hash.get("maxCount").toString());\r
+ value /= Float.parseFloat(hash.get("size").toString());\r
+\r
+ value *= 100;\r
+ String maxRes = hash.get("maxResidue")+" ";\r
+ String mouseOver = hash.get("maxResidue")+" ";\r
+ if(maxRes.length()>2)\r
+ {\r
+ mouseOver = "["+maxRes+"] ";\r
+ maxRes = "+ ";\r
+ }\r
+\r
+ mouseOver += value+"%";\r
+ annotations[i] = new Annotation(maxRes, mouseOver, ' ', value);\r
+\r
+ }\r
+\r
+ if(consensus==null)\r
+ {\r
+ consensus = new AlignmentAnnotation("% Identity",\r
+ "PID", annotations, 0f, 100f, 1);\r
+ alignment.addAnnotation(consensus);\r
+ }\r
+ else\r
+ consensus.annotations = annotations;\r
+\r
+ }\r
+\r