JAL-2780 SequenceI.findFeatures takes column numbers in base 1…

authorJim Procter <jprocter@issues.jalview.org>
Tue, 13 Feb 2018 16:15:12 +0000 (16:15 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 13 Feb 2018 16:15:12 +0000 (16:15 +0000)
test/jalview/ws/PDBSequenceFetcherTest.java

index ba90dd8..9efcef2 100644 (file)
@@ -146,21 +146,24 @@ public class PDBSequenceFetcherTest
                 sq.getAllPDBEntries().size() > 0);
         // FIXME: should test that all residues extracted as sequences from
         // chains in structure have a mapping to data in the structure
-        StringBuilder errors = new StringBuilder();
         List<SequenceFeature> prev = null;
         int lastp = -1;
-        for (int rs = sq.getStart(); rs < sq.getStart()
-                + sq.getLength(); rs++)
+        for (int col = 1; col <= sq.getLength(); col++)
         {
-          List<SequenceFeature> sf = sq.findFeatures(rs, rs, "RESNUM");
+          List<SequenceFeature> sf = sq.findFeatures(col, col, "RESNUM");
           if (sf.size() != 1)
           {
             errors.append(
-                    "Expected feature at " + rs + ": saw " + sf.size());
+                    str.id + ": " +
+                            "Expected one feature at column (position): "
+                            + (col - 1)
+                            + " (" + sq.findPosition(col - 1) + ")"
+                            + ": saw "
+                            + sf.size());
             errors.append("\n");
             if (prev != null)
             {
-              errors.append("Last Feature was at " + lastp + ": "
+              errors.append("Last Feature was at position " + lastp + ": "
                       + prev.get(0).toString());
               errors.append("\n");
             }
@@ -168,7 +171,7 @@ public class PDBSequenceFetcherTest
           else
           {
             prev = sf;
-            lastp = rs;
+            lastp = sq.findPosition(col - 1);
           }
         }
         if (errors.length() > 0)