- int[][] profile = (int[][]) hci.get(AAFrequency.PROFILE);
- if (profile != null && includeAllConsSymbols)
- {
- int sequenceCount = profile[1][0];
- int nonGappedCount = profile[1][1];
- int normalisedBy = ignoreGapsInConsensusCalculation ? nonGappedCount
- : sequenceCount;
- mouseOver.setLength(0);
- if (alphabet != null)
- {
- for (int c = 0; c < alphabet.length; c++)
- {
- float tval = profile[0][alphabet[c]] * 100f / normalisedBy;
- mouseOver
- .append(((c == 0) ? "" : "; "))
- .append(alphabet[c])
- .append(" ")
- .append(((fmt != null) ? fmt.form(tval) : ((int) tval)))
- .append("%");
- }
- }
- else
- {
- // TODO do this sort once only in calculate()?
- // char[][] ca = new char[profile[0].length][];
- char[] ca = new char[profile[0].length];
- float[] vl = new float[profile[0].length];
- for (int c = 0; c < ca.length; c++)
- {
- ca[c] = (char) c;
- // ca[c] = new char[]
- // { (char) c };
- vl[c] = profile[0][c];
- }
- QuickSort.sort(vl, ca);
- for (int p = 0, c = ca.length - 1; profile[0][ca[c]] > 0; c--)
- {
- final char residue = ca[c];
- if (residue != '-')
- {
- float tval = profile[0][residue] * 100f / normalisedBy;
- mouseOver
- .append((((p == 0) ? "" : "; ")))
- .append(residue)
- .append(" ")
- .append(((fmt != null) ? fmt.form(tval)
- : ((int) tval))).append("%");
- p++;
- }
- }
- }
- }
- else
+ consensus.annotations[i] = new Annotation(modalResidue, description,
+ ' ', value);
+ }
+ // long elapsed = System.currentTimeMillis() - now;
+ // System.out.println(-elapsed);
+ }
+
+ /**
+ * Derive the gap count annotation row.
+ *
+ * @param gaprow
+ * the annotation row to add annotations to
+ * @param profiles
+ * the source consensus data
+ * @param startCol
+ * start column (inclusive)
+ * @param endCol
+ * end column (exclusive)
+ */
+ public static void completeGapAnnot(AlignmentAnnotation gaprow,
+ ProfilesI profiles, int startCol, int endCol, long nseq)
+ {
+ if (gaprow == null || gaprow.annotations == null
+ || gaprow.annotations.length < endCol)
+ {
+ /*
+ * called with a bad alignment annotation row
+ * wait for it to be initialised properly
+ */
+ return;
+ }
+ // always set ranges again
+ gaprow.graphMax = nseq;
+ gaprow.graphMin = 0;
+ double scale = 0.8 / nseq;
+ for (int i = startCol; i < endCol; i++)
+ {
+ ProfileI profile = profiles.get(i);
+ if (profile == null)