JAL-2574 preparation for Sequence.findFeatures(col1, col2)
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 31 May 2017 09:59:58 +0000 (10:59 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 31 May 2017 09:59:58 +0000 (10:59 +0100)
src/jalview/analysis/AlignmentSorter.java
src/jalview/controller/AlignViewController.java
src/jalview/gui/AlignmentPanel.java
src/jalview/renderer/seqfeatures/FeatureRenderer.java
src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java

index e7733e9..bddf6e3 100755 (executable)
@@ -760,8 +760,8 @@ public class AlignmentSorter
       int endResidue = seqs[i].findPosition(endCol);
       String[] types = featureTypes == null ? null : featureTypes
               .toArray(new String[featureTypes.size()]);
-      List<SequenceFeature> sfs = seqs[i].getFeatures().findFeatures(
-              startResidue, endResidue, types);
+      List<SequenceFeature> sfs = seqs[i].findFeatures(startResidue,
+              endResidue, types);
 
       seqScores[i] = 0;
       scores[i] = 0.0;
index d1d61d2..33683fd 100644 (file)
@@ -242,8 +242,7 @@ public class AlignViewController implements AlignViewControllerI
       {
         int ist = sq.findPosition(sqcol.getStartRes());
         int iend = sq.findPosition(sqcol.getEndRes()); // see JAL-2526
-        List<SequenceFeature> sfs = sq.getFeatures().findFeatures(ist,
-                iend, featureType);
+        List<SequenceFeature> sfs = sq.findFeatures(ist, iend, featureType);
         boolean overlap = false;
         for (SequenceFeature sf : sfs)
         {
index f3e2733..f32dd7b 100644 (file)
@@ -1507,8 +1507,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
             }
             if (!Comparison.isGap(seq.getCharAt(res)))
             {
-              List<SequenceFeature> features = seq.getFeatures()
-                      .findFeatures(seqPos, seqPos);
+              List<SequenceFeature> features = seq.findFeatures(seqPos,
+                      seqPos);
               for (SequenceFeature sf : features)
               {
                 if (sf.isContactFeature())
index 5dce2b8..950d0cd 100644 (file)
@@ -302,23 +302,23 @@ public class FeatureRenderer extends FeatureRendererModel
 
       List<SequenceFeature> overlaps = seq.findFeatures(seqRange.start,
               seqRange.end, type);
-      for (SequenceFeature sequenceFeature : overlaps)
+      for (SequenceFeature sf : overlaps)
       {
         /*
          * a feature type may be flagged as shown but the group 
          * an instance of it belongs to may be hidden
          */
-        if (featureGroupNotShown(sequenceFeature))
+        if (featureGroupNotShown(sf))
         {
           continue;
         }
 
-        Color featureColour = getColour(sequenceFeature);
-        boolean isContactFeature = sequenceFeature.isContactFeature();
+        Color featureColour = getColour(sf);
+        boolean isContactFeature = sf.isContactFeature();
 
-        // todo overload findIndex using Location data
-        int featureStartCol = seq.findIndex(sequenceFeature.begin);
-        int featureEndCol = seq.findIndex(sequenceFeature.end);
+        int featureStartCol = seq.findIndex(sf.begin);
+        int featureEndCol = sf.begin == sf.end ? featureStartCol : seq
+                .findIndex(sf.end);
         if (isContactFeature)
         {
           boolean drawn = renderFeature(g, seq,
@@ -334,7 +334,7 @@ public class FeatureRenderer extends FeatureRendererModel
             drawnColour = featureColour;
           }
         }
-        else if (showFeature(sequenceFeature))
+        else if (showFeature(sf))
         {
           /*
            * showing feature score by height of colour
index a8e8989..eb47a80 100644 (file)
@@ -280,8 +280,8 @@ public abstract class FeatureRendererModel implements
      * include features at the position provided their feature type is 
      * displayed, and feature group is null or marked for display
      */
-    List<SequenceFeature> features = sequence.getFeatures().findFeatures(
-            res, res, visibleTypes);
+    List<SequenceFeature> features = sequence.findFeatures(res, res,
+            visibleTypes);
 
     for (SequenceFeature sf : features)
     {