JAL-3285 small code changes to ConsensusThread not included in merge
[jalview.git] / src / jalview / workers / ConsensusThread.java
index d6a4488..f5cad71 100644 (file)
@@ -50,7 +50,7 @@ public class ConsensusThread extends AlignCalcWorker
     try
     {
       AlignmentAnnotation consensus = getConsensusAnnotation();
-      AlignmentAnnotation gap = getOccupancyAnnotation();
+      AlignmentAnnotation gap = getGapAnnotation();
       if ((consensus == null && gap == null) || calcMan.isPending(this))
       {
         calcMan.workerComplete(this);
@@ -118,8 +118,11 @@ public class ConsensusThread extends AlignCalcWorker
   protected void eraseConsensus(int aWidth)
   {
     AlignmentAnnotation consensus = getConsensusAnnotation();
-    consensus.annotations = new Annotation[aWidth];
-    AlignmentAnnotation gap = getOccupancyAnnotation();
+    if (consensus != null)
+    {
+      consensus.annotations = new Annotation[aWidth];
+    }
+    AlignmentAnnotation gap = getGapAnnotation();
     if (gap != null)
     {
       gap.annotations = new Annotation[aWidth];
@@ -137,7 +140,7 @@ public class ConsensusThread extends AlignCalcWorker
     ProfilesI hconsensus = AAFrequency.calculate(aseqs, width, 0, width,
             true);
 
-    alignViewport.setConsensusProfiles(hconsensus);
+    alignViewport.setSequenceConsensusHash(hconsensus);
     setColourSchemeConsensus(hconsensus);
   }
 
@@ -176,9 +179,9 @@ public class ConsensusThread extends AlignCalcWorker
    * 
    * @return
    */
-  protected AlignmentAnnotation getOccupancyAnnotation()
+  protected AlignmentAnnotation getGapAnnotation()
   {
-    return alignViewport.getOccupancyAnnotation();
+    return alignViewport.getAlignmentGapAnnotation();
   }
 
   /**
@@ -199,10 +202,10 @@ public class ConsensusThread extends AlignCalcWorker
             && hconsensus != null)
     {
       deriveConsensus(consensus, hconsensus);
-      AlignmentAnnotation occupancy = getOccupancyAnnotation();
-      if (occupancy != null)
+      AlignmentAnnotation gap = getGapAnnotation();
+      if (gap != null)
       {
-        deriveOccupancy(occupancy, hconsensus);
+        deriveOccupancy(gap, hconsensus);
       }
     }
   }
@@ -234,11 +237,11 @@ public class ConsensusThread extends AlignCalcWorker
    * @param hconsensus
    *          the computed consensus data
    */
-  protected void deriveOccupancy(AlignmentAnnotation gapAnnotation,
+  protected void deriveGap(AlignmentAnnotation gapAnnotation,
           ProfilesI hconsensus)
   {
     long nseq = getSequences().length;
-    AAFrequency.completeOccupancyAnnot(gapAnnotation, hconsensus,
+    AAFrequency.completeGapAnnot(gapAnnotation, hconsensus,
             hconsensus.getStartColumn(), hconsensus.getEndColumn() + 1,
             nseq);
   }
@@ -251,6 +254,6 @@ public class ConsensusThread extends AlignCalcWorker
   protected Object getViewportConsensus()
   {
     // TODO convert ComplementConsensusThread to use Profile
-    return alignViewport.getConsensusProfiles();
+    return alignViewport.getSequenceConsensusHash();
   }
 }