import jalview.util.MappingUtils;
import jalview.util.QuickSort;
+import java.awt.Color;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.List;
}
}
- public static final ProfilesI calculate(List<SequenceI> list,
- int start, int end)
+ public static final ProfilesI calculate(List<SequenceI> list, int start,
+ int end)
{
return calculate(list, start, end, false);
}
}
/**
+ * 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)
+ {
+ /*
+ * happens if sequences calculated over were
+ * shorter than alignment width
+ */
+ gaprow.annotations[i] = null;
+ return;
+ }
+
+ final int gapped = profile.getNonGapped();
+
+ String description = "";
+
+ gaprow.annotations[i] = new Annotation(description, description,
+ '\0', gapped, jalview.util.ColorUtils.bleachColour(
+ Color.DARK_GRAY, (float) scale * gapped));
+ }
+ }
+
+ /**
* Returns a tooltip showing either
* <ul>
* <li>the full profile (percentages of all residues present), if
* calculations
* @return
*/
- public static int[] extractProfile(ProfileI profile,
- boolean ignoreGaps)
+ public static int[] extractProfile(ProfileI profile, boolean ignoreGaps)
{
int[] rtnval = new int[64];
ResidueCount counts = profile.getCounts();