AlignViewport av;\r
AlignmentPanel ap;\r
JInternalFrame frame;\r
- String searchString;\r
SuperGroup searchGroup;\r
\r
int seqIndex = 0;\r
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
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
String item=null;\r
boolean found = false;\r
\r
- /// is the searchString a residue number?\r
+ ////// is the searchString a residue number?\r
try{\r
int res = Integer.parseInt(searchString);\r
found = true;\r
\r
- if(av.getSelection().size()>0)\r
- seq = (Sequence)(av.getSelection().sequenceAt(0));\r
+ if(av.getSelectionGroup().getSize()>0)\r
+ seq = (Sequence)(av.getSelectionGroup().getSequenceAt(0));\r
else\r
seq = (Sequence)av.getAlignment().getSequenceAt(0);\r
\r
searchResults.add( Integer.toString( seq.findIndex(res)-1 ) );\r
\r
}catch(NumberFormatException ex){}\r
+ ///////////////////////////////////////////////\r
+\r
\r
jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme();\r
Color [] newColors = new Color[24];\r
\r
int end = av.alignment.getHeight();\r
\r
-\r
- SequenceGroup rubberband = av.getRubberbandGroup();\r
- if(rubberband!=null)\r
- end = rubberband.getEndRes();\r
-\r
-\r
+ SequenceGroup selection = av.getSelectionGroup();\r
+ if(selection!=null)\r
+ if(selection.getSize()<1 || (selection.getEndRes()-selection.getStartRes()<2))\r
+ selection = null;\r
\r
while( !found && seqIndex<end)\r
{\r
- seq = (Sequence)av.getAlignment().getSequenceAt(seqIndex);\r
+ seq = (Sequence)av.alignment.getSequenceAt(seqIndex);\r
\r
- if( av.getSelection().size()>0 && !av.getSelection().contains(seq)\r
- || (rubberband!=null && !rubberband.sequences.contains(seq)) )\r
+\r
+ if(selection!=null && !selection.sequences.contains(seq))\r
{\r
- // if a selection has been made, only search within that selection\r
seqIndex++;\r
resIndex=0;\r
continue;\r
}\r
\r
- item = seq.getSequence();\r
+ item = seq.getSequence().toUpperCase();\r
\r
- if(rubberband!=null)\r
- item = item.substring(0, rubberband.getEndRes()+1);\r
+ if(selection!=null && selection.getEndRes()<av.alignment.getWidth())\r
+ item = item.substring(0, selection.getEndRes()+1);\r
\r
///Shall we ignore gaps????\r
StringBuffer noGaps = new StringBuffer();\r
}\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
if( regex.searchFrom( noGaps.toString(), r ) )\r
{\r
resIndex = regex.matchedFrom();\r
-\r
-\r
- if(rubberband!=null && ( resIndex+ Integer.parseInt(spaces.get(resIndex).toString()) )<rubberband.getStartRes())\r
+ if(selection!=null && ( resIndex+ Integer.parseInt(spaces.get(resIndex).toString()) )<selection.getStartRes())\r
continue;\r
\r
searchResults.add( Integer.toString( seqIndex) );\r
}\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