+ consensus.annotations[i] = new Annotation(modalResidue, description,
+ ' ', value);
+ }
+ // long elapsed = System.currentTimeMillis() - now;
+ // jalview.bin.Console.outPrintln(-elapsed);
+ }
+
+
+ public static void completeSSConsensus(AlignmentAnnotation ssConsensus,
+ ProfilesI profiles, int startCol, int endCol, boolean ignoreGaps,
+ boolean showSequenceLogo, long nseq)
+ {
+ // long now = System.currentTimeMillis();
+ if (ssConsensus == null || ssConsensus.annotations == null
+ || ssConsensus.annotations.length < endCol)
+ {
+ /*
+ * called with a bad alignment annotation row
+ * wait for it to be initialised properly
+ */
+ return;
+ }
+
+ for (int i = startCol; i < endCol; i++)
+ {
+ ProfileI profile = profiles.get(i);
+ if (profile == null)
+ {
+ /*
+ * happens if sequences calculated over were
+ * shorter than alignment width
+ */
+ ssConsensus.annotations[i] = null;
+ return;
+ }
+
+ final int dp = getPercentageDp(nseq);
+
+ float value = profile.getSSPercentageIdentity(ignoreGaps);
+
+ String description = getSSTooltip(profile, value, showSequenceLogo,
+ ignoreGaps, dp);
+
+ String modalSS = profile.getModalSS();
+ if ("".equals(modalSS))
+ {
+ modalSS = "-";
+ }
+ else if (modalSS.length() > 1)
+ {
+ modalSS = "+";
+ }
+ ssConsensus.annotations[i] = new Annotation(modalSS, description,
+ ' ', value);
+ }
+ // long elapsed = System.currentTimeMillis() - now;
+ // jalview.bin.Console.outPrintln(-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)