1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.analysis; |
22 |
|
|
23 |
|
import java.util.ArrayList; |
24 |
|
import java.util.Arrays; |
25 |
|
import java.util.Iterator; |
26 |
|
import java.util.List; |
27 |
|
import java.util.Locale; |
28 |
|
|
29 |
|
import com.stevesoft.pat.Regex; |
30 |
|
|
31 |
|
import jalview.api.AlignViewportI; |
32 |
|
import jalview.api.FeatureRenderer; |
33 |
|
import jalview.api.FinderI; |
34 |
|
import jalview.datamodel.AlignmentI; |
35 |
|
import jalview.datamodel.SearchResultMatchI; |
36 |
|
import jalview.datamodel.SearchResults; |
37 |
|
import jalview.datamodel.SearchResultsI; |
38 |
|
import jalview.datamodel.SequenceFeature; |
39 |
|
import jalview.datamodel.SequenceGroup; |
40 |
|
import jalview.datamodel.SequenceI; |
41 |
|
import jalview.datamodel.features.SequenceFeaturesI; |
42 |
|
import jalview.util.Comparison; |
43 |
|
import jalview.util.MapList; |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
|
|
| 0% |
Uncovered Elements: 275 (275) |
Complexity: 73 |
Complexity Density: 0.41 |
|
48 |
|
public class Finder implements FinderI |
49 |
|
{ |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
private SearchResultsI searchResults; |
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
private List<SequenceI> idMatches; |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
private AlignViewportI viewport; |
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
FeatureRenderer frm = null; |
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
private int sequenceIndex; |
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
private int residueIndex; |
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
private SequenceFeature lastFeature; |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
private int lastFeatureSequenceIndex; |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
private int searchedSequenceStartPosition; |
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
private MapList searchedSequenceMap; |
102 |
|
|
103 |
|
private String seqToSearch; |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
@param |
109 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
110 |
0 |
public Finder(AlignViewportI av)... |
111 |
|
{ |
112 |
0 |
this.viewport = av; |
113 |
0 |
this.sequenceIndex = 0; |
114 |
0 |
this.residueIndex = -1; |
115 |
|
} |
116 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
117 |
0 |
@Override... |
118 |
|
public void findAll(String theSearchString, boolean matchCase, |
119 |
|
boolean searchDescription, boolean searchFeatureDesc, |
120 |
|
boolean ignoreHidden) |
121 |
|
{ |
122 |
|
|
123 |
|
|
124 |
|
|
125 |
0 |
lastFeature = null; |
126 |
0 |
lastFeatureSequenceIndex = 0; |
127 |
0 |
sequenceIndex = 0; |
128 |
0 |
residueIndex = -1; |
129 |
|
|
130 |
0 |
doFind(theSearchString, matchCase, searchDescription, searchFeatureDesc, |
131 |
|
true, ignoreHidden); |
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
0 |
sequenceIndex = 0; |
137 |
0 |
residueIndex = -1; |
138 |
0 |
lastFeature = null; |
139 |
0 |
lastFeatureSequenceIndex = 0; |
140 |
|
} |
141 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
142 |
0 |
@Override... |
143 |
|
public void findNext(String theSearchString, boolean matchCase, |
144 |
|
boolean searchDescription, boolean searchFeatureDesc, |
145 |
|
boolean ignoreHidden) |
146 |
|
{ |
147 |
0 |
doFind(theSearchString, matchCase, searchDescription, searchFeatureDesc, |
148 |
|
false, ignoreHidden); |
149 |
|
|
150 |
0 |
if (searchResults.isEmpty() && idMatches.isEmpty()) |
151 |
|
{ |
152 |
|
|
153 |
|
|
154 |
|
|
155 |
0 |
sequenceIndex = 0; |
156 |
0 |
residueIndex = -1; |
157 |
0 |
lastFeature = null; |
158 |
0 |
lastFeatureSequenceIndex = 0; |
159 |
|
} |
160 |
|
} |
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
@param |
166 |
|
@param |
167 |
|
@param |
168 |
|
@param |
169 |
|
@param |
170 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 7 |
Complexity Density: 0.5 |
|
171 |
0 |
protected void doFind(String theSearchString, boolean matchCase,... |
172 |
|
boolean searchDescription, boolean searchFeatureDesc, |
173 |
|
boolean findAll, boolean ignoreHidden) |
174 |
|
{ |
175 |
0 |
searchResults = new SearchResults(); |
176 |
0 |
idMatches = new ArrayList<>(); |
177 |
|
|
178 |
0 |
String searchString = matchCase ? theSearchString |
179 |
|
: theSearchString.toUpperCase(Locale.ROOT); |
180 |
0 |
Regex searchPattern = new Regex(searchString); |
181 |
0 |
searchPattern.setIgnoreCase(!matchCase); |
182 |
|
|
183 |
0 |
SequenceGroup selection = viewport.getSelectionGroup(); |
184 |
0 |
if (selection != null && selection.getSize() < 1) |
185 |
|
{ |
186 |
0 |
selection = null; |
187 |
|
} |
188 |
|
|
189 |
0 |
AlignmentI alignment = viewport.getAlignment(); |
190 |
0 |
int end = alignment.getHeight(); |
191 |
|
|
192 |
0 |
getSequence(ignoreHidden); |
193 |
|
|
194 |
0 |
boolean found = false; |
195 |
0 |
while ((!found || findAll) && sequenceIndex < end) |
196 |
|
{ |
197 |
0 |
found = findNextMatch(searchString, searchPattern, searchDescription, |
198 |
|
searchFeatureDesc, ignoreHidden); |
199 |
|
} |
200 |
|
} |
201 |
|
|
202 |
|
|
203 |
|
|
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
|
209 |
|
|
210 |
|
|
211 |
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
223 |
|
|
224 |
|
@param |
225 |
|
@return |
226 |
|
|
|
|
| 0% |
Uncovered Elements: 35 (35) |
Complexity: 7 |
Complexity Density: 0.28 |
|
227 |
0 |
private boolean getSequence(boolean ignoreHidden)... |
228 |
|
{ |
229 |
0 |
AlignmentI alignment = viewport.getAlignment(); |
230 |
0 |
if (sequenceIndex >= alignment.getHeight()) |
231 |
|
{ |
232 |
0 |
seqToSearch = ""; |
233 |
0 |
return false; |
234 |
|
} |
235 |
0 |
SequenceI seq = alignment.getSequenceAt(sequenceIndex); |
236 |
0 |
SequenceGroup selection = viewport.getSelectionGroup(); |
237 |
0 |
if (selection != null && !selection.contains(seq)) |
238 |
|
{ |
239 |
0 |
if (!nextSequence(ignoreHidden)) |
240 |
|
{ |
241 |
0 |
return false; |
242 |
|
} |
243 |
0 |
seq = alignment.getSequenceAt(sequenceIndex); |
244 |
|
} |
245 |
|
|
246 |
0 |
String seqString = null; |
247 |
0 |
if (ignoreHidden) |
248 |
|
{ |
249 |
0 |
seqString = getVisibleSequence(seq); |
250 |
0 |
this.searchedSequenceStartPosition = 1; |
251 |
|
} |
252 |
|
else |
253 |
|
{ |
254 |
0 |
int startCol = 0; |
255 |
0 |
int endCol = seq.getLength() - 1; |
256 |
0 |
this.searchedSequenceStartPosition = seq.getStart(); |
257 |
0 |
if (selection != null) |
258 |
|
{ |
259 |
0 |
startCol = selection.getStartRes(); |
260 |
0 |
endCol = Math.min(endCol, selection.getEndRes()); |
261 |
0 |
this.searchedSequenceStartPosition = seq.findPosition(startCol); |
262 |
|
} |
263 |
0 |
seqString = seq.getSequenceAsString(startCol, endCol + 1); |
264 |
|
} |
265 |
|
|
266 |
|
|
267 |
|
|
268 |
|
|
269 |
|
|
270 |
0 |
String ungapped = AlignSeq.extractGaps(Comparison.GapChars, seqString); |
271 |
0 |
this.seqToSearch = ungapped; |
272 |
|
|
273 |
0 |
return true; |
274 |
|
} |
275 |
|
|
276 |
|
|
277 |
|
|
278 |
|
|
279 |
|
|
280 |
|
|
281 |
|
|
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
|
286 |
|
@param |
287 |
|
@return |
288 |
|
|
|
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 5 |
Complexity Density: 0.24 |
|
289 |
0 |
private String getVisibleSequence(SequenceI seq)... |
290 |
|
{ |
291 |
|
|
292 |
|
|
293 |
|
|
294 |
|
|
295 |
0 |
int seqStartCol = seq.findIndex(seq.getStart()) - 1; |
296 |
0 |
int seqEndCol = seq.findIndex(seq.getStart() + seq.getLength() - 1) - 1; |
297 |
0 |
Iterator<int[]> visibleColumns = viewport.getViewAsVisibleContigs(true); |
298 |
0 |
StringBuilder visibleSeq = new StringBuilder(seqEndCol - seqStartCol); |
299 |
0 |
List<int[]> fromRanges = new ArrayList<>(); |
300 |
|
|
301 |
0 |
while (visibleColumns.hasNext()) |
302 |
|
{ |
303 |
0 |
int[] range = visibleColumns.next(); |
304 |
0 |
if (range[0] > seqEndCol) |
305 |
|
{ |
306 |
|
|
307 |
0 |
break; |
308 |
|
} |
309 |
0 |
if (range[1] < seqStartCol) |
310 |
|
{ |
311 |
|
|
312 |
0 |
continue; |
313 |
|
} |
314 |
0 |
String subseq = seq.getSequenceAsString(range[0], range[1] + 1); |
315 |
0 |
String ungapped = AlignSeq.extractGaps(Comparison.GapChars, subseq); |
316 |
0 |
visibleSeq.append(ungapped); |
317 |
0 |
if (!ungapped.isEmpty()) |
318 |
|
{ |
319 |
|
|
320 |
|
|
321 |
|
|
322 |
|
|
323 |
0 |
int seqResFrom = seq.findPosition(range[0]); |
324 |
0 |
int seqResTo = seqResFrom + ungapped.length() - 1; |
325 |
0 |
fromRanges.add(new int[] { seqResFrom, seqResTo }); |
326 |
|
} |
327 |
|
} |
328 |
|
|
329 |
|
|
330 |
|
|
331 |
|
|
332 |
|
|
333 |
|
|
334 |
0 |
List<int[]> toRange = Arrays |
335 |
|
.asList(new int[] |
336 |
|
{ 1, visibleSeq.length() }); |
337 |
0 |
searchedSequenceMap = new MapList(fromRanges, toRange, 1, 1); |
338 |
|
|
339 |
0 |
return visibleSeq.toString(); |
340 |
|
} |
341 |
|
|
342 |
|
|
343 |
|
|
344 |
|
|
345 |
|
|
346 |
|
|
347 |
|
|
348 |
|
|
349 |
|
|
350 |
|
|
351 |
|
@param |
352 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
353 |
0 |
private boolean nextSequence(boolean ignoreHidden)... |
354 |
|
{ |
355 |
0 |
sequenceIndex++; |
356 |
0 |
residueIndex = -1; |
357 |
|
|
358 |
0 |
return getSequence(ignoreHidden); |
359 |
|
} |
360 |
|
|
361 |
|
|
362 |
|
|
363 |
|
|
364 |
|
|
365 |
|
|
366 |
|
|
367 |
|
|
368 |
|
|
369 |
|
|
370 |
|
|
371 |
|
@param |
372 |
|
@param |
373 |
|
@param |
374 |
|
@param |
375 |
|
@param |
376 |
|
@return |
377 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 8 |
Complexity Density: 0.47 |
|
378 |
0 |
protected boolean findNextMatch(String searchString, Regex searchPattern,... |
379 |
|
boolean matchDescription, boolean matchFeatureDesc, |
380 |
|
boolean ignoreHidden) |
381 |
|
{ |
382 |
0 |
if (residueIndex < 0) |
383 |
|
{ |
384 |
|
|
385 |
|
|
386 |
|
|
387 |
|
|
388 |
0 |
if (doNonMotifSearches(searchString, searchPattern, matchDescription)) |
389 |
|
{ |
390 |
0 |
return true; |
391 |
|
} |
392 |
|
} |
393 |
|
|
394 |
|
|
395 |
|
|
396 |
|
|
397 |
0 |
int end = seqToSearch.length(); |
398 |
0 |
while (residueIndex < end) |
399 |
|
{ |
400 |
0 |
boolean matched = searchPattern.searchFrom(seqToSearch, residueIndex); |
401 |
0 |
if (matched) |
402 |
|
{ |
403 |
0 |
if (recordMatch(searchPattern, ignoreHidden)) |
404 |
|
{ |
405 |
0 |
return true; |
406 |
|
} |
407 |
|
} |
408 |
|
else |
409 |
|
{ |
410 |
0 |
if (matchFeatureDesc) |
411 |
|
{ |
412 |
0 |
matched = searchSequenceFeatures(residueIndex, searchPattern); |
413 |
0 |
if (matched) |
414 |
|
{ |
415 |
0 |
return true; |
416 |
|
} |
417 |
0 |
lastFeature = null; |
418 |
|
} |
419 |
0 |
residueIndex = Integer.MAX_VALUE; |
420 |
|
} |
421 |
|
} |
422 |
|
|
423 |
0 |
nextSequence(ignoreHidden); |
424 |
0 |
return false; |
425 |
|
} |
426 |
|
|
427 |
|
|
428 |
|
|
429 |
|
|
430 |
|
|
431 |
|
|
432 |
|
|
433 |
|
|
434 |
|
|
435 |
|
|
436 |
|
|
437 |
|
@param |
438 |
|
@param |
439 |
|
@return |
440 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 5 |
Complexity Density: 0.38 |
|
441 |
0 |
protected boolean recordMatch(Regex searchPattern, boolean ignoreHidden)... |
442 |
|
{ |
443 |
0 |
SequenceI seq = viewport.getAlignment().getSequenceAt(sequenceIndex); |
444 |
|
|
445 |
|
|
446 |
|
|
447 |
|
|
448 |
0 |
int offset = searchPattern.matchedFrom(); |
449 |
0 |
int matchStartPosition = this.searchedSequenceStartPosition + offset; |
450 |
0 |
int matchEndPosition = matchStartPosition + searchPattern.charsMatched() |
451 |
|
- 1; |
452 |
|
|
453 |
|
|
454 |
|
|
455 |
|
|
456 |
|
|
457 |
0 |
residueIndex = searchPattern.matchedFrom() + 1; |
458 |
|
|
459 |
|
|
460 |
|
|
461 |
|
|
462 |
0 |
if (allHidden(seq, matchStartPosition, matchEndPosition)) |
463 |
|
{ |
464 |
0 |
return false; |
465 |
|
} |
466 |
|
|
467 |
|
|
468 |
|
|
469 |
|
|
470 |
0 |
List<SearchResultMatchI> matches = searchResults.getResults(); |
471 |
0 |
SearchResultMatchI lastMatch = matches.isEmpty() ? null |
472 |
|
: matches.get(matches.size() - 1); |
473 |
|
|
474 |
0 |
if (lastMatch == null || !lastMatch.contains(seq, matchStartPosition, |
475 |
|
matchEndPosition)) |
476 |
|
{ |
477 |
0 |
addMatch(seq, matchStartPosition, matchEndPosition, ignoreHidden); |
478 |
0 |
return true; |
479 |
|
} |
480 |
|
|
481 |
0 |
return false; |
482 |
|
} |
483 |
|
|
484 |
|
|
485 |
|
|
486 |
|
|
487 |
|
|
488 |
|
|
489 |
|
@param |
490 |
|
@param |
491 |
|
@param |
492 |
|
@param |
493 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
494 |
0 |
private void addMatch(SequenceI seq, int matchStartPosition,... |
495 |
|
int matchEndPosition, boolean ignoreHidden) |
496 |
|
{ |
497 |
0 |
if (!ignoreHidden) |
498 |
|
{ |
499 |
|
|
500 |
|
|
501 |
|
|
502 |
0 |
searchResults.addResult(seq, matchStartPosition, matchEndPosition); |
503 |
0 |
return; |
504 |
|
} |
505 |
|
|
506 |
|
|
507 |
|
|
508 |
|
|
509 |
0 |
int[] truePositions = searchedSequenceMap |
510 |
|
.locateInFrom(matchStartPosition, matchEndPosition); |
511 |
0 |
searchResults.addResult(seq, truePositions); |
512 |
|
} |
513 |
|
|
514 |
|
|
515 |
|
|
516 |
|
|
517 |
|
@param |
518 |
|
@param |
519 |
|
@param |
520 |
|
@return |
521 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 4 |
Complexity Density: 0.67 |
|
522 |
0 |
private boolean allHidden(SequenceI seq, int fromPos, int toPos)... |
523 |
|
{ |
524 |
0 |
if (!viewport.hasHiddenColumns()) |
525 |
|
{ |
526 |
0 |
return false; |
527 |
|
} |
528 |
0 |
for (int res = fromPos; res <= toPos; res++) |
529 |
|
{ |
530 |
0 |
if (isVisible(seq, res)) |
531 |
|
{ |
532 |
0 |
return false; |
533 |
|
} |
534 |
|
} |
535 |
0 |
return true; |
536 |
|
} |
537 |
|
|
538 |
|
|
539 |
|
|
540 |
|
|
541 |
|
|
542 |
|
|
543 |
|
|
544 |
|
|
545 |
|
|
546 |
|
|
547 |
|
@param |
548 |
|
@param |
549 |
|
@param |
550 |
|
@return |
551 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 5 |
Complexity Density: 0.5 |
|
552 |
0 |
protected boolean doNonMotifSearches(String searchString,... |
553 |
|
Regex searchPattern, boolean includeDescription) |
554 |
|
{ |
555 |
0 |
SequenceI seq = viewport.getAlignment().getSequenceAt(sequenceIndex); |
556 |
|
|
557 |
|
|
558 |
|
|
559 |
|
|
560 |
0 |
residueIndex = 0; |
561 |
0 |
try |
562 |
|
{ |
563 |
0 |
int res = Integer.parseInt(searchString); |
564 |
0 |
return searchForResidueNumber(seq, res); |
565 |
|
} catch (NumberFormatException ex) |
566 |
|
{ |
567 |
|
|
568 |
|
} |
569 |
|
|
570 |
0 |
if (searchSequenceName(seq, searchPattern)) |
571 |
|
{ |
572 |
0 |
return true; |
573 |
|
} |
574 |
0 |
if (includeDescription && searchSequenceDescription(seq, searchPattern)) |
575 |
|
{ |
576 |
0 |
return true; |
577 |
|
} |
578 |
0 |
return false; |
579 |
|
} |
580 |
|
|
581 |
|
|
582 |
|
|
583 |
|
|
584 |
|
|
585 |
|
|
586 |
|
@param |
587 |
|
@param |
588 |
|
@return |
589 |
|
|
|
|
| 0% |
Uncovered Elements: 34 (34) |
Complexity: 8 |
Complexity Density: 0.33 |
|
590 |
0 |
protected boolean searchSequenceFeatures(int from, Regex searchPattern)... |
591 |
|
{ |
592 |
0 |
if (lastFeatureSequenceIndex != sequenceIndex) |
593 |
|
{ |
594 |
0 |
lastFeatureSequenceIndex = sequenceIndex; |
595 |
0 |
lastFeature = null; |
596 |
|
} |
597 |
0 |
SequenceI seq = viewport.getAlignment().getSequenceAt(sequenceIndex); |
598 |
0 |
SequenceFeaturesI sf = seq.getFeatures(); |
599 |
|
|
600 |
|
|
601 |
0 |
List<SequenceFeature> allFeatures = null; |
602 |
0 |
if (frm != null) |
603 |
|
{ |
604 |
0 |
allFeatures = frm.findFeaturesAtResidue(seq, seq.getStart(), |
605 |
|
seq.getEnd()); |
606 |
|
} |
607 |
|
else |
608 |
|
{ |
609 |
|
|
610 |
0 |
allFeatures = sf.getAllFeatures(); |
611 |
|
} |
612 |
|
|
613 |
0 |
long fpos = 0; |
614 |
|
|
615 |
0 |
for (SequenceFeature feature : allFeatures) |
616 |
|
{ |
617 |
0 |
fpos++; |
618 |
0 |
if (lastFeature != null) |
619 |
|
{ |
620 |
|
|
621 |
0 |
if (lastFeature != feature) |
622 |
|
{ |
623 |
0 |
continue; |
624 |
|
} |
625 |
|
else |
626 |
|
{ |
627 |
0 |
lastFeature = null; |
628 |
0 |
continue; |
629 |
|
} |
630 |
|
} |
631 |
|
|
632 |
0 |
if (searchPattern.search(feature.type) || (feature.description != null |
633 |
|
&& searchPattern.search(feature.description))) |
634 |
|
{ |
635 |
0 |
searchResults.addResult(seq, feature.getBegin(), feature.getEnd()); |
636 |
0 |
lastFeature = feature; |
637 |
0 |
return true; |
638 |
|
} |
639 |
|
} |
640 |
0 |
residueIndex = Integer.MAX_VALUE; |
641 |
0 |
lastFeature = null; |
642 |
0 |
return false; |
643 |
|
} |
644 |
|
|
645 |
|
|
646 |
|
|
647 |
|
|
648 |
|
|
649 |
|
|
650 |
|
@param |
651 |
|
@param |
652 |
|
@return |
653 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 4 |
Complexity Density: 0.8 |
|
654 |
0 |
protected boolean searchSequenceDescription(SequenceI seq,... |
655 |
|
Regex searchPattern) |
656 |
|
{ |
657 |
0 |
String desc = seq.getDescription(); |
658 |
0 |
if (desc != null && searchPattern.search(desc) |
659 |
|
&& !idMatches.contains(seq)) |
660 |
|
{ |
661 |
0 |
idMatches.add(seq); |
662 |
0 |
return true; |
663 |
|
} |
664 |
0 |
return false; |
665 |
|
} |
666 |
|
|
667 |
|
|
668 |
|
|
669 |
|
|
670 |
|
|
671 |
|
|
672 |
|
@param |
673 |
|
@param |
674 |
|
@return |
675 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
676 |
0 |
protected boolean searchSequenceName(SequenceI seq, Regex searchPattern)... |
677 |
|
{ |
678 |
0 |
if (searchPattern.search(seq.getName()) && !idMatches.contains(seq)) |
679 |
|
{ |
680 |
0 |
idMatches.add(seq); |
681 |
0 |
return true; |
682 |
|
} |
683 |
0 |
return false; |
684 |
|
} |
685 |
|
|
686 |
|
|
687 |
|
|
688 |
|
|
689 |
|
|
690 |
|
|
691 |
|
@param |
692 |
|
@param |
693 |
|
@return |
694 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 4 |
Complexity Density: 0.8 |
|
695 |
0 |
protected boolean searchForResidueNumber(SequenceI seq, int resNo)... |
696 |
|
{ |
697 |
0 |
if (seq.getStart() <= resNo && seq.getEnd() >= resNo) |
698 |
|
{ |
699 |
0 |
if (isVisible(seq, resNo)) |
700 |
|
{ |
701 |
0 |
searchResults.addResult(seq, resNo, resNo); |
702 |
0 |
return true; |
703 |
|
} |
704 |
|
} |
705 |
0 |
return false; |
706 |
|
} |
707 |
|
|
708 |
|
|
709 |
|
|
710 |
|
|
711 |
|
@param |
712 |
|
@param |
713 |
|
@return |
714 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
715 |
0 |
private boolean isVisible(SequenceI seq, int res)... |
716 |
|
{ |
717 |
0 |
if (!viewport.hasHiddenColumns()) |
718 |
|
{ |
719 |
0 |
return true; |
720 |
|
} |
721 |
0 |
int col = seq.findIndex(res); |
722 |
0 |
return viewport.getAlignment().getHiddenColumns().isVisible(col - 1); |
723 |
|
|
724 |
|
} |
725 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
726 |
0 |
@Override... |
727 |
|
public List<SequenceI> getIdMatches() |
728 |
|
{ |
729 |
0 |
return idMatches; |
730 |
|
} |
731 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
732 |
0 |
@Override... |
733 |
|
public SearchResultsI getSearchResults() |
734 |
|
{ |
735 |
0 |
return searchResults; |
736 |
|
} |
737 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
738 |
0 |
@Override... |
739 |
|
public void setFeatureRenderer(FeatureRenderer featureRenderer) |
740 |
|
{ |
741 |
0 |
frm = featureRenderer; |
742 |
|
} |
743 |
|
} |