+ 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
+ cons.findQuality();\r
+ String sequence = cons.getConsSequence().getSequence();\r
+ float minR,minG,minB, maxR,maxG,maxB;\r
+ minR = 0.3f;\r
+ minG = 0f;\r
+ minB = 0f;\r
+ maxR = 1.0f-minR; maxG=0.9f-minG; maxB=0f-minB; // scalable range for colouring\r
+ float min = cons.qualityRange[0].floatValue();\r
+ float max = cons.qualityRange[1].floatValue();\r
+\r
+ for (int i = 0; i < alignment.getWidth(); i++)\r
+ {\r
+ float value = 0;\r
+ try\r
+ {\r
+ //value = Integer.parseInt(sequence.charAt(i) + "");\r
+ value = ((Double) cons.quality.get(i)).floatValue();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ if (sequence.charAt(i) == '*') value = 10;\r
+ }\r
+ float vprop = value-min;\r
+ vprop/=max;\r
+ annotations[i] = new Annotation(sequence.charAt(i) + "",\r
+ "Conservation graph", ' ', value, new Color(minR+maxR*vprop, minB+maxB*vprop, minB+maxB*vprop));\r
+ }\r
+\r
+ if(conservation==null)\r
+ {\r
+ conservation = new AlignmentAnnotation("Quality",\r
+ "Quality of total alignment",\r
+ annotations,\r
+ cons.qualityRange[0].floatValue(),\r
+ cons.qualityRange[1].floatValue(), 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 += (int)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