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