JAL-2480 efficient test for features present on sequence
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 12 May 2017 13:32:33 +0000 (14:32 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 12 May 2017 13:32:33 +0000 (14:32 +0100)
src/jalview/gui/SequenceFetcher.java
src/jalview/renderer/seqfeatures/FeatureRenderer.java

index bf0ab70..da026b5 100755 (executable)
@@ -1006,15 +1006,11 @@ public class SequenceFetcher extends JPanel implements Runnable
         {
           for (SequenceI sq : alsqs)
           {
         {
           for (SequenceI sq : alsqs)
           {
-            if ((sfs = sq.getSequenceFeatures()) != null)
+            if (sq.getFeatures().hasFeatures())
             {
             {
-              if (sfs.length > 0)
-              {
-                af.setShowSeqFeatures(true);
-                break;
-              }
+              af.setShowSeqFeatures(true);
+              break;
             }
             }
-
           }
         }
 
           }
         }
 
index f4648c4..d6be4c2 100644 (file)
@@ -215,13 +215,6 @@ public class FeatureRenderer extends FeatureRendererModel
       return null;
     }
 
       return null;
     }
 
-    SequenceFeature[] sequenceFeatures = seq.getSequenceFeatures();
-
-    if (sequenceFeatures == null || sequenceFeatures.length == 0)
-    {
-      return null;
-    }
-
     if (Comparison.isGap(seq.getCharAt(column)))
     {
       return Color.white;
     if (Comparison.isGap(seq.getCharAt(column)))
     {
       return Color.white;
@@ -270,8 +263,7 @@ public class FeatureRenderer extends FeatureRendererModel
           final SequenceI seq, int start, int end, int y1,
           boolean colourOnly)
   {
           final SequenceI seq, int start, int end, int y1,
           boolean colourOnly)
   {
-    SequenceFeature[] sequenceFeatures = seq.getSequenceFeatures();
-    if (sequenceFeatures == null || sequenceFeatures.length == 0)
+    if (!seq.getFeatures().hasFeatures())
     {
       return null;
     }
     {
       return null;
     }
@@ -286,7 +278,7 @@ public class FeatureRenderer extends FeatureRendererModel
     }
 
     int startPos = seq.findPosition(start);
     }
 
     int startPos = seq.findPosition(start);
-    int endPos = seq.findPosition(end);
+    int endPos = seq.findPosition(end);// todo a performant overload of this!
 
     Color drawnColour = null;
 
 
     Color drawnColour = null;