findByShortName
authoramwaterhouse <Andrew Waterhouse>
Mon, 14 Nov 2005 11:59:13 +0000 (11:59 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 14 Nov 2005 11:59:13 +0000 (11:59 +0000)
src/jalview/datamodel/Alignment.java
src/jalview/datamodel/AlignmentI.java

index d945ec6..0b3adff 100755 (executable)
@@ -451,6 +451,23 @@ public class Alignment implements AlignmentI
         }\r
     }\r
 \r
+    public SequenceI findShortName(String name)\r
+    {\r
+      int i = 0;\r
+\r
+      while (i < sequences.size())\r
+      {\r
+          if (getSequenceAt(i).getShortName().equals(name))\r
+          {\r
+              return getSequenceAt(i);\r
+          }\r
+\r
+          i++;\r
+      }\r
+\r
+        return null;\r
+    }\r
+\r
     /**    */\r
     public SequenceI findName(String name)\r
     {\r
@@ -458,11 +475,9 @@ public class Alignment implements AlignmentI
 \r
         while (i < sequences.size())\r
         {\r
-            SequenceI s = getSequenceAt(i);\r
-\r
-            if (s.getName().equals(name))\r
+            if (getSequenceAt(i).getName().equals(name))\r
             {\r
-                return s;\r
+                return getSequenceAt(i);\r
             }\r
 \r
             i++;\r
index be3093c..ed1ec4e 100755 (executable)
@@ -125,6 +125,8 @@ public interface AlignmentI
      */\r
     public SequenceI findName(String name);\r
 \r
+    public SequenceI findShortName(String name);\r
+\r
 \r
     /**\r
      * Finds index of a given sequence in the alignment.\r
@@ -305,4 +307,6 @@ public interface AlignmentI
 \r
     public void setProvenance(Provenance prov);\r
 \r
+\r
+\r
 }\r