allow findSeq to begin *after* a given sequence in the alignment
[jalview.git] / src / jalview / datamodel / Alignment.java
index 3689433..a88fa9e 100755 (executable)
@@ -344,10 +344,35 @@ public class Alignment
    */
   public SequenceI findName(String token, boolean b)
   {
-
+    return findName(null, token, b);
+  }
+  
+  /* (non-Javadoc)
+   * @see jalview.datamodel.AlignmentI#findName(SequenceI, java.lang.String, boolean)
+   */
+  public SequenceI findName(SequenceI startAfter, String token, boolean b)
+  {
+  
     int i = 0;
     SequenceI sq=null;
     String sqname=null;
+    if (startAfter!=null)
+    {
+      // try to find the sequence in the alignment
+      boolean matched=false;
+      while (i<sequences.size())
+      {
+        if (getSequenceAt(i++)==startAfter)
+        {
+          matched = true;
+          break;
+        }
+      }
+      if (!matched)
+      {
+        i=0;
+      }
+    }
     while (i < sequences.size())
     {
       sq = getSequenceAt(i);