1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.datamodel.features; |
22 |
|
|
23 |
|
import java.util.ArrayList; |
24 |
|
import java.util.Collections; |
25 |
|
import java.util.HashSet; |
26 |
|
import java.util.List; |
27 |
|
import java.util.Set; |
28 |
|
|
29 |
|
import intervalstore.api.IntervalStoreI; |
30 |
|
import intervalstore.impl.BinarySearcher; |
31 |
|
import intervalstore.impl.BinarySearcher.Compare; |
32 |
|
import intervalstore.impl.IntervalStore; |
33 |
|
import jalview.datamodel.SequenceFeature; |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
@author |
41 |
|
|
42 |
|
|
|
|
| 95.5% |
Uncovered Elements: 15 (331) |
Complexity: 97 |
Complexity Density: 0.52 |
|
43 |
|
public class FeatureStore |
44 |
|
{ |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
List<SequenceFeature> nonPositionalFeatures; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
List<SequenceFeature> contactFeatureStarts; |
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
List<SequenceFeature> contactFeatureEnds; |
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
IntervalStoreI<SequenceFeature> features; |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
Set<String> positionalFeatureGroups; |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
Set<String> nonPositionalFeatureGroups; |
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
int totalExtent; |
84 |
|
|
85 |
|
float positionalMinScore; |
86 |
|
|
87 |
|
float positionalMaxScore; |
88 |
|
|
89 |
|
float nonPositionalMinScore; |
90 |
|
|
91 |
|
float nonPositionalMaxScore; |
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
96 |
2580 |
public FeatureStore()... |
97 |
|
{ |
98 |
2580 |
features = new IntervalStore<>(); |
99 |
2580 |
positionalFeatureGroups = new HashSet<>(); |
100 |
2580 |
nonPositionalFeatureGroups = new HashSet<>(); |
101 |
2580 |
positionalMinScore = Float.NaN; |
102 |
2580 |
positionalMaxScore = Float.NaN; |
103 |
2580 |
nonPositionalMinScore = Float.NaN; |
104 |
2580 |
nonPositionalMaxScore = Float.NaN; |
105 |
|
|
106 |
|
|
107 |
|
} |
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
@param |
116 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (30) |
Complexity: 7 |
Complexity Density: 0.39 |
|
117 |
212199 |
public boolean addFeature(SequenceFeature feature)... |
118 |
|
{ |
119 |
212199 |
if (contains(feature)) |
120 |
|
{ |
121 |
78290 |
return false; |
122 |
|
} |
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
133909 |
if (!feature.isNonPositional()) |
128 |
|
{ |
129 |
133837 |
positionalFeatureGroups.add(feature.getFeatureGroup()); |
130 |
|
} |
131 |
|
|
132 |
133909 |
if (feature.isContactFeature()) |
133 |
|
{ |
134 |
45 |
addContactFeature(feature); |
135 |
|
} |
136 |
133864 |
else if (feature.isNonPositional()) |
137 |
|
{ |
138 |
72 |
addNonPositionalFeature(feature); |
139 |
|
} |
140 |
|
else |
141 |
|
{ |
142 |
133792 |
addNestedFeature(feature); |
143 |
|
} |
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
|
150 |
133909 |
totalExtent += getFeatureLength(feature); |
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
|
156 |
133909 |
float score = feature.getScore(); |
157 |
133909 |
if (!Float.isNaN(score)) |
158 |
|
{ |
159 |
133765 |
if (feature.isNonPositional()) |
160 |
|
{ |
161 |
49 |
nonPositionalMinScore = min(nonPositionalMinScore, score); |
162 |
49 |
nonPositionalMaxScore = max(nonPositionalMaxScore, score); |
163 |
|
} |
164 |
|
else |
165 |
|
{ |
166 |
133716 |
positionalMinScore = min(positionalMinScore, score); |
167 |
133716 |
positionalMaxScore = max(positionalMaxScore, score); |
168 |
|
} |
169 |
|
} |
170 |
|
|
171 |
133909 |
return true; |
172 |
|
} |
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
|
@param |
179 |
|
@return |
180 |
|
|
|
|
| 93.3% |
Uncovered Elements: 1 (15) |
Complexity: 6 |
Complexity Density: 1.2 |
|
181 |
212212 |
public boolean contains(SequenceFeature feature)... |
182 |
|
{ |
183 |
212212 |
if (feature.isNonPositional()) |
184 |
|
{ |
185 |
80 |
return nonPositionalFeatures == null ? false |
186 |
|
: nonPositionalFeatures.contains(feature); |
187 |
|
} |
188 |
|
|
189 |
212132 |
if (feature.isContactFeature()) |
190 |
|
{ |
191 |
49 |
return contactFeatureStarts == null ? false |
192 |
|
: listContains(contactFeatureStarts, feature); |
193 |
|
} |
194 |
|
|
195 |
212083 |
return features == null ? false : features.contains(feature); |
196 |
|
} |
197 |
|
|
198 |
|
|
199 |
|
|
200 |
|
|
201 |
|
|
202 |
|
@param |
203 |
|
@return |
204 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
205 |
136961 |
protected static int getFeatureLength(SequenceFeature feature)... |
206 |
|
{ |
207 |
136961 |
if (feature.isNonPositional()) |
208 |
|
{ |
209 |
73 |
return 0; |
210 |
|
} |
211 |
136888 |
if (feature.isContactFeature()) |
212 |
|
{ |
213 |
65 |
return 1; |
214 |
|
} |
215 |
136823 |
return 1 + feature.getEnd() - feature.getBegin(); |
216 |
|
} |
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
223 |
|
|
224 |
|
|
225 |
|
@param |
226 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
227 |
72 |
protected boolean addNonPositionalFeature(SequenceFeature feature)... |
228 |
|
{ |
229 |
72 |
if (nonPositionalFeatures == null) |
230 |
|
{ |
231 |
67 |
nonPositionalFeatures = new ArrayList<>(); |
232 |
|
} |
233 |
|
|
234 |
72 |
nonPositionalFeatures.add(feature); |
235 |
|
|
236 |
72 |
nonPositionalFeatureGroups.add(feature.getFeatureGroup()); |
237 |
|
|
238 |
72 |
return true; |
239 |
|
} |
240 |
|
|
241 |
|
|
242 |
|
|
243 |
|
|
244 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
245 |
133792 |
protected synchronized void addNestedFeature(SequenceFeature feature)... |
246 |
|
{ |
247 |
133792 |
if (features == null) |
248 |
|
{ |
249 |
0 |
features = new IntervalStore<>(); |
250 |
|
} |
251 |
133792 |
features.add(feature); |
252 |
|
} |
253 |
|
|
254 |
|
|
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
|
259 |
|
|
260 |
|
@param |
261 |
|
@return |
262 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
263 |
45 |
protected synchronized boolean addContactFeature(SequenceFeature feature)... |
264 |
|
{ |
265 |
45 |
if (contactFeatureStarts == null) |
266 |
|
{ |
267 |
26 |
contactFeatureStarts = new ArrayList<>(); |
268 |
|
} |
269 |
45 |
if (contactFeatureEnds == null) |
270 |
|
{ |
271 |
26 |
contactFeatureEnds = new ArrayList<>(); |
272 |
|
} |
273 |
|
|
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
|
278 |
45 |
int insertPosition = BinarySearcher.findFirst(contactFeatureStarts, |
279 |
|
true, Compare.GE, feature.getBegin()); |
280 |
45 |
contactFeatureStarts.add(insertPosition, feature); |
281 |
|
|
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
|
286 |
45 |
insertPosition = BinarySearcher.findFirst(contactFeatureEnds, false, |
287 |
|
Compare.GE, feature.getEnd()); |
288 |
45 |
contactFeatureEnds.add(insertPosition, feature); |
289 |
|
|
290 |
45 |
return true; |
291 |
|
} |
292 |
|
|
293 |
|
|
294 |
|
|
295 |
|
|
296 |
|
|
297 |
|
|
298 |
|
@param |
299 |
|
@param |
300 |
|
@return |
301 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 6 |
Complexity Density: 0.5 |
|
302 |
29 |
protected static boolean listContains(List<SequenceFeature> features,... |
303 |
|
SequenceFeature feature) |
304 |
|
{ |
305 |
29 |
if (features == null || feature == null) |
306 |
|
{ |
307 |
3 |
return false; |
308 |
|
} |
309 |
|
|
310 |
|
|
311 |
|
|
312 |
|
|
313 |
|
|
314 |
|
|
315 |
26 |
int pos = BinarySearcher.findFirst(features, true, Compare.GE, |
316 |
|
feature.getBegin()); |
317 |
26 |
int len = features.size(); |
318 |
35 |
while (pos < len) |
319 |
|
{ |
320 |
18 |
SequenceFeature sf = features.get(pos); |
321 |
18 |
if (sf.getBegin() > feature.getBegin()) |
322 |
|
{ |
323 |
5 |
return false; |
324 |
|
} |
325 |
13 |
if (sf.equals(feature)) |
326 |
|
{ |
327 |
4 |
return true; |
328 |
|
} |
329 |
9 |
pos++; |
330 |
|
} |
331 |
17 |
return false; |
332 |
|
} |
333 |
|
|
334 |
|
|
335 |
|
|
336 |
|
|
337 |
|
|
338 |
|
|
339 |
|
@param |
340 |
|
|
341 |
|
@param |
342 |
|
|
343 |
|
@return |
344 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
345 |
112051 |
public List<SequenceFeature> findOverlappingFeatures(long start, long end)... |
346 |
|
{ |
347 |
112051 |
List<SequenceFeature> result = new ArrayList<>(); |
348 |
|
|
349 |
112052 |
findContactFeatures(start, end, result); |
350 |
|
|
351 |
112050 |
if (features != null) |
352 |
|
{ |
353 |
112051 |
result.addAll(features.findOverlaps(start, end)); |
354 |
|
} |
355 |
|
|
356 |
112050 |
return result; |
357 |
|
} |
358 |
|
|
359 |
|
|
360 |
|
|
361 |
|
|
362 |
|
|
363 |
|
@param |
364 |
|
@param |
365 |
|
@param |
366 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
367 |
112051 |
protected void findContactFeatures(long from, long to,... |
368 |
|
List<SequenceFeature> result) |
369 |
|
{ |
370 |
112051 |
if (contactFeatureStarts != null) |
371 |
|
{ |
372 |
41 |
findContactStartOverlaps(from, to, result); |
373 |
|
} |
374 |
112052 |
if (contactFeatureEnds != null) |
375 |
|
{ |
376 |
41 |
findContactEndOverlaps(from, to, result); |
377 |
|
} |
378 |
|
} |
379 |
|
|
380 |
|
|
381 |
|
|
382 |
|
|
383 |
|
|
384 |
|
|
385 |
|
@param |
386 |
|
@param |
387 |
|
@param |
388 |
|
|
|
|
| 82.6% |
Uncovered Elements: 4 (23) |
Complexity: 6 |
Complexity Density: 0.4 |
|
389 |
41 |
protected void findContactEndOverlaps(long from, long to,... |
390 |
|
List<SequenceFeature> result) |
391 |
|
{ |
392 |
|
|
393 |
|
|
394 |
|
|
395 |
|
|
396 |
41 |
int index = BinarySearcher.findFirst(contactFeatureEnds, false, |
397 |
|
Compare.GE, (int) from); |
398 |
|
|
399 |
67 |
while (index < contactFeatureEnds.size()) |
400 |
|
{ |
401 |
52 |
SequenceFeature sf = contactFeatureEnds.get(index); |
402 |
52 |
if (!sf.isContactFeature()) |
403 |
|
{ |
404 |
0 |
jalview.bin.Console.errPrintln("Error! non-contact feature type " |
405 |
|
+ sf.getType() + " in contact features list"); |
406 |
0 |
index++; |
407 |
0 |
continue; |
408 |
|
} |
409 |
|
|
410 |
52 |
int begin = sf.getBegin(); |
411 |
52 |
if (begin >= from && begin <= to) |
412 |
|
{ |
413 |
|
|
414 |
|
|
415 |
|
|
416 |
|
|
417 |
10 |
index++; |
418 |
10 |
continue; |
419 |
|
} |
420 |
|
|
421 |
42 |
if (sf.getEnd() > to) |
422 |
|
{ |
423 |
|
|
424 |
|
|
425 |
|
|
426 |
26 |
break; |
427 |
|
} |
428 |
|
|
429 |
|
|
430 |
|
|
431 |
|
|
432 |
|
|
433 |
16 |
result.add(sf); |
434 |
16 |
index++; |
435 |
|
} |
436 |
|
} |
437 |
|
|
438 |
|
|
439 |
|
|
440 |
|
|
441 |
|
|
442 |
|
@param |
443 |
|
@param |
444 |
|
@param |
445 |
|
|
|
|
| 76.5% |
Uncovered Elements: 4 (17) |
Complexity: 4 |
Complexity Density: 0.36 |
|
446 |
41 |
protected void findContactStartOverlaps(long from, long to,... |
447 |
|
List<SequenceFeature> result) |
448 |
|
{ |
449 |
41 |
int index = BinarySearcher.findFirst(contactFeatureStarts, true, |
450 |
|
Compare.GE, (int) from); |
451 |
|
|
452 |
51 |
while (index < contactFeatureStarts.size()) |
453 |
|
{ |
454 |
20 |
SequenceFeature sf = contactFeatureStarts.get(index); |
455 |
20 |
if (!sf.isContactFeature()) |
456 |
|
{ |
457 |
0 |
jalview.bin.Console.errPrintln("Error! non-contact feature " |
458 |
|
+ sf.toString() + " in contact features list"); |
459 |
0 |
index++; |
460 |
0 |
continue; |
461 |
|
} |
462 |
20 |
if (sf.getBegin() > to) |
463 |
|
{ |
464 |
|
|
465 |
|
|
466 |
|
|
467 |
10 |
break; |
468 |
|
} |
469 |
|
|
470 |
|
|
471 |
|
|
472 |
|
|
473 |
|
|
474 |
10 |
result.add(sf); |
475 |
10 |
index++; |
476 |
|
} |
477 |
|
} |
478 |
|
|
479 |
|
|
480 |
|
|
481 |
|
|
482 |
|
@return |
483 |
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
484 |
4127 |
public List<SequenceFeature> getPositionalFeatures()... |
485 |
|
{ |
486 |
4127 |
List<SequenceFeature> result = new ArrayList<>(); |
487 |
|
|
488 |
|
|
489 |
|
|
490 |
|
|
491 |
4127 |
if (contactFeatureStarts != null) |
492 |
|
{ |
493 |
64 |
result.addAll(contactFeatureStarts); |
494 |
|
} |
495 |
|
|
496 |
|
|
497 |
|
|
498 |
|
|
499 |
4127 |
if (features != null) |
500 |
|
{ |
501 |
4127 |
result.addAll(features); |
502 |
|
} |
503 |
|
|
504 |
4127 |
return result; |
505 |
|
} |
506 |
|
|
507 |
|
|
508 |
|
|
509 |
|
|
510 |
|
|
511 |
|
@return |
512 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
513 |
19 |
public List<SequenceFeature> getContactFeatures()... |
514 |
|
{ |
515 |
19 |
if (contactFeatureStarts == null) |
516 |
|
{ |
517 |
14 |
return Collections.emptyList(); |
518 |
|
} |
519 |
5 |
return new ArrayList<>(contactFeatureStarts); |
520 |
|
} |
521 |
|
|
522 |
|
|
523 |
|
|
524 |
|
|
525 |
|
|
526 |
|
@return |
527 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
528 |
4013 |
public List<SequenceFeature> getNonPositionalFeatures()... |
529 |
|
{ |
530 |
4013 |
if (nonPositionalFeatures == null) |
531 |
|
{ |
532 |
3890 |
return Collections.emptyList(); |
533 |
|
} |
534 |
123 |
return new ArrayList<>(nonPositionalFeatures); |
535 |
|
} |
536 |
|
|
537 |
|
|
538 |
|
|
539 |
|
|
540 |
|
|
541 |
|
|
542 |
|
|
543 |
|
@param |
544 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (24) |
Complexity: 9 |
Complexity Density: 0.64 |
|
545 |
400 |
public synchronized boolean delete(SequenceFeature sf)... |
546 |
|
{ |
547 |
400 |
boolean removed = false; |
548 |
|
|
549 |
|
|
550 |
|
|
551 |
|
|
552 |
|
|
553 |
400 |
if (!removed && contactFeatureStarts != null) |
554 |
|
{ |
555 |
57 |
removed = contactFeatureStarts.remove(sf); |
556 |
57 |
if (removed) |
557 |
|
{ |
558 |
14 |
contactFeatureEnds.remove(sf); |
559 |
|
} |
560 |
|
} |
561 |
|
|
562 |
400 |
boolean removedNonPositional = false; |
563 |
|
|
564 |
|
|
565 |
|
|
566 |
|
|
567 |
400 |
if (!removed && nonPositionalFeatures != null) |
568 |
|
{ |
569 |
59 |
removedNonPositional = nonPositionalFeatures.remove(sf); |
570 |
59 |
removed = removedNonPositional; |
571 |
|
} |
572 |
|
|
573 |
|
|
574 |
|
|
575 |
|
|
576 |
400 |
if (!removed && features != null) |
577 |
|
{ |
578 |
369 |
removed = features.remove(sf); |
579 |
|
} |
580 |
|
|
581 |
400 |
if (removed) |
582 |
|
{ |
583 |
297 |
rescanAfterDelete(); |
584 |
|
} |
585 |
|
|
586 |
400 |
return removed; |
587 |
|
} |
588 |
|
|
589 |
|
|
590 |
|
|
591 |
|
|
592 |
|
|
593 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
|
594 |
297 |
protected synchronized void rescanAfterDelete()... |
595 |
|
{ |
596 |
297 |
positionalFeatureGroups.clear(); |
597 |
297 |
nonPositionalFeatureGroups.clear(); |
598 |
297 |
totalExtent = 0; |
599 |
297 |
positionalMinScore = Float.NaN; |
600 |
297 |
positionalMaxScore = Float.NaN; |
601 |
297 |
nonPositionalMinScore = Float.NaN; |
602 |
297 |
nonPositionalMaxScore = Float.NaN; |
603 |
|
|
604 |
|
|
605 |
|
|
606 |
|
|
607 |
297 |
for (SequenceFeature sf : getNonPositionalFeatures()) |
608 |
|
{ |
609 |
19 |
nonPositionalFeatureGroups.add(sf.getFeatureGroup()); |
610 |
19 |
float score = sf.getScore(); |
611 |
19 |
nonPositionalMinScore = min(nonPositionalMinScore, score); |
612 |
19 |
nonPositionalMaxScore = max(nonPositionalMaxScore, score); |
613 |
|
} |
614 |
|
|
615 |
|
|
616 |
|
|
617 |
|
|
618 |
297 |
for (SequenceFeature sf : getPositionalFeatures()) |
619 |
|
{ |
620 |
3049 |
positionalFeatureGroups.add(sf.getFeatureGroup()); |
621 |
3049 |
float score = sf.getScore(); |
622 |
3049 |
positionalMinScore = min(positionalMinScore, score); |
623 |
3049 |
positionalMaxScore = max(positionalMaxScore, score); |
624 |
3049 |
totalExtent += getFeatureLength(sf); |
625 |
|
} |
626 |
|
} |
627 |
|
|
628 |
|
|
629 |
|
|
630 |
|
|
631 |
|
|
632 |
|
|
633 |
|
@param |
634 |
|
@param |
635 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 4 |
Complexity Density: 1.33 |
|
636 |
136837 |
protected static float min(float f1, float f2)... |
637 |
|
{ |
638 |
136837 |
if (Float.isNaN(f1)) |
639 |
|
{ |
640 |
2816 |
return Float.isNaN(f2) ? f1 : f2; |
641 |
|
} |
642 |
|
else |
643 |
|
{ |
644 |
134021 |
return Float.isNaN(f2) ? f1 : Math.min(f1, f2); |
645 |
|
} |
646 |
|
} |
647 |
|
|
648 |
|
|
649 |
|
|
650 |
|
|
651 |
|
|
652 |
|
|
653 |
|
@param |
654 |
|
@param |
655 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 4 |
Complexity Density: 1.33 |
|
656 |
136837 |
protected static float max(float f1, float f2)... |
657 |
|
{ |
658 |
136837 |
if (Float.isNaN(f1)) |
659 |
|
{ |
660 |
2816 |
return Float.isNaN(f2) ? f1 : f2; |
661 |
|
} |
662 |
|
else |
663 |
|
{ |
664 |
134021 |
return Float.isNaN(f2) ? f1 : Math.max(f1, f2); |
665 |
|
} |
666 |
|
} |
667 |
|
|
668 |
|
|
669 |
|
|
670 |
|
|
671 |
|
@return |
672 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
673 |
1122 |
public boolean isEmpty()... |
674 |
|
{ |
675 |
1122 |
boolean hasFeatures = (contactFeatureStarts != null |
676 |
|
&& !contactFeatureStarts.isEmpty()) |
677 |
|
|| (nonPositionalFeatures != null |
678 |
|
&& !nonPositionalFeatures.isEmpty()) |
679 |
|
|| (features != null && features.size() > 0); |
680 |
|
|
681 |
1122 |
return !hasFeatures; |
682 |
|
} |
683 |
|
|
684 |
|
|
685 |
|
|
686 |
|
|
687 |
|
|
688 |
|
|
689 |
|
@param |
690 |
|
@return |
691 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 3 |
Complexity Density: 1 |
|
692 |
5856 |
public Set<String> getFeatureGroups(boolean positionalFeatures)... |
693 |
|
{ |
694 |
5856 |
if (positionalFeatures) |
695 |
|
{ |
696 |
5782 |
return Collections.unmodifiableSet(positionalFeatureGroups); |
697 |
|
} |
698 |
|
else |
699 |
|
{ |
700 |
74 |
return nonPositionalFeatureGroups == null |
701 |
|
? Collections.<String> emptySet() |
702 |
|
: Collections.unmodifiableSet(nonPositionalFeatureGroups); |
703 |
|
} |
704 |
|
} |
705 |
|
|
706 |
|
|
707 |
|
|
708 |
|
|
709 |
|
|
710 |
|
@param |
711 |
|
@return |
712 |
|
|
|
|
| 93.8% |
Uncovered Elements: 1 (16) |
Complexity: 5 |
Complexity Density: 0.62 |
|
713 |
79 |
public int getFeatureCount(boolean positional)... |
714 |
|
{ |
715 |
79 |
if (!positional) |
716 |
|
{ |
717 |
26 |
return nonPositionalFeatures == null ? 0 |
718 |
|
: nonPositionalFeatures.size(); |
719 |
|
} |
720 |
|
|
721 |
53 |
int size = 0; |
722 |
|
|
723 |
53 |
if (contactFeatureStarts != null) |
724 |
|
{ |
725 |
|
|
726 |
14 |
size += contactFeatureStarts.size(); |
727 |
|
} |
728 |
|
|
729 |
53 |
if (features != null) |
730 |
|
{ |
731 |
53 |
size += features.size(); |
732 |
|
} |
733 |
|
|
734 |
53 |
return size; |
735 |
|
} |
736 |
|
|
737 |
|
|
738 |
|
|
739 |
|
|
740 |
|
|
741 |
|
@return |
742 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
743 |
42 |
public int getTotalFeatureLength()... |
744 |
|
{ |
745 |
42 |
return totalExtent; |
746 |
|
} |
747 |
|
|
748 |
|
|
749 |
|
|
750 |
|
|
751 |
|
|
752 |
|
|
753 |
|
@param |
754 |
|
@return |
755 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
756 |
1929 |
public float getMinimumScore(boolean positional)... |
757 |
|
{ |
758 |
1929 |
return positional ? positionalMinScore : nonPositionalMinScore; |
759 |
|
} |
760 |
|
|
761 |
|
|
762 |
|
|
763 |
|
|
764 |
|
|
765 |
|
|
766 |
|
@param |
767 |
|
@return |
768 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
769 |
1903 |
public float getMaximumScore(boolean positional)... |
770 |
|
{ |
771 |
1903 |
return positional ? positionalMaxScore : nonPositionalMaxScore; |
772 |
|
} |
773 |
|
|
774 |
|
|
775 |
|
|
776 |
|
|
777 |
|
|
778 |
|
@param |
779 |
|
@param |
780 |
|
@return |
781 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 10 |
Complexity Density: 1.11 |
|
782 |
48 |
public List<SequenceFeature> getFeaturesForGroup(boolean positional,... |
783 |
|
String group) |
784 |
|
{ |
785 |
48 |
List<SequenceFeature> result = new ArrayList<>(); |
786 |
|
|
787 |
|
|
788 |
|
|
789 |
|
|
790 |
|
|
791 |
48 |
if (positional && !positionalFeatureGroups.contains(group) |
792 |
|
|| !positional && !nonPositionalFeatureGroups.contains(group)) |
793 |
|
{ |
794 |
7 |
return result; |
795 |
|
} |
796 |
|
|
797 |
41 |
List<SequenceFeature> sfs = positional ? getPositionalFeatures() |
798 |
|
: getNonPositionalFeatures(); |
799 |
41 |
for (SequenceFeature sf : sfs) |
800 |
|
{ |
801 |
58 |
String featureGroup = sf.getFeatureGroup(); |
802 |
58 |
if (group == null && featureGroup == null |
803 |
|
|| group != null && group.equals(featureGroup)) |
804 |
|
{ |
805 |
41 |
result.add(sf); |
806 |
|
} |
807 |
|
} |
808 |
41 |
return result; |
809 |
|
} |
810 |
|
|
811 |
|
|
812 |
|
|
813 |
|
|
814 |
|
|
815 |
|
|
816 |
|
@param |
817 |
|
@param |
818 |
|
@return |
819 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 3 |
Complexity Density: 0.25 |
|
820 |
45 |
public synchronized boolean shiftFeatures(int fromPosition, int shiftBy)... |
821 |
|
{ |
822 |
|
|
823 |
|
|
824 |
|
|
825 |
|
|
826 |
|
|
827 |
45 |
boolean modified = false; |
828 |
45 |
for (SequenceFeature sf : getPositionalFeatures()) |
829 |
|
{ |
830 |
250 |
if (sf.getBegin() >= fromPosition) |
831 |
|
{ |
832 |
40 |
modified = true; |
833 |
40 |
int newBegin = sf.getBegin() + shiftBy; |
834 |
40 |
int newEnd = sf.getEnd() + shiftBy; |
835 |
|
|
836 |
|
|
837 |
|
|
838 |
|
|
839 |
40 |
if (newEnd > 0) |
840 |
|
{ |
841 |
38 |
newBegin = Math.max(1, newBegin); |
842 |
38 |
SequenceFeature sf2 = new SequenceFeature(sf, newBegin, newEnd, |
843 |
|
sf.getFeatureGroup(), sf.getScore()); |
844 |
38 |
addFeature(sf2); |
845 |
|
} |
846 |
40 |
delete(sf); |
847 |
|
} |
848 |
|
} |
849 |
45 |
return modified; |
850 |
|
} |
851 |
|
} |