refactored visible contig/gap map array intersection code to alignmentView
[jalview.git] / src / jalview / ws / jws1 / JPredClient.java
index 8fff195..f479347 100644 (file)
@@ -99,33 +99,7 @@ public class JPredClient extends WS1Client
 
     if (viewonly)
     {
-      int[] viscontigs = alview.getVisibleContigs();
-      int spos = 0;
-      int i = 0;
-      if (viscontigs != null)
-      {
-        // Construct the delMap - mapping from the positions within the input to
-        // Jnet to the contigs in the original sequence
-
-        delMap = new int[seq.getEnd() - seq.getStart() + 1];
-        int gapMap[] = seq.gapMap();
-        for (int contig = 0; contig < viscontigs.length; contig += 2)
-        {
-
-          while (spos < gapMap.length && gapMap[spos] < viscontigs[contig])
-          {
-            spos++;
-          }
-          while (spos < gapMap.length
-                  && gapMap[spos] <= viscontigs[contig + 1])
-          {
-            delMap[i++] = spos++;
-          }
-        }
-        int tmap[] = new int[i];
-        System.arraycopy(delMap, 0, tmap, 0, i);
-        delMap = tmap;
-      }
+      delMap = alview.getVisibleContigMapFor(seq.gapMap());
     }
     if (msa && msf.length > 1)
     {