From: Jim Procter Date: Thu, 1 Dec 2016 10:34:07 +0000 (+0000) Subject: JAL-1933 basic hack to get gap counts shown as an annotation row. X-Git-Tag: Release_2_11_0~62^2~37^2~2 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=6dd2a0e7f175aea6f16ded581d7e97f263f7875d JAL-1933 basic hack to get gap counts shown as an annotation row. --- diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index 17874e6..b5dab6f 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -289,6 +289,55 @@ public class AAFrequency } /** + * Derive the gap count annotation row. + * + * @param consensus + * 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 consensus, + ProfilesI profiles, int startCol, int endCol, long nseq) + { + // long now = System.currentTimeMillis(); + if (consensus == null || consensus.annotations == null + || consensus.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 + */ + consensus.annotations[i] = null; + return; + } + + final int gapped = profile.getGapped(); + + String description = "" + gapped; + + consensus.annotations[i] = new Annotation(gapped); + } + // long elapsed = System.currentTimeMillis() - now; + // System.out.println(-elapsed); + } + + /** * Returns a tooltip showing either *