+
+ /**
+ * construct and call the calculation methods on a new Conservation object
+ *
+ * @param name
+ * - name of conservation
+ * @param seqs
+ * @param start
+ * first column in calculation window
+ * @param end
+ * last column in calculation window
+ * @param positiveOnly
+ * calculate positive (true) or positive and negative (false)
+ * conservation
+ * @param maxPercentGaps
+ * percentage of gaps tolerated in column
+ * @param calcQuality
+ * flag indicating if alignment quality should be calculated
+ * @return Conservation object ready for use in visualization
+ */
+ public static Conservation calculateConservation(String name,
+ List<SequenceI> seqs, int start, int end, boolean positiveOnly,
+ int maxPercentGaps, boolean calcQuality)
+ {
+ Conservation cons = new Conservation(name, seqs, start, end);
+ cons.calculate();
+ cons.verdict(positiveOnly, maxPercentGaps);
+
+ if (calcQuality)
+ {
+ cons.findQuality();
+ }
+
+ return cons;
+ }
+
+ /**
+ * Returns the computed tooltip (annotation description) for a given column.
+ * The tip is empty if the conservation score is zero, otherwise holds the
+ * conserved properties (and, optionally, properties whose absence is
+ * conserved).
+ *
+ * @param column
+ * @return
+ */
+ String getTooltip(int column)
+ {
+ SequenceI cons = getConsSequence();
+ char val = column < cons.getLength() ? cons.getCharAt(column) : '-';
+ boolean hasConservation = val != '-' && val != '0';
+ int consp = column - start;
+ String tip = (hasConservation && consp > -1 && consp < consSymbs.length)
+ ? consSymbs[consp]
+ : "";
+ return tip;
+ }