JAL-3210 Improvements to eclipse detection. New src tree and SwingJS updated from...
[jalview.git] / src / jalview / analysis / scoremodels / FeatureDistanceModel.java
index 056ecdb..38217e9 100644 (file)
@@ -55,12 +55,12 @@ public class FeatureDistanceModel extends DistanceScoreModel
   @Override
   public ScoreModelI getInstance(AlignmentViewPanel view)
   {
-    FeatureDistanceModel instance;
+    FeatureDistanceModel model;
     try
     {
-      instance = this.getClass().newInstance();
-      instance.configureFromAlignmentView(view);
-      return instance;
+      model = this.getClass().newInstance();
+      model.configureFromAlignmentView(view);
+      return model;
     } catch (InstantiationException | IllegalAccessException e)
     {
       System.err.println("Error in " + getClass().getName()
@@ -124,8 +124,8 @@ public class FeatureDistanceModel extends DistanceScoreModel
         /*
          * first record feature types in this column for each sequence
          */
-        Map<SeqCigar, Set<String>> sfap = findFeatureTypesAtColumn(
-                seqs, cpos);
+        Map<SeqCigar, Set<String>> sfap = findFeatureTypesAtColumn(seqs,
+                cpos);
 
         /*
          * count feature types on either i'th or j'th sequence but not both
@@ -177,10 +177,12 @@ public class FeatureDistanceModel extends DistanceScoreModel
   /**
    * Builds and returns a map containing a (possibly empty) list (one per
    * SeqCigar) of visible feature types at the given column position. The map
-   * has no entry for sequences which are gapped at the column position.
+   * does not include entries for features which straddle a gapped column
+   * positions.
    * 
    * @param seqs
    * @param columnPosition
+   *          (0..)
    * @return
    */
   protected Map<SeqCigar, Set<String>> findFeatureTypesAtColumn(
@@ -192,9 +194,12 @@ public class FeatureDistanceModel extends DistanceScoreModel
       int spos = seq.findPosition(columnPosition);
       if (spos != -1)
       {
+        /*
+         * position is not a gap
+         */
         Set<String> types = new HashSet<String>();
-        List<SequenceFeature> sfs = fr.findFeaturesAtRes(seq.getRefSeq(),
-                spos);
+        List<SequenceFeature> sfs = fr.findFeaturesAtResidue(
+                seq.getRefSeq(), spos);
         for (SequenceFeature sf : sfs)
         {
           types.add(sf.getType());