JAL-98 with the two types missing from last commit Profiles[I] ! bug/JAL-98consensusMemory
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 18 Nov 2016 08:55:47 +0000 (08:55 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 18 Nov 2016 08:55:47 +0000 (08:55 +0000)
src/jalview/datamodel/Profiles.java [new file with mode: 0644]
src/jalview/datamodel/ProfilesI.java [new file with mode: 0644]
src/jalview/workers/ConsensusThread.java

diff --git a/src/jalview/datamodel/Profiles.java b/src/jalview/datamodel/Profiles.java
new file mode 100644 (file)
index 0000000..98a8c6d
--- /dev/null
@@ -0,0 +1,43 @@
+package jalview.datamodel;
+
+public class Profiles implements ProfilesI
+{
+
+  private ProfileI[] profiles;
+
+  public Profiles(ProfileI[] p)
+  {
+    profiles = p;
+  }
+
+  /**
+   * Returns the profile for the given column, or null if none found
+   * 
+   * @param col
+   */
+  @Override
+  public ProfileI get(int col)
+  {
+    return profiles != null && col >= 0 && col < profiles.length ? profiles[col]
+            : null;
+  }
+
+  /**
+   * Returns the first column (base 0) covered by the profiles
+   */
+  @Override
+  public int getStartColumn()
+  {
+    return 0;
+  }
+
+  /**
+   * Returns the last column (base 0) covered by the profiles
+   */
+  @Override
+  public int getEndColumn()
+  {
+    return profiles == null ? 0 : profiles.length - 1;
+  }
+
+}
diff --git a/src/jalview/datamodel/ProfilesI.java b/src/jalview/datamodel/ProfilesI.java
new file mode 100644 (file)
index 0000000..6719de6
--- /dev/null
@@ -0,0 +1,12 @@
+package jalview.datamodel;
+
+public interface ProfilesI
+{
+
+  ProfileI get(int i);
+
+  int getStartColumn();
+
+  int getEndColumn();
+
+}
index b6c7a91..debe45d 100644 (file)
@@ -200,7 +200,8 @@ public class ConsensusThread extends AlignCalcWorker
   {
 
     long nseq = getSequences().length;
   {
 
     long nseq = getSequences().length;
-    AAFrequency.completeConsensus(consensusAnnotation, hconsensus, 0,
+    AAFrequency.completeConsensus(consensusAnnotation, hconsensus,
+            hconsensus.getStartColumn(),
             hconsensus.getEndColumn() + 1,
             alignViewport.isIgnoreGapsConsensus(),
             alignViewport.isShowSequenceLogo(), nseq);
             hconsensus.getEndColumn() + 1,
             alignViewport.isIgnoreGapsConsensus(),
             alignViewport.isShowSequenceLogo(), nseq);