can search ids
authoramwaterhouse <Andrew Waterhouse>
Thu, 28 Apr 2005 15:31:43 +0000 (15:31 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 28 Apr 2005 15:31:43 +0000 (15:31 +0000)
src/jalview/gui/Finder.java

index 7483a0a..5a2dfe9 100755 (executable)
@@ -13,7 +13,6 @@ public class Finder extends GFinder
   AlignViewport av;\r
   AlignmentPanel ap;\r
   JInternalFrame frame;\r
-  String searchString;\r
   SuperGroup searchGroup;\r
 \r
   int seqIndex = 0;\r
@@ -67,6 +66,7 @@ public class Finder extends GFinder
     try{\r
       // if allResults is null, this effectively switches displaySearch flag in seqCanvas\r
       ap.highlightSearchResults( null );\r
+      ap.idPanel.highlightSearchResults( null );\r
      // frame.setClosed(true);\r
     }catch(Exception ex){ }\r
   }\r
@@ -85,7 +85,10 @@ public class Finder extends GFinder
   void doSearch(boolean findAll)\r
   {\r
     createNewGroup.setEnabled(false);\r
-    searchString = textfield.getText().toUpperCase();\r
+\r
+    String searchString = textfield.getText().toUpperCase();\r
+\r
+    com.stevesoft.pat.Regex regex = new  com.stevesoft.pat.Regex(searchString);\r
 \r
     ArrayList searchResults = new ArrayList();\r
     int [] allResults = null;\r
@@ -163,7 +166,6 @@ public class Finder extends GFinder
       }\r
 \r
 \r
-      com.stevesoft.pat.Regex regex = new  com.stevesoft.pat.Regex(searchString);\r
 \r
       for(int r = resIndex; r<noGaps.length(); r++)\r
       {\r
@@ -203,6 +205,18 @@ public class Finder extends GFinder
       }\r
     }\r
 \r
+\r
+    ArrayList idMatch = new ArrayList();\r
+    for(int id = 0; id<av.alignment.getHeight(); id++)\r
+    {\r
+      if(   regex.search( av.alignment.getSequenceAt(id).getName() ) )\r
+        idMatch.add( av.alignment.getSequenceAt(id) );\r
+    }\r
+\r
+    if(searchResults.size()==0 && idMatch.size()>0)\r
+      ap.idPanel.highlightSearchResults( idMatch );\r
+\r
+\r
     if(searchResults.size()>0)\r
     {\r
       allResults = new int[searchResults.size()];\r