+\r
+ if (conservation == null)\r
+ {\r
+ conservation = new AlignmentAnnotation("Conservation",\r
+ "Conservation of total alignment less than " +\r
+ ConsPercGaps + "% gaps",\r
+ annotations, 0f, // cons.qualityRange[0].floatValue(),\r
+ 11f, // cons.qualityRange[1].floatValue()\r
+ AlignmentAnnotation.BAR_GRAPH);\r
+\r
+ if (showConservation)\r
+ {\r
+ alignment.addAnnotation(conservation);\r
+ }\r
+\r
+ quality = new AlignmentAnnotation("Quality",\r
+ "Alignment Quality based on Blosum62 scores",\r
+ qannotations,\r
+ cons.qualityRange[0].floatValue(),\r
+ cons.qualityRange[1].floatValue(),\r
+ AlignmentAnnotation.BAR_GRAPH);\r
+\r
+ if (showQuality)\r
+ {\r
+ alignment.addAnnotation(quality);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ conservation.annotations = annotations;\r
+ quality.annotations = qannotations;\r
+ quality.graphMax = cons.qualityRange[1].floatValue();\r
+ }\r
+ }\r
+ catch (OutOfMemoryError error)\r
+ {\r
+ javax.swing.SwingUtilities.invokeLater(new Runnable()\r
+ {\r
+ public void run()\r
+ {\r
+ javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "Out of memory calculating conservation!!"\r
+ +\r
+ "\nSee help files for increasing Java Virtual Machine memory."\r
+ , "Out of memory",\r
+ javax.swing.JOptionPane.WARNING_MESSAGE);\r
+ }\r
+ });\r
+\r
+ System.out.println("Conservation calculation: " + error);\r
+ System.gc();\r
+\r
+ }\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ */\r
+ public void updateConsensus()\r
+ {\r
+ try{\r
+ Annotation[] annotations = new Annotation[alignment.getWidth()];\r
+\r
+ // this routine prevents vconsensus becoming a new object each time\r
+ // consenus is calculated. Important for speed of Blosum62\r
+ // and PID colouring of alignment\r
+ if (vconsensus == null)\r
+ {\r
+ vconsensus = alignment.getAAFrequency();\r
+ }\r
+ else\r
+ {\r
+ Vector temp = alignment.getAAFrequency();\r
+ vconsensus.clear();\r
+\r
+ Enumeration e = temp.elements();\r
+\r
+ while (e.hasMoreElements())\r
+ {\r
+ vconsensus.add(e.nextElement());\r
+ }\r
+ }\r
+\r
+ Hashtable hash = null;\r
+\r
+ for (int i = 0; i < alignment.getWidth(); i++)\r
+ {\r
+ hash = (Hashtable) vconsensus.elementAt(i);\r
+\r
+ float value = 0;\r
+ if (ignoreGapsInConsensusCalculation)\r
+ value = ( (Float) hash.get("pid_nogaps")).floatValue();\r
+ else\r
+ value = ( (Float) hash.get("pid_gaps")).floatValue();\r
+\r
+ String maxRes = hash.get("maxResidue").toString();\r
+ String mouseOver = hash.get("maxResidue") + " ";\r
+\r
+ if (maxRes.length() > 1)\r
+ {\r
+ mouseOver = "[" + maxRes + "] ";\r
+ maxRes = "+";\r
+ }\r
+\r
+ mouseOver += ( (int) value + "%");\r
+ annotations[i] = new Annotation(maxRes, mouseOver, ' ', value);\r
+ }\r
+\r
+ if (consensus == null)\r
+ {\r
+ consensus = new AlignmentAnnotation("Consensus", "PID",\r
+ annotations, 0f, 100f,AlignmentAnnotation.BAR_GRAPH);\r
+\r
+ if (showIdentity)\r
+ {\r
+ alignment.addAnnotation(consensus);\r
+ }\r
+ }\r
+ else\r
+ {\r
+ consensus.annotations = annotations;\r
+ }\r
+\r
+ if (globalColourScheme != null)\r
+ globalColourScheme.setConsensus(vconsensus);\r
+\r
+ }catch(OutOfMemoryError error)\r
+ {\r
+ javax.swing.SwingUtilities.invokeLater(new Runnable()\r
+ {\r
+ public void run()\r
+ {\r
+ javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+ "Out of memory calc45ulating consensus!!"\r
+ +\r
+ "\nSee help files for increasing Java Virtual Machine memory."\r
+ , "Out of memory",\r
+ javax.swing.JOptionPane.WARNING_MESSAGE);\r
+ }\r
+ });\r
+\r
+\r
+ System.out.println("Consensus calculation: " + error);\r
+ System.gc();\r
+ }\r
+\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public SequenceGroup getSelectionGroup()\r
+ {\r
+ return selectionGroup;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param sg DOCUMENT ME!\r
+ */\r
+ public void setSelectionGroup(SequenceGroup sg)\r
+ {\r
+ selectionGroup = sg;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getConservationSelected()\r
+ {\r
+ return conservationColourSelected;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void setConservationSelected(boolean b)\r
+ {\r
+ conservationColourSelected = b;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public boolean getAbovePIDThreshold()\r
+ {\r
+ return abovePIDThreshold;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param b DOCUMENT ME!\r
+ */\r
+ public void setAbovePIDThreshold(boolean b)\r
+ {\r
+ abovePIDThreshold = b;\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @return DOCUMENT ME!\r
+ */\r
+ public int getStartRes()\r
+ {\r
+ return startRes;\r