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