Merge branch 'develop' into features/JAL-2446NCList
[jalview.git] / src / jalview / analysis / AlignmentSorter.java
index e7733e9..b5cefe0 100755 (executable)
@@ -108,8 +108,9 @@ public class AlignmentSorter
             true);
     for (int i = 0; i < nSeq; i++)
     {
-      scores[i] = (float) PIDModel.computePID(align.getSequenceAt(i)
-              .getSequenceAsString(), refSeq, pidParams);
+      scores[i] = (float) PIDModel.computePID(
+              align.getSequenceAt(i).getSequenceAsString(), refSeq,
+              pidParams);
       seqs[i] = align.getSequenceAt(i);
     }
 
@@ -415,7 +416,8 @@ public class AlignmentSorter
     }
     else
     {
-      setReverseOrder(align, vectorSubsetToArray(tmp, align.getSequences()));
+      setReverseOrder(align,
+              vectorSubsetToArray(tmp, align.getSequences()));
     }
   }
 
@@ -450,12 +452,9 @@ public class AlignmentSorter
 
       if (tmp.size() != nSeq)
       {
-        System.err
-                .println("WARNING: tmp.size()="
-                        + tmp.size()
-                        + " != nseq="
-                        + nSeq
-                        + " in getOrderByTree - tree contains sequences not in alignment");
+        System.err.println("WARNING: tmp.size()=" + tmp.size() + " != nseq="
+                + nSeq
+                + " in getOrderByTree - tree contains sequences not in alignment");
       }
     }
 
@@ -491,7 +490,8 @@ public class AlignmentSorter
     }
     else
     {
-      setReverseOrder(align, vectorSubsetToArray(tmp, align.getSequences()));
+      setReverseOrder(align,
+              vectorSubsetToArray(tmp, align.getSequences()));
     }
   }
 
@@ -681,27 +681,6 @@ public class AlignmentSorter
 
   public static String FEATURE_DENSITY = "density";
 
-  private static boolean containsIgnoreCase(final String lab,
-          final List<String> labs)
-  {
-    if (labs == null)
-    {
-      return true;
-    }
-    if (lab == null)
-    {
-      return false;
-    }
-    for (String label : labs)
-    {
-      if (lab.equalsIgnoreCase(label))
-      {
-        return true;
-      }
-    }
-    return false;
-  }
-
   /**
    * Sort sequences by feature score or density, optionally restricted by
    * feature types, feature groups, or alignment start/end positions.
@@ -755,13 +734,10 @@ public class AlignmentSorter
        * get sequence residues overlapping column region
        * and features for residue positions and specified types
        */
-      // TODO new method findPositions(startCol, endCol)? JAL-2544
-      int startResidue = seqs[i].findPosition(startCol);
-      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(startCol + 1,
+              endCol + 1, types);
 
       seqScores[i] = 0;
       scores[i] = 0.0;
@@ -772,18 +748,6 @@ public class AlignmentSorter
         SequenceFeature sf = it.next();
 
         /*
-         * double-check feature overlaps columns (JAL-2544)
-         * (could avoid this with a findPositions(fromCol, toCol) method)
-         * findIndex returns base 1 column values, startCol/endCol are base 0
-         */
-        if (seqs[i].findIndex(sf.getBegin()) > endCol + 1
-                || seqs[i].findIndex(sf.getEnd()) < startCol + 1)
-        {
-          it.remove();
-          continue;
-        }
-
-        /*
          * accept all features with null or empty group, otherwise
          * check group is one of the currently visible groups
          */