1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.datamodel; |
22 |
|
|
23 |
|
import java.util.ArrayList; |
24 |
|
import java.util.BitSet; |
25 |
|
import java.util.Collections; |
26 |
|
import java.util.List; |
27 |
|
import java.util.regex.PatternSyntaxException; |
28 |
|
|
29 |
|
import jalview.viewmodel.annotationfilter.AnnotationFilterParameter; |
30 |
|
import jalview.viewmodel.annotationfilter.AnnotationFilterParameter.SearchableAnnotationField; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
|
|
| 43.6% |
Uncovered Elements: 164 (291) |
Complexity: 104 |
Complexity Density: 0.68 |
|
36 |
|
public class ColumnSelection |
37 |
|
{ |
38 |
|
|
39 |
|
|
40 |
|
|
|
|
| 49.5% |
Uncovered Elements: 54 (107) |
Complexity: 33 |
Complexity Density: 0.54 |
|
41 |
|
private class IntList |
42 |
|
{ |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
private List<Integer> order; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
private List<Integer> _uorder; |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
private BitSet selected; |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
61 |
338 |
IntList()... |
62 |
|
{ |
63 |
338 |
order = new ArrayList<>(); |
64 |
338 |
_uorder = Collections.unmodifiableList(order); |
65 |
338 |
selected = new BitSet(); |
66 |
|
} |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
@param |
72 |
|
|
|
|
| 88.9% |
Uncovered Elements: 1 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
73 |
19 |
IntList(IntList other)... |
74 |
|
{ |
75 |
19 |
this(); |
76 |
19 |
if (other != null) |
77 |
|
{ |
78 |
19 |
int j = other.size(); |
79 |
32 |
for (int i = 0; i < j; i++) |
80 |
|
{ |
81 |
13 |
add(other.elementAt(i)); |
82 |
|
} |
83 |
|
} |
84 |
|
} |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
@param |
90 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
91 |
344 |
void add(int i)... |
92 |
|
{ |
93 |
344 |
if (!selected.get(i)) |
94 |
|
{ |
95 |
305 |
order.add(Integer.valueOf(i)); |
96 |
305 |
selected.set(i); |
97 |
|
} |
98 |
|
} |
99 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
100 |
37 |
void clear()... |
101 |
|
{ |
102 |
37 |
order.clear(); |
103 |
37 |
selected.clear(); |
104 |
|
} |
105 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
106 |
14 |
void remove(int col)... |
107 |
|
{ |
108 |
|
|
109 |
14 |
Integer colInt = Integer.valueOf(col); |
110 |
|
|
111 |
14 |
if (selected.get(col)) |
112 |
|
{ |
113 |
|
|
114 |
|
|
115 |
|
|
116 |
3 |
order.remove(colInt); |
117 |
3 |
selected.clear(col); |
118 |
|
} |
119 |
|
} |
120 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
121 |
0 |
boolean contains(Integer colInt)... |
122 |
|
{ |
123 |
0 |
return selected.get(colInt); |
124 |
|
} |
125 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
126 |
87 |
boolean isEmpty()... |
127 |
|
{ |
128 |
87 |
return order.isEmpty(); |
129 |
|
} |
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
@return |
135 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
136 |
751 |
List<Integer> getList()... |
137 |
|
{ |
138 |
751 |
return _uorder; |
139 |
|
} |
140 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
141 |
21 |
int size()... |
142 |
|
{ |
143 |
21 |
return order.size(); |
144 |
|
} |
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
@param |
150 |
|
@return |
151 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
152 |
13 |
int elementAt(int i)... |
153 |
|
{ |
154 |
13 |
return order.get(i); |
155 |
|
} |
156 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 6 |
Complexity Density: 0.4 |
|
157 |
0 |
protected boolean pruneColumnList(final List<int[]> shifts)... |
158 |
|
{ |
159 |
0 |
int s = 0, t = shifts.size(); |
160 |
0 |
int[] sr = shifts.get(s++); |
161 |
0 |
boolean pruned = false; |
162 |
0 |
int i = 0, j = order.size(); |
163 |
0 |
while (i < j && s <= t) |
164 |
|
{ |
165 |
0 |
int c = order.get(i++).intValue(); |
166 |
0 |
if (sr[0] <= c) |
167 |
|
{ |
168 |
0 |
if (sr[1] + sr[0] >= c) |
169 |
|
{ |
170 |
0 |
order.remove(--i); |
171 |
0 |
selected.clear(c); |
172 |
0 |
j--; |
173 |
|
} |
174 |
|
else |
175 |
|
{ |
176 |
0 |
if (s < t) |
177 |
|
{ |
178 |
0 |
sr = shifts.get(s); |
179 |
|
} |
180 |
0 |
s++; |
181 |
|
} |
182 |
|
} |
183 |
|
} |
184 |
0 |
return pruned; |
185 |
|
} |
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
|
190 |
|
@param |
191 |
|
|
192 |
|
@param |
193 |
|
|
194 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
195 |
0 |
void compensateForEdits(int start, int change)... |
196 |
|
{ |
197 |
0 |
BitSet mask = new BitSet(); |
198 |
0 |
for (int i = 0; i < order.size(); i++) |
199 |
|
{ |
200 |
0 |
int temp = order.get(i); |
201 |
|
|
202 |
0 |
if (temp >= start) |
203 |
|
{ |
204 |
|
|
205 |
0 |
selected.clear(temp); |
206 |
0 |
mask.set(temp - change); |
207 |
0 |
order.set(i, Integer.valueOf(temp - change)); |
208 |
|
} |
209 |
|
} |
210 |
|
|
211 |
0 |
selected.or(mask); |
212 |
|
} |
213 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
214 |
39 |
boolean isSelected(int column)... |
215 |
|
{ |
216 |
39 |
return selected.get(column); |
217 |
|
} |
218 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
219 |
0 |
int getMaxColumn()... |
220 |
|
{ |
221 |
0 |
return selected.length() - 1; |
222 |
|
} |
223 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
224 |
0 |
int getMinColumn()... |
225 |
|
{ |
226 |
0 |
return selected.get(0) ? 0 : selected.nextSetBit(0); |
227 |
|
} |
228 |
|
|
229 |
|
|
230 |
|
@return |
231 |
|
|
|
|
| 84.6% |
Uncovered Elements: 2 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
232 |
5 |
List<int[]> getRanges()... |
233 |
|
{ |
234 |
5 |
List<int[]> rlist = new ArrayList<>(); |
235 |
5 |
if (selected.isEmpty()) |
236 |
|
{ |
237 |
0 |
return rlist; |
238 |
|
} |
239 |
5 |
int next = selected.nextSetBit(0), clear = -1; |
240 |
11 |
while (next != -1) |
241 |
|
{ |
242 |
6 |
clear = selected.nextClearBit(next); |
243 |
6 |
rlist.add(new int[] { next, clear - 1 }); |
244 |
6 |
next = selected.nextSetBit(clear); |
245 |
|
} |
246 |
5 |
return rlist; |
247 |
|
} |
248 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
249 |
26 |
@Override... |
250 |
|
public int hashCode() |
251 |
|
{ |
252 |
|
|
253 |
26 |
return selected.hashCode(); |
254 |
|
} |
255 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
256 |
0 |
@Override... |
257 |
|
public boolean equals(Object obj) |
258 |
|
{ |
259 |
0 |
if (obj instanceof IntList) |
260 |
|
{ |
261 |
0 |
return ((IntList) obj).selected.equals(selected); |
262 |
|
} |
263 |
0 |
return false; |
264 |
|
} |
265 |
|
} |
266 |
|
|
267 |
|
private IntList selection = new IntList(); |
268 |
|
|
269 |
|
|
270 |
|
|
271 |
|
|
272 |
|
@param |
273 |
|
|
274 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
275 |
331 |
public void addElement(int col)... |
276 |
|
{ |
277 |
331 |
selection.add(col); |
278 |
|
} |
279 |
|
|
280 |
|
|
281 |
|
|
282 |
|
|
283 |
|
@param |
284 |
|
|
285 |
|
@param |
286 |
|
|
287 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 1 |
|
288 |
0 |
public void addRangeOfElements(int[] rng, boolean baseOne)... |
289 |
|
{ |
290 |
0 |
int base = baseOne ? -1 : 0; |
291 |
0 |
for (int c = 0; c < rng.length; c += 2) |
292 |
|
{ |
293 |
0 |
for (int p = rng[c]; p <= rng[c + 1]; p++) |
294 |
|
{ |
295 |
0 |
selection.add(base + p); |
296 |
|
} |
297 |
|
} |
298 |
|
|
299 |
|
} |
300 |
|
|
301 |
|
|
302 |
|
|
303 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
304 |
33 |
public void clear()... |
305 |
|
{ |
306 |
33 |
selection.clear(); |
307 |
|
} |
308 |
|
|
309 |
|
|
310 |
|
|
311 |
|
|
312 |
|
@param |
313 |
|
|
314 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
315 |
14 |
public void removeElement(int col)... |
316 |
|
{ |
317 |
14 |
selection.remove(col); |
318 |
|
} |
319 |
|
|
320 |
|
|
321 |
|
|
322 |
|
|
323 |
|
@param |
324 |
|
|
325 |
|
@param |
326 |
|
|
327 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
328 |
0 |
public void removeElements(int start, int end)... |
329 |
|
{ |
330 |
0 |
Integer colInt; |
331 |
0 |
for (int i = start; i < end; i++) |
332 |
|
{ |
333 |
0 |
colInt = Integer.valueOf(i); |
334 |
0 |
if (selection.contains(colInt)) |
335 |
|
{ |
336 |
0 |
selection.remove(colInt); |
337 |
|
} |
338 |
|
} |
339 |
|
} |
340 |
|
|
341 |
|
|
342 |
|
|
343 |
|
|
344 |
|
|
345 |
|
|
346 |
|
|
347 |
|
|
348 |
|
|
349 |
|
|
350 |
|
|
351 |
|
|
352 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
353 |
751 |
public List<Integer> getSelected()... |
354 |
|
{ |
355 |
751 |
return selection.getList(); |
356 |
|
} |
357 |
|
|
358 |
|
|
359 |
|
@return |
360 |
|
|
361 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
362 |
1 |
public List<int[]> getSelectedRanges()... |
363 |
|
{ |
364 |
1 |
return selection.getRanges(); |
365 |
|
} |
366 |
|
|
367 |
|
|
368 |
|
|
369 |
|
@param |
370 |
|
|
371 |
|
|
372 |
|
@return |
373 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
374 |
40 |
public boolean contains(int col)... |
375 |
|
{ |
376 |
40 |
return (col > -1) ? selection.isSelected(col) : false; |
377 |
|
} |
378 |
|
|
379 |
|
|
380 |
|
|
381 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
382 |
0 |
public boolean intersects(int from, int to)... |
383 |
|
{ |
384 |
|
|
385 |
0 |
for (int f = from; f <= to; f++) |
386 |
|
{ |
387 |
0 |
if (selection.isSelected(f)) |
388 |
|
{ |
389 |
0 |
return true; |
390 |
|
} |
391 |
|
} |
392 |
0 |
return false; |
393 |
|
} |
394 |
|
|
395 |
|
|
396 |
|
|
397 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
398 |
87 |
public boolean isEmpty()... |
399 |
|
{ |
400 |
87 |
return selection == null || selection.isEmpty(); |
401 |
|
} |
402 |
|
|
403 |
|
|
404 |
|
|
405 |
|
|
406 |
|
@return |
407 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
408 |
0 |
public int getMax()... |
409 |
|
{ |
410 |
0 |
if (selection.isEmpty()) |
411 |
|
{ |
412 |
0 |
return -1; |
413 |
|
} |
414 |
0 |
return selection.getMaxColumn(); |
415 |
|
} |
416 |
|
|
417 |
|
|
418 |
|
|
419 |
|
|
420 |
|
@return |
421 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
422 |
0 |
public int getMin()... |
423 |
|
{ |
424 |
0 |
if (selection.isEmpty()) |
425 |
|
{ |
426 |
0 |
return 1000000000; |
427 |
|
} |
428 |
0 |
return selection.getMinColumn(); |
429 |
|
} |
430 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
431 |
4 |
public void hideSelectedColumns(AlignmentI al)... |
432 |
|
{ |
433 |
4 |
synchronized (selection) |
434 |
|
{ |
435 |
4 |
for (int[] selregions : selection.getRanges()) |
436 |
|
{ |
437 |
5 |
al.getHiddenColumns().hideColumns(selregions[0], selregions[1]); |
438 |
|
} |
439 |
4 |
selection.clear(); |
440 |
|
} |
441 |
|
|
442 |
|
} |
443 |
|
|
444 |
|
|
445 |
|
|
446 |
|
|
447 |
|
@param |
448 |
|
|
449 |
|
|
|
|
| 73.7% |
Uncovered Elements: 5 (19) |
Complexity: 4 |
Complexity Density: 0.31 |
|
450 |
11 |
public void hideSelectedColumns(int col, HiddenColumns hidden)... |
451 |
|
{ |
452 |
|
|
453 |
|
|
454 |
|
|
455 |
11 |
removeElement(col); |
456 |
|
|
457 |
|
|
458 |
|
|
459 |
|
|
460 |
11 |
int min = col - 1, max = col + 1; |
461 |
14 |
while (contains(min)) |
462 |
|
{ |
463 |
3 |
removeElement(min); |
464 |
3 |
min--; |
465 |
|
} |
466 |
|
|
467 |
11 |
while (contains(max)) |
468 |
|
{ |
469 |
0 |
removeElement(max); |
470 |
0 |
max++; |
471 |
|
} |
472 |
|
|
473 |
|
|
474 |
|
|
475 |
|
|
476 |
11 |
min++; |
477 |
11 |
max--; |
478 |
11 |
if (min > max) |
479 |
|
{ |
480 |
0 |
min = max; |
481 |
|
} |
482 |
|
|
483 |
11 |
hidden.hideColumns(min, max); |
484 |
|
} |
485 |
|
|
486 |
|
|
487 |
|
|
488 |
|
|
489 |
|
@param |
490 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
491 |
19 |
public ColumnSelection(ColumnSelection copy)... |
492 |
|
{ |
493 |
19 |
if (copy != null) |
494 |
|
{ |
495 |
19 |
selection = new IntList(copy.selection); |
496 |
|
} |
497 |
|
} |
498 |
|
|
499 |
|
|
500 |
|
|
501 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
502 |
300 |
public ColumnSelection()... |
503 |
|
{ |
504 |
|
} |
505 |
|
|
506 |
|
|
507 |
|
|
508 |
|
|
509 |
|
|
510 |
|
@param |
511 |
|
@param |
512 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 5 |
Complexity Density: 0.83 |
|
513 |
0 |
public void invertColumnSelection(int first, int width, AlignmentI al)... |
514 |
|
{ |
515 |
0 |
boolean hasHidden = al.getHiddenColumns().hasHiddenColumns(); |
516 |
0 |
for (int i = first; i < width; i++) |
517 |
|
{ |
518 |
0 |
if (contains(i)) |
519 |
|
{ |
520 |
0 |
removeElement(i); |
521 |
|
} |
522 |
|
else |
523 |
|
{ |
524 |
0 |
if (!hasHidden || al.getHiddenColumns().isVisible(i)) |
525 |
|
{ |
526 |
0 |
addElement(i); |
527 |
|
} |
528 |
|
} |
529 |
|
} |
530 |
|
} |
531 |
|
|
532 |
|
|
533 |
|
|
534 |
|
|
535 |
|
|
536 |
|
@param |
537 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 6 |
Complexity Density: 0.75 |
|
538 |
0 |
public void setElementsFrom(ColumnSelection colsel,... |
539 |
|
HiddenColumns hiddenColumns) |
540 |
|
{ |
541 |
0 |
selection = new IntList(); |
542 |
0 |
if (colsel.selection != null && colsel.selection.size() > 0) |
543 |
|
{ |
544 |
0 |
if (hiddenColumns.hasHiddenColumns()) |
545 |
|
{ |
546 |
|
|
547 |
0 |
for (Integer col : colsel.getSelected()) |
548 |
|
{ |
549 |
0 |
if (hiddenColumns != null |
550 |
|
&& hiddenColumns.isVisible(col.intValue())) |
551 |
|
{ |
552 |
0 |
selection.add(col); |
553 |
|
} |
554 |
|
} |
555 |
|
} |
556 |
|
else |
557 |
|
{ |
558 |
|
|
559 |
0 |
for (Integer col : colsel.getSelected()) |
560 |
|
{ |
561 |
0 |
addElement(col); |
562 |
|
} |
563 |
|
} |
564 |
|
} |
565 |
|
} |
566 |
|
|
567 |
|
|
568 |
|
|
569 |
|
@return |
570 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
571 |
2 |
public boolean hasSelectedColumns()... |
572 |
|
{ |
573 |
2 |
return (selection != null && selection.size() > 0); |
574 |
|
} |
575 |
|
|
576 |
|
|
577 |
|
|
578 |
|
|
579 |
|
|
580 |
|
|
581 |
|
@param |
582 |
|
@param |
583 |
|
@return |
584 |
|
|
|
|
| 33.7% |
Uncovered Elements: 61 (92) |
Complexity: 35 |
Complexity Density: 0.7 |
|
585 |
1 |
public int filterAnnotations(AlignmentAnnotation ann_row,... |
586 |
|
AnnotationFilterParameter filterParams) |
587 |
|
{ |
588 |
1 |
Annotation[] annotations = ann_row.annotations; |
589 |
|
|
590 |
|
|
591 |
1 |
this.clear(); |
592 |
|
|
593 |
1 |
if (ann_row.graph == AlignmentAnnotation.CONTACT_MAP && (filterParams |
594 |
|
.getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD |
595 |
|
|| filterParams |
596 |
|
.getThresholdType() == AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD)) |
597 |
|
{ |
598 |
0 |
float tVal = filterParams.getThresholdValue(); |
599 |
0 |
if (ann_row.sequenceRef != null) |
600 |
|
{ |
601 |
|
|
602 |
0 |
for (int column = 0; column < annotations.length; column++) |
603 |
|
{ |
604 |
0 |
if (ann_row.annotations[column] == null) |
605 |
|
{ |
606 |
0 |
continue; |
607 |
|
} |
608 |
|
|
609 |
0 |
int cpos = ann_row.sequenceRef.findPosition(column) - 1; |
610 |
0 |
ContactListI clist = ann_row.sequenceRef |
611 |
|
.getContactListFor(ann_row, cpos); |
612 |
0 |
for (int row = column + 8, rowEnd = clist |
613 |
0 |
.getContactHeight(); row < rowEnd; row++) |
614 |
|
{ |
615 |
0 |
if (filterParams |
616 |
|
.getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD |
617 |
|
? (clist.getContactAt(row) > tVal) |
618 |
|
: (clist.getContactAt(row) < tVal)) |
619 |
|
{ |
620 |
0 |
addElement(column); |
621 |
0 |
break; |
622 |
|
|
623 |
|
|
624 |
|
} |
625 |
|
} |
626 |
|
} |
627 |
|
} |
628 |
0 |
return selection.size(); |
629 |
|
} |
630 |
|
|
631 |
1 |
int addedCount = 0; |
632 |
1 |
int column = 0; |
633 |
1 |
do |
634 |
|
{ |
635 |
13 |
Annotation ann = annotations[column]; |
636 |
13 |
if (ann != null) |
637 |
|
{ |
638 |
13 |
float value = ann.value; |
639 |
13 |
boolean matched = false; |
640 |
|
|
641 |
|
|
642 |
|
|
643 |
|
|
644 |
|
|
645 |
13 |
if (filterParams |
646 |
|
.getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD |
647 |
|
&& value > filterParams.getThresholdValue()) |
648 |
|
{ |
649 |
0 |
matched = true; |
650 |
|
} |
651 |
|
|
652 |
13 |
if (!matched && filterParams |
653 |
|
.getThresholdType() == AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD |
654 |
|
&& value < filterParams.getThresholdValue()) |
655 |
|
{ |
656 |
0 |
matched = true; |
657 |
|
} |
658 |
|
|
659 |
13 |
if (!matched && filterParams.isFilterAlphaHelix() |
660 |
|
&& ann.secondaryStructure == 'H') |
661 |
|
{ |
662 |
0 |
matched = true; |
663 |
|
} |
664 |
|
|
665 |
13 |
if (!matched && filterParams.isFilterBetaSheet() |
666 |
|
&& ann.secondaryStructure == 'E') |
667 |
|
{ |
668 |
0 |
matched = true; |
669 |
|
} |
670 |
|
|
671 |
13 |
if (!matched && filterParams.isFilterTurn() |
672 |
|
&& ann.secondaryStructure == 'S') |
673 |
|
{ |
674 |
0 |
matched = true; |
675 |
|
} |
676 |
|
|
677 |
13 |
String regexSearchString = filterParams.getRegexString(); |
678 |
13 |
if (!matched && regexSearchString != null) |
679 |
|
{ |
680 |
0 |
List<SearchableAnnotationField> fields = filterParams |
681 |
|
.getRegexSearchFields(); |
682 |
0 |
for (SearchableAnnotationField field : fields) |
683 |
|
{ |
684 |
0 |
String compareTo = field == SearchableAnnotationField.DISPLAY_STRING |
685 |
|
? ann.displayCharacter |
686 |
|
: ann.description; |
687 |
0 |
if (compareTo != null) |
688 |
|
{ |
689 |
0 |
try |
690 |
|
{ |
691 |
0 |
if (compareTo.matches(regexSearchString)) |
692 |
|
{ |
693 |
0 |
matched = true; |
694 |
|
} |
695 |
|
} catch (PatternSyntaxException pse) |
696 |
|
{ |
697 |
0 |
if (compareTo.equals(regexSearchString)) |
698 |
|
{ |
699 |
0 |
matched = true; |
700 |
|
} |
701 |
|
} |
702 |
0 |
if (matched) |
703 |
|
{ |
704 |
0 |
break; |
705 |
|
} |
706 |
|
} |
707 |
|
} |
708 |
|
} |
709 |
|
|
710 |
13 |
if (matched) |
711 |
|
{ |
712 |
0 |
this.addElement(column); |
713 |
0 |
addedCount++; |
714 |
|
} |
715 |
|
} |
716 |
13 |
column++; |
717 |
13 |
} while (column < annotations.length); |
718 |
|
|
719 |
1 |
return addedCount; |
720 |
|
} |
721 |
|
|
722 |
|
|
723 |
|
|
724 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
725 |
26 |
@Override... |
726 |
|
public int hashCode() |
727 |
|
{ |
728 |
26 |
return selection.hashCode(); |
729 |
|
} |
730 |
|
|
731 |
|
|
732 |
|
|
733 |
|
|
734 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 5 |
Complexity Density: 0.56 |
|
735 |
0 |
@Override... |
736 |
|
public boolean equals(Object obj) |
737 |
|
{ |
738 |
0 |
if (!(obj instanceof ColumnSelection)) |
739 |
|
{ |
740 |
0 |
return false; |
741 |
|
} |
742 |
0 |
ColumnSelection that = (ColumnSelection) obj; |
743 |
|
|
744 |
|
|
745 |
|
|
746 |
|
|
747 |
0 |
if (this.selection == null) |
748 |
|
{ |
749 |
0 |
if (that.selection != null) |
750 |
|
{ |
751 |
0 |
return false; |
752 |
|
} |
753 |
|
} |
754 |
0 |
if (!this.selection.equals(that.selection)) |
755 |
|
{ |
756 |
0 |
return false; |
757 |
|
} |
758 |
|
|
759 |
0 |
return true; |
760 |
|
} |
761 |
|
|
762 |
|
|
763 |
|
|
764 |
|
|
765 |
|
|
766 |
|
@param |
767 |
|
|
768 |
|
@param |
769 |
|
|
770 |
|
@param |
771 |
|
|
772 |
|
@param |
773 |
|
|
774 |
|
@param |
775 |
|
|
776 |
|
@param |
777 |
|
|
778 |
|
|
779 |
|
@return |
780 |
|
|
|
|
| 86.5% |
Uncovered Elements: 5 (37) |
Complexity: 14 |
Complexity Density: 0.61 |
|
781 |
8 |
public boolean markColumns(BitSet markedColumns, int startCol, int endCol,... |
782 |
|
boolean invert, boolean extendCurrent, boolean toggle) |
783 |
|
{ |
784 |
8 |
boolean changed = false; |
785 |
8 |
if (!extendCurrent && !toggle) |
786 |
|
{ |
787 |
8 |
changed = !this.isEmpty(); |
788 |
8 |
clear(); |
789 |
|
} |
790 |
8 |
if (invert) |
791 |
|
{ |
792 |
|
|
793 |
4 |
int i = markedColumns.nextClearBit(startCol); |
794 |
4 |
int ibs = markedColumns.nextSetBit(startCol); |
795 |
26 |
while (i >= startCol && i <= endCol) |
796 |
|
{ |
797 |
22 |
if (ibs < 0 || i < ibs) |
798 |
|
{ |
799 |
19 |
changed = true; |
800 |
19 |
if (toggle && contains(i)) |
801 |
|
{ |
802 |
0 |
removeElement(i++); |
803 |
|
} |
804 |
|
else |
805 |
|
{ |
806 |
19 |
addElement(i++); |
807 |
|
} |
808 |
|
} |
809 |
|
else |
810 |
|
{ |
811 |
3 |
i = markedColumns.nextClearBit(ibs); |
812 |
3 |
ibs = markedColumns.nextSetBit(i); |
813 |
|
} |
814 |
|
} |
815 |
|
} |
816 |
|
else |
817 |
|
{ |
818 |
4 |
int i = markedColumns.nextSetBit(startCol); |
819 |
60 |
while (i >= startCol && i <= endCol) |
820 |
|
{ |
821 |
56 |
changed = true; |
822 |
56 |
if (toggle && contains(i)) |
823 |
|
{ |
824 |
0 |
removeElement(i); |
825 |
|
} |
826 |
|
else |
827 |
|
{ |
828 |
56 |
addElement(i); |
829 |
|
} |
830 |
56 |
i = markedColumns.nextSetBit(i + 1); |
831 |
|
} |
832 |
|
} |
833 |
8 |
return changed; |
834 |
|
} |
835 |
|
|
836 |
|
|
837 |
|
|
838 |
|
|
839 |
|
|
840 |
|
|
841 |
|
|
842 |
|
@param |
843 |
|
|
844 |
|
@param |
845 |
|
|
846 |
|
@param |
847 |
|
|
848 |
|
@param |
849 |
|
|
850 |
|
|
|
|
| 80% |
Uncovered Elements: 4 (20) |
Complexity: 7 |
Complexity Density: 0.7 |
|
851 |
6 |
public void stretchGroup(int res, SequenceGroup sg, int min, int max)... |
852 |
|
{ |
853 |
6 |
if (!contains(res)) |
854 |
|
{ |
855 |
2 |
addElement(res); |
856 |
|
} |
857 |
|
|
858 |
6 |
if (res > sg.getStartRes()) |
859 |
|
{ |
860 |
|
|
861 |
2 |
sg.setEndRes(res); |
862 |
|
} |
863 |
6 |
if (res < sg.getStartRes()) |
864 |
|
{ |
865 |
|
|
866 |
0 |
sg.setStartRes(res); |
867 |
|
} |
868 |
|
|
869 |
|
|
870 |
|
|
871 |
|
|
872 |
|
|
873 |
19 |
for (int col = min; col <= max; col++) |
874 |
|
{ |
875 |
13 |
if (col < sg.getStartRes() || col > sg.getEndRes()) |
876 |
|
{ |
877 |
|
|
878 |
0 |
removeElement(col); |
879 |
|
} |
880 |
|
else |
881 |
|
{ |
882 |
|
|
883 |
13 |
addElement(col); |
884 |
|
} |
885 |
|
} |
886 |
|
} |
887 |
|
} |