AlignmentPanel ap;\r
Frame frame;\r
SuperGroup searchGroup;\r
+ Vector searchResults;\r
\r
int seqIndex = 0;\r
int resIndex = 0;\r
\r
public void createNewGroup_actionPerformed(ActionEvent e)\r
{\r
- for(int i=0; i<searchGroup.getSize(); i++)\r
- av.alignment.addGroup( searchGroup.getGroupeAt(i));\r
+ jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme();\r
+ Color [] newColors = new Color[24];\r
+ for(int i=0; i<24; i++)\r
+ newColors[i] = new Color(60,160,115);\r
+\r
+ ucs.setColourScheme(newColors);\r
+ String searchString = textfield.getText();\r
+\r
+ searchGroup = new SuperGroup(searchString, ucs , true, true, false);\r
+\r
+\r
+ for(int i=0; i<searchResults.size(); i+=3)\r
+ {\r
+ // its possible edits may have occurred since search was performed\r
+ // account for this here\r
+\r
+ SequenceI seq = av.alignment.getSequenceAt( Integer.parseInt(searchResults.elementAt(i).toString()) );\r
+ int startRes = seq.findIndex( Integer.parseInt(searchResults.elementAt(i+1).toString()) )-1;\r
+ int endRes = seq.findIndex( Integer.parseInt(searchResults.elementAt(i+2).toString()) )-1;\r
+\r
+ SequenceGroup sg = new SequenceGroup(searchString, ucs, true, true, false, startRes , endRes );\r
+ sg.addSequence(seq);\r
+ av.alignment.addGroup(sg);\r
+ searchGroup.addGroup( sg );\r
+\r
+ }\r
\r
ap.av.alignment.addSuperGroup(searchGroup);\r
ap.highlightSearchResults( null );\r
\r
com.stevesoft.pat.Regex regex = new com.stevesoft.pat.Regex(searchString);\r
\r
- Vector searchResults = new Vector();\r
+ searchResults = new Vector();\r
int [] allResults = null;\r
\r
Sequence seq;\r
///////////////////////////////////////////////\r
\r
\r
- jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme();\r
- Color [] newColors = new Color[24];\r
- for(int i=0; i<24; i++)\r
- newColors[i] = new Color(60,160,115);\r
-\r
- ucs.setColourScheme(newColors);\r
-\r
- searchGroup = new SuperGroup(searchString, ucs , true, true, false);\r
-\r
int end = av.alignment.getHeight();\r
\r
SequenceGroup selection = av.getSelectionGroup();\r
continue;\r
\r
searchResults.addElement( Integer.toString( seqIndex) );\r
- searchResults.addElement( Integer.toString( resIndex+ Integer.parseInt(spaces.elementAt(resIndex).toString()) ) );\r
- searchResults.addElement( Integer.toString( regex.matchedTo()-1 + Integer.parseInt(spaces.elementAt(regex.matchedTo()-1).toString()) ) );\r
-\r
- SequenceGroup sg = new SequenceGroup(searchString, ucs, true, true, false,\r
- resIndex+ Integer.parseInt(spaces.elementAt(resIndex).toString()) ,\r
- regex.matchedTo()-1 + Integer.parseInt(spaces.elementAt(regex.matchedTo()-1).toString())\r
- );\r
- sg.addSequence((Sequence)av.getAlignment().getSequenceAt(seqIndex));\r
- searchGroup.addGroup( sg );\r
+ int sres = seq.findPosition( resIndex+ Integer.parseInt(spaces.elementAt(resIndex).toString()) );\r
+ int eres = seq.findPosition( regex.matchedTo()-1 + Integer.parseInt(spaces.elementAt(regex.matchedTo()-1).toString()) );\r
+ searchResults.addElement( sres+"" );\r
+ searchResults.addElement( eres+"" );\r
+\r
\r
if(!findAll)\r
{\r