findSequenceMatch returns multiple sequences
authoramwaterhouse <Andrew Waterhouse>
Mon, 14 Aug 2006 15:10:09 +0000 (15:10 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 14 Aug 2006 15:10:09 +0000 (15:10 +0000)
src/jalview/datamodel/Alignment.java
src/jalview/datamodel/AlignmentI.java

index 507102e..92ef23a 100755 (executable)
@@ -427,6 +427,28 @@ public class Alignment implements AlignmentI
         return null;
     }
 
+    public SequenceI [] findSequenceMatch(String name)
+    {
+      Vector matches = new Vector();
+      int i = 0;
+
+      while (i < sequences.size())
+      {
+          if (getSequenceAt(i).getName().equals(name))
+          {
+              matches.addElement(getSequenceAt(i));
+          }
+          i++;
+      }
+
+      SequenceI [] result = new SequenceI[matches.size()];
+      for(i=0; i<result.length; i++)
+        result[i] = (SequenceI)matches.elementAt(i);
+
+      return result;
+
+    }
+
 
     /**    */
     public int findIndex(SequenceI s)
index 06e93d7..e7b5ffb 100755 (executable)
@@ -123,6 +123,7 @@ public interface AlignmentI
      */\r
     public SequenceI findName(String name);\r
 \r
+    public SequenceI [] findSequenceMatch(String name);\r
 \r
     /**\r
      * Finds index of a given sequence in the alignment.\r