+
+ /**
+ * Compute all or part of the annotation row from the given consensus hashtable
+ * @param consensus - pre-allocated annotation row
+ * @param hconsensus
+ * @param iStart
+ * @param width
+ * @param ignoreGapsInConsensusCalculation
+ */
+ public static void completeConsensus(AlignmentAnnotation consensus,
+ Hashtable[] hconsensus, int iStart, int width,
+ boolean ignoreGapsInConsensusCalculation)
+ {
+ for (int i = iStart; i < width; i++)
+ {
+ float value = 0;
+ if (ignoreGapsInConsensusCalculation)
+ {
+ value = ((Float) hconsensus[i].get(AAFrequency.PID_NOGAPS))
+ .floatValue();
+ }
+ else
+ {
+ value = ((Float) hconsensus[i].get(AAFrequency.PID_GAPS))
+ .floatValue();
+ }
+
+ String maxRes = hconsensus[i].get(AAFrequency.MAXRESIDUE)
+ .toString();
+ String mouseOver = hconsensus[i].get(AAFrequency.MAXRESIDUE)
+ + " ";
+
+ if (maxRes.length() > 1)
+ {
+ mouseOver = "[" + maxRes + "] ";
+ maxRes = "+";
+ }
+
+ mouseOver += ((int) value + "%");
+ consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ',
+ value);
+ }
+ }