JAL-4071 first working prototype
[jalview.git] / src / jalview / workers / ColumnCounterSetWorker.java
index 74695fe..3a4bcc4 100644 (file)
  */
 package jalview.workers;
 
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.List;
+
 import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
 import jalview.datamodel.AlignmentAnnotation;
@@ -31,10 +35,6 @@ import jalview.renderer.seqfeatures.FeatureRenderer;
 import jalview.util.ColorUtils;
 import jalview.util.Comparison;
 
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * A class to compute alignment annotations with column counts for a set of
  * properties of interest on positions in an alignment. <br>
@@ -223,6 +223,26 @@ class ColumnCounterSetWorker extends AlignCalcWorker
     return annotationAdded;
   }
 
+  void removeOldAnnotations(String[] annotDescs)
+  {
+    // TODO use the commented out code once JAL-2075 is fixed
+    // to get adequate performance on genomic length sequence
+    AlignmentI alignment = alignViewport.getAlignment();
+    ArrayList<AlignmentAnnotation> toRemove = new ArrayList<AlignmentAnnotation>();
+    for (String toRemoveDesc : annotDescs)
+    {
+      for (AlignmentAnnotation aa : ourAnnots)
+      {
+        if (toRemoveDesc.equals(aa.getCalcId()))
+          toRemove.add(aa);
+      }
+    }
+    for (AlignmentAnnotation deleted : toRemove)
+    {
+      alignment.deleteAnnotation(deleted);
+    }
+  }
+
   /**
    * Returns a count of any feature types present at the specified position of
    * the alignment