- seq = (Sequence) alignment.getSequenceAt(seqIndex);
-
- if ((selection != null) && !selection.getSequences(false).contains(seq))
- {
- seqIndex++;
- resIndex = 0;
-
- continue;
- }
-
- item = seq.getSequenceAsString();
- // JBPNote - check if this toUpper which is present in the application implementation makes a difference
- //if(!caseSensitive)
- // item = item.toUpperCase();
-
- if ((selection != null) &&
- (selection.getEndRes() < alignment.getWidth()-1))
- {
- item = item.substring(0, selection.getEndRes() + 1);
- }
-
- ///Shall we ignore gaps???? - JBPNote: Add Flag for forcing this or not
- StringBuffer noGapsSB = new StringBuffer();
- int insertCount = 0;
- Vector spaces = new Vector();
-
- for (int j = 0; j < item.length(); j++)
- {
- if (!jalview.util.Comparison.isGap(item.charAt(j)))
- {
- noGapsSB.append(item.charAt(j));
- spaces.add(new Integer(insertCount));
- }
- else
- {
- insertCount++;
- }
- }
-
- String noGaps = noGapsSB.toString();
-
- for (int r = resIndex; r < noGaps.length(); r++)
- {
-
- if (regex.searchFrom(noGaps, r))
- {
- resIndex = regex.matchedFrom();
-
- if ((selection != null) &&
- ((resIndex +
- Integer.parseInt(spaces.get(resIndex).toString())) < selection.getStartRes()))
- {
- continue;
- }
-
-
- int sres = seq.findPosition(resIndex +
- Integer.parseInt(spaces.elementAt(resIndex)
- .toString()));
- int eres = seq.findPosition(regex.matchedTo() - 1 +
- Integer.parseInt(spaces.elementAt(regex.matchedTo() -
- 1).toString()));
-
- searchResults.addResult(seq, sres, eres);
- hasResults=true;
- if (!findAll)
- {
- // thats enough, break and display the result
- found = true;
- resIndex++;
-
- break;
- }
-
- r = resIndex;
- }
- else
- {
- break;
- }
- }
-
- if (!found)
- {
- seqIndex++;
- resIndex = 0;
- }