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.Arrays; |
25 |
|
import java.util.Collection; |
26 |
|
import java.util.Collections; |
27 |
|
import java.util.HashMap; |
28 |
|
import java.util.Iterator; |
29 |
|
import java.util.List; |
30 |
|
import java.util.Locale; |
31 |
|
import java.util.Map; |
32 |
|
import java.util.Map.Entry; |
33 |
|
|
34 |
|
import jalview.analysis.Rna; |
35 |
|
import jalview.analysis.SecStrConsensus.SimpleBP; |
36 |
|
import jalview.analysis.WUSSParseException; |
37 |
|
import jalview.structure.StructureImportSettings; |
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
@author |
43 |
|
@version |
44 |
|
|
|
|
| 78.1% |
Uncovered Elements: 175 (800) |
Complexity: 297 |
Complexity Density: 0.65 |
|
45 |
|
public class AlignmentAnnotation |
46 |
|
{ |
47 |
|
|
48 |
|
private static final String ANNOTATION_ID_PREFIX = "ann"; |
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
public static final int SEQUENCE_PROFILE = 0; |
54 |
|
|
55 |
|
public static final int STRUCTURE_PROFILE = 1; |
56 |
|
|
57 |
|
public static final int CDNA_PROFILE = 2; |
58 |
|
|
59 |
|
private static long counter = 0; |
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
public boolean autoCalculated = false; |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
public String annotationId; |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
public SequenceI sequenceRef; |
77 |
|
|
78 |
|
|
79 |
|
public String label; |
80 |
|
|
81 |
|
|
82 |
|
public String description; |
83 |
|
|
84 |
|
|
85 |
|
public Annotation[] annotations; |
86 |
|
|
87 |
|
public List<SimpleBP> bps = null; |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
public SequenceFeature[] _rnasecstr = null; |
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
private long invalidrnastruc = -2; |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
private StructureImportSettings.TFType tfType = StructureImportSettings.TFType.DEFAULT; |
104 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
105 |
203 |
public void setTFType(StructureImportSettings.TFType t)... |
106 |
|
{ |
107 |
203 |
tfType = t; |
108 |
|
} |
109 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
110 |
0 |
public StructureImportSettings.TFType getTFType()... |
111 |
|
{ |
112 |
0 |
return tfType; |
113 |
|
} |
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
@param |
120 |
|
|
|
|
| 93.3% |
Uncovered Elements: 1 (15) |
Complexity: 5 |
Complexity Density: 0.45 |
|
121 |
1350 |
private void _updateRnaSecStr(CharSequence rnaAnnotation)... |
122 |
|
{ |
123 |
1350 |
try |
124 |
|
{ |
125 |
1350 |
_rnasecstr = Rna.getHelixMap(rnaAnnotation); |
126 |
974 |
invalidrnastruc = -1; |
127 |
|
} catch (WUSSParseException px) |
128 |
|
{ |
129 |
|
|
130 |
376 |
invalidrnastruc = px.getProblemPos(); |
131 |
|
} |
132 |
1350 |
if (invalidrnastruc > -1) |
133 |
|
{ |
134 |
376 |
return; |
135 |
|
} |
136 |
|
|
137 |
974 |
if (_rnasecstr != null && _rnasecstr.length > 0) |
138 |
|
{ |
139 |
|
|
140 |
974 |
isrna = true; |
141 |
974 |
showAllColLabels = true; |
142 |
974 |
scaleColLabel = true; |
143 |
974 |
_markRnaHelices(); |
144 |
|
} |
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
} |
149 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 4 |
Complexity Density: 0.36 |
|
150 |
974 |
private void _markRnaHelices()... |
151 |
|
{ |
152 |
974 |
int mxval = 0; |
153 |
|
|
154 |
|
|
155 |
|
|
156 |
19791 |
for (int x = 0; x < _rnasecstr.length; x++) |
157 |
|
{ |
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
18817 |
int val = 0; |
165 |
18817 |
try |
166 |
|
{ |
167 |
18817 |
val = Integer.valueOf(_rnasecstr[x].getFeatureGroup()); |
168 |
18817 |
if (mxval < val) |
169 |
|
{ |
170 |
311 |
mxval = val; |
171 |
|
} |
172 |
|
} catch (NumberFormatException q) |
173 |
|
{ |
174 |
|
} |
175 |
18817 |
; |
176 |
|
|
177 |
18817 |
annotations[_rnasecstr[x].getBegin()].value = val; |
178 |
18817 |
annotations[_rnasecstr[x].getEnd()].value = val; |
179 |
|
|
180 |
|
|
181 |
|
|
182 |
|
} |
183 |
974 |
setScore(mxval); |
184 |
|
} |
185 |
|
|
186 |
|
|
187 |
|
|
188 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
189 |
12 |
public SequenceFeature[] getRnaSecondaryStructure()... |
190 |
|
{ |
191 |
12 |
return this._rnasecstr; |
192 |
|
} |
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
198 |
4 |
public boolean rnaSecondaryStructureEquivalent(AlignmentAnnotation that)... |
199 |
|
{ |
200 |
4 |
return rnaSecondaryStructureEquivalent(that, true); |
201 |
|
} |
202 |
|
|
|
|
| 70.3% |
Uncovered Elements: 11 (37) |
Complexity: 13 |
Complexity Density: 0.62 |
|
203 |
4 |
public boolean rnaSecondaryStructureEquivalent(AlignmentAnnotation that,... |
204 |
|
boolean compareType) |
205 |
|
{ |
206 |
4 |
SequenceFeature[] thisSfArray = this.getRnaSecondaryStructure(); |
207 |
4 |
SequenceFeature[] thatSfArray = that.getRnaSecondaryStructure(); |
208 |
4 |
if (thisSfArray == null || thatSfArray == null) |
209 |
|
{ |
210 |
0 |
return thisSfArray == null && thatSfArray == null; |
211 |
|
} |
212 |
4 |
if (thisSfArray.length != thatSfArray.length) |
213 |
|
{ |
214 |
1 |
return false; |
215 |
|
} |
216 |
3 |
Arrays.sort(thisSfArray, new SFSortByEnd()); |
217 |
|
|
218 |
3 |
Arrays.sort(thatSfArray, new SFSortByEnd()); |
219 |
|
|
220 |
15 |
for (int i = 0; i < thisSfArray.length; i++) |
221 |
|
{ |
222 |
13 |
SequenceFeature thisSf = thisSfArray[i]; |
223 |
13 |
SequenceFeature thatSf = thatSfArray[i]; |
224 |
13 |
if (compareType) |
225 |
|
{ |
226 |
13 |
if (thisSf.getType() == null || thatSf.getType() == null) |
227 |
|
{ |
228 |
0 |
if (thisSf.getType() == null && thatSf.getType() == null) |
229 |
|
{ |
230 |
0 |
continue; |
231 |
|
} |
232 |
|
else |
233 |
|
{ |
234 |
0 |
return false; |
235 |
|
} |
236 |
|
} |
237 |
13 |
if (!thisSf.getType().equals(thatSf.getType())) |
238 |
|
{ |
239 |
0 |
return false; |
240 |
|
} |
241 |
|
} |
242 |
13 |
if (!(thisSf.getBegin() == thatSf.getBegin() |
243 |
|
&& thisSf.getEnd() == thatSf.getEnd())) |
244 |
|
{ |
245 |
1 |
return false; |
246 |
|
} |
247 |
|
} |
248 |
2 |
return true; |
249 |
|
|
250 |
|
} |
251 |
|
|
252 |
|
|
253 |
|
|
254 |
|
|
255 |
|
private Map<Integer, Annotation> sequenceMapping; |
256 |
|
|
257 |
|
|
258 |
|
|
259 |
|
|
260 |
|
public float graphMin; |
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
|
265 |
|
public float graphMax; |
266 |
|
|
267 |
|
|
268 |
|
|
269 |
|
|
270 |
|
public double score = Double.NaN; |
271 |
|
|
272 |
|
|
273 |
|
|
274 |
|
|
275 |
|
public boolean hasScore = false; |
276 |
|
|
277 |
|
public GraphLine threshold; |
278 |
|
|
279 |
|
|
280 |
|
|
281 |
|
|
282 |
|
public boolean editable = false; |
283 |
|
|
284 |
|
|
285 |
|
public boolean hasIcons; |
286 |
|
|
287 |
|
|
288 |
|
public boolean hasText; |
289 |
|
|
290 |
|
|
291 |
|
public boolean visible = true; |
292 |
|
|
293 |
|
|
294 |
|
|
295 |
|
|
296 |
|
|
297 |
|
public boolean hasData=true; |
298 |
|
|
299 |
|
|
300 |
|
|
301 |
|
public int graphGroup = -1; |
302 |
|
|
303 |
|
|
304 |
|
public int height = 0; |
305 |
|
|
306 |
|
public int graph = 0; |
307 |
|
|
308 |
|
public int graphHeight = 40; |
309 |
|
|
310 |
|
public boolean padGaps = false; |
311 |
|
|
312 |
|
public static final int NO_GRAPH = 0; |
313 |
|
|
314 |
|
public static final int BAR_GRAPH = 1; |
315 |
|
|
316 |
|
public static final int LINE_GRAPH = 2; |
317 |
|
|
318 |
|
public static final int CONTACT_MAP = 4; |
319 |
|
|
320 |
|
|
321 |
|
|
322 |
|
|
323 |
|
|
324 |
|
public static final String CONTACT_MAP_NOGROUPS = "CMNOGRPS"; |
325 |
|
|
326 |
|
public boolean belowAlignment = true; |
327 |
|
|
328 |
|
public SequenceGroup groupRef = null; |
329 |
|
|
330 |
|
|
331 |
|
|
332 |
|
|
333 |
|
public boolean showAllColLabels = false; |
334 |
|
|
335 |
|
|
336 |
|
|
337 |
|
|
338 |
|
public boolean scaleColLabel = false; |
339 |
|
|
340 |
|
|
341 |
|
|
342 |
|
|
343 |
|
public boolean centreColLabels = false; |
344 |
|
|
345 |
|
private boolean isrna; |
346 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
347 |
213 |
public static int getGraphValueFromString(String string)... |
348 |
|
{ |
349 |
213 |
if (string.equalsIgnoreCase("BAR_GRAPH")) |
350 |
|
{ |
351 |
23 |
return BAR_GRAPH; |
352 |
|
} |
353 |
190 |
else if (string.equalsIgnoreCase("LINE_GRAPH")) |
354 |
|
{ |
355 |
162 |
return LINE_GRAPH; |
356 |
|
} |
357 |
|
else |
358 |
|
{ |
359 |
28 |
return NO_GRAPH; |
360 |
|
} |
361 |
|
} |
362 |
|
|
363 |
|
|
364 |
|
|
365 |
|
|
366 |
|
@param |
367 |
|
|
368 |
|
@param |
369 |
|
|
370 |
|
@param |
371 |
|
|
372 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
373 |
34575 |
public AlignmentAnnotation(String label, String description,... |
374 |
|
Annotation[] annotations) |
375 |
|
{ |
376 |
34575 |
setAnnotationId(); |
377 |
|
|
378 |
34575 |
editable = true; |
379 |
34575 |
this.label = label; |
380 |
34575 |
this.description = description; |
381 |
34575 |
this.annotations = annotations; |
382 |
|
|
383 |
34575 |
validateRangeAndDisplay(); |
384 |
|
} |
385 |
|
|
386 |
|
|
387 |
|
|
388 |
|
|
389 |
|
|
|
|
| 96.5% |
Uncovered Elements: 2 (57) |
Complexity: 73 |
Complexity Density: 2.35 |
|
390 |
5260 |
void areLabelsSecondaryStructure()... |
391 |
|
{ |
392 |
5260 |
boolean nonSSLabel = false; |
393 |
5260 |
isrna = false; |
394 |
5260 |
StringBuffer rnastring = new StringBuffer(); |
395 |
|
|
396 |
5260 |
char firstChar = 0; |
397 |
615393 |
for (int i = 0; i < annotations.length; i++) |
398 |
|
{ |
399 |
|
|
400 |
610133 |
if (annotations[i] == null) |
401 |
|
{ |
402 |
117284 |
continue; |
403 |
|
} |
404 |
492849 |
if (annotations[i].secondaryStructure == 'H' |
405 |
|
|| annotations[i].secondaryStructure == 'E') |
406 |
|
{ |
407 |
|
|
408 |
|
|
409 |
51241 |
hasIcons |= true; |
410 |
|
} |
411 |
|
else |
412 |
|
|
413 |
|
{ |
414 |
|
|
415 |
|
|
416 |
|
|
417 |
|
|
418 |
|
|
419 |
|
|
420 |
|
|
421 |
441608 |
if (annotations[i].secondaryStructure == '(' |
422 |
|
|| annotations[i].secondaryStructure == '[' |
423 |
|
|| annotations[i].secondaryStructure == '<' |
424 |
|
|| annotations[i].secondaryStructure == '{' |
425 |
|
|| annotations[i].secondaryStructure == 'A' |
426 |
|
|
427 |
|
|
428 |
|
|| annotations[i].secondaryStructure == 'D' |
429 |
|
|
430 |
|
|
431 |
|
|| annotations[i].secondaryStructure == 'F' |
432 |
|
|
433 |
|
|
434 |
|
|
435 |
|
|
436 |
|
|| annotations[i].secondaryStructure == 'J' |
437 |
|
|| annotations[i].secondaryStructure == 'K' |
438 |
|
|| annotations[i].secondaryStructure == 'L' |
439 |
|
|| annotations[i].secondaryStructure == 'M' |
440 |
|
|| annotations[i].secondaryStructure == 'N' |
441 |
|
|| annotations[i].secondaryStructure == 'O' |
442 |
|
|| annotations[i].secondaryStructure == 'P' |
443 |
|
|| annotations[i].secondaryStructure == 'Q' |
444 |
|
|| annotations[i].secondaryStructure == 'R' |
445 |
|
|
446 |
|
|
447 |
|
|| annotations[i].secondaryStructure == 'U' |
448 |
|
|| annotations[i].secondaryStructure == 'V' |
449 |
|
|| annotations[i].secondaryStructure == 'W' |
450 |
|
|
451 |
|
|| annotations[i].secondaryStructure == 'Y' |
452 |
|
|| annotations[i].secondaryStructure == 'Z') |
453 |
|
{ |
454 |
14422 |
hasIcons |= true; |
455 |
14422 |
isrna |= true; |
456 |
|
} |
457 |
|
} |
458 |
|
|
459 |
|
|
460 |
|
|
461 |
|
|
462 |
492849 |
if (annotations[i].displayCharacter == null |
463 |
|
|| annotations[i].displayCharacter.length() == 0) |
464 |
|
{ |
465 |
165981 |
rnastring.append('.'); |
466 |
165981 |
continue; |
467 |
|
} |
468 |
326868 |
if (annotations[i].displayCharacter.length() == 1) |
469 |
|
{ |
470 |
273528 |
firstChar = annotations[i].displayCharacter.charAt(0); |
471 |
|
|
472 |
|
|
473 |
273528 |
if (annotations[i].secondaryStructure != ' ' && !hasIcons && |
474 |
|
|
475 |
|
|
476 |
|
|
477 |
|
|
478 |
|
|
479 |
|
|
480 |
|
|
481 |
|
firstChar != ' ' && firstChar != '$' && firstChar != 0xCE |
482 |
|
&& firstChar != '(' && firstChar != '[' && firstChar != '<' |
483 |
|
&& firstChar != '{' && firstChar != 'A' && firstChar != 'B' |
484 |
|
&& firstChar != 'C' && firstChar != 'D' && firstChar != 'E' |
485 |
|
&& firstChar != 'F' && firstChar != 'G' && firstChar != 'H' |
486 |
|
&& firstChar != 'I' && firstChar != 'J' && firstChar != 'K' |
487 |
|
&& firstChar != 'L' && firstChar != 'M' && firstChar != 'N' |
488 |
|
&& firstChar != 'O' && firstChar != 'P' && firstChar != 'Q' |
489 |
|
&& firstChar != 'R' && firstChar != 'S' && firstChar != 'T' |
490 |
|
&& firstChar != 'U' && firstChar != 'V' && firstChar != 'W' |
491 |
|
&& firstChar != 'X' && firstChar != 'Y' && firstChar != 'Z' |
492 |
|
&& firstChar != '-' |
493 |
|
&& firstChar < jalview.schemes.ResidueProperties.aaIndex.length) |
494 |
|
{ |
495 |
174 |
if (jalview.schemes.ResidueProperties.aaIndex[firstChar] < 23) |
496 |
|
|
497 |
|
|
498 |
|
|
499 |
|
|
500 |
|
|
501 |
|
{ |
502 |
11 |
nonSSLabel = true; |
503 |
|
} |
504 |
|
} |
505 |
|
} |
506 |
|
else |
507 |
|
{ |
508 |
53340 |
rnastring.append(annotations[i].displayCharacter.charAt(1)); |
509 |
|
} |
510 |
|
|
511 |
326868 |
if (annotations[i].displayCharacter.length() > 0) |
512 |
|
{ |
513 |
326868 |
hasText = true; |
514 |
|
} |
515 |
|
} |
516 |
|
|
517 |
5260 |
if (nonSSLabel) |
518 |
|
{ |
519 |
1 |
hasIcons = false; |
520 |
12 |
for (int j = 0; j < annotations.length; j++) |
521 |
|
{ |
522 |
11 |
if (annotations[j] != null |
523 |
|
&& annotations[j].secondaryStructure != ' ') |
524 |
|
{ |
525 |
11 |
annotations[j].displayCharacter = String |
526 |
|
.valueOf(annotations[j].secondaryStructure); |
527 |
11 |
annotations[j].secondaryStructure = ' '; |
528 |
|
} |
529 |
|
|
530 |
|
} |
531 |
|
} |
532 |
|
else |
533 |
|
{ |
534 |
5259 |
if (isrna) |
535 |
|
{ |
536 |
931 |
_updateRnaSecStr(new AnnotCharSequence()); |
537 |
|
} |
538 |
|
} |
539 |
|
} |
540 |
|
|
541 |
|
|
542 |
|
|
543 |
|
|
544 |
|
|
545 |
|
@author |
546 |
|
|
547 |
|
|
|
|
| 92.6% |
Uncovered Elements: 2 (27) |
Complexity: 17 |
Complexity Density: 1.55 |
|
548 |
|
private class AnnotCharSequence implements CharSequence |
549 |
|
{ |
550 |
|
int offset = 0; |
551 |
|
|
552 |
|
int max = 0; |
553 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
554 |
1356 |
public AnnotCharSequence()... |
555 |
|
{ |
556 |
1356 |
this(0, annotations.length); |
557 |
|
} |
558 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
559 |
1356 |
AnnotCharSequence(int start, int end)... |
560 |
|
{ |
561 |
1356 |
offset = start; |
562 |
1356 |
max = end; |
563 |
|
} |
564 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
565 |
0 |
@Override... |
566 |
|
public CharSequence subSequence(int start, int end) |
567 |
|
{ |
568 |
0 |
return new AnnotCharSequence(offset + start, offset + end); |
569 |
|
} |
570 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
571 |
65811 |
@Override... |
572 |
|
public int length() |
573 |
|
{ |
574 |
65811 |
return max - offset; |
575 |
|
} |
576 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 7 |
Complexity Density: 7 |
|
577 |
64880 |
@Override... |
578 |
|
public char charAt(int index) |
579 |
|
{ |
580 |
64880 |
return ((index + offset < 0) || (index + offset) >= max |
581 |
|
|| annotations[index + offset] == null |
582 |
|
|| (annotations[index + offset].secondaryStructure <= ' ') |
583 |
|
? ' ' |
584 |
27030 |
: annotations[index + offset].displayCharacter == null |
585 |
|
|| annotations[index |
586 |
|
+ offset].displayCharacter |
587 |
|
.length() == 0 |
588 |
|
? annotations[index |
589 |
|
+ offset].secondaryStructure |
590 |
|
: annotations[index |
591 |
|
+ offset].displayCharacter |
592 |
|
.charAt(0)); |
593 |
|
} |
594 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 6 |
Complexity Density: 1.2 |
|
595 |
425 |
@Override... |
596 |
|
public String toString() |
597 |
|
{ |
598 |
425 |
char[] string = new char[max - offset]; |
599 |
425 |
int mx = annotations.length; |
600 |
|
|
601 |
31591 |
for (int i = offset; i < mx; i++) |
602 |
|
{ |
603 |
31166 |
string[i] = (annotations[i] == null |
604 |
|
|| (annotations[i].secondaryStructure <= 32)) |
605 |
|
? ' ' |
606 |
13270 |
: (annotations[i].displayCharacter == null |
607 |
|
|| annotations[i].displayCharacter |
608 |
|
.length() == 0 |
609 |
|
? annotations[i].secondaryStructure |
610 |
|
: annotations[i].displayCharacter |
611 |
|
.charAt(0)); |
612 |
|
} |
613 |
425 |
return new String(string); |
614 |
|
} |
615 |
|
}; |
616 |
|
|
617 |
|
private long _lastrnaannot = -1; |
618 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
619 |
3409 |
public String getRNAStruc()... |
620 |
|
{ |
621 |
3409 |
if (isrna) |
622 |
|
{ |
623 |
425 |
String rnastruc = new AnnotCharSequence().toString(); |
624 |
425 |
if (_lastrnaannot != rnastruc.hashCode()) |
625 |
|
{ |
626 |
|
|
627 |
419 |
_lastrnaannot = rnastruc.hashCode(); |
628 |
419 |
_updateRnaSecStr(rnastruc); |
629 |
|
} |
630 |
425 |
return rnastruc; |
631 |
|
} |
632 |
2984 |
return null; |
633 |
|
} |
634 |
|
|
635 |
|
|
636 |
|
|
637 |
|
|
638 |
|
@param |
639 |
|
|
640 |
|
@param |
641 |
|
|
642 |
|
@param |
643 |
|
|
644 |
|
@param |
645 |
|
|
646 |
|
@param |
647 |
|
|
648 |
|
@param |
649 |
|
|
650 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
651 |
2649 |
public AlignmentAnnotation(String label, String description,... |
652 |
|
Annotation[] annotations, float min, float max, int graphType) |
653 |
|
{ |
654 |
2649 |
setAnnotationId(); |
655 |
|
|
656 |
2649 |
editable = graphType == 0; |
657 |
|
|
658 |
2649 |
this.label = label; |
659 |
2649 |
this.description = description; |
660 |
2649 |
this.annotations = annotations; |
661 |
2649 |
graph = graphType; |
662 |
2649 |
graphMin = min; |
663 |
2649 |
graphMax = max; |
664 |
2649 |
validateRangeAndDisplay(); |
665 |
|
} |
666 |
|
|
667 |
|
|
668 |
|
|
669 |
|
|
670 |
|
|
|
|
| 96.6% |
Uncovered Elements: 2 (59) |
Complexity: 18 |
Complexity Density: 0.55 |
|
671 |
38748 |
public void validateRangeAndDisplay()... |
672 |
|
{ |
673 |
|
|
674 |
38748 |
if (annotations == null) |
675 |
|
{ |
676 |
33488 |
visible = false; |
677 |
33488 |
invalidrnastruc = -1; |
678 |
33488 |
return; |
679 |
|
} |
680 |
|
|
681 |
5260 |
int graphType = graph; |
682 |
5260 |
float min = graphMin; |
683 |
5260 |
float max = graphMax; |
684 |
5260 |
boolean drawValues = true; |
685 |
5260 |
_linecolour = null; |
686 |
5260 |
if (min == max) |
687 |
|
{ |
688 |
2771 |
min = 999999999; |
689 |
509043 |
for (int i = 0; i < annotations.length; i++) |
690 |
|
{ |
691 |
506272 |
if (annotations[i] == null) |
692 |
|
{ |
693 |
108769 |
continue; |
694 |
|
} |
695 |
|
|
696 |
397503 |
if (drawValues && annotations[i].displayCharacter != null |
697 |
|
&& annotations[i].displayCharacter.length() > 1) |
698 |
|
{ |
699 |
1222 |
drawValues = false; |
700 |
|
} |
701 |
|
|
702 |
397503 |
if (annotations[i].value > max) |
703 |
|
{ |
704 |
2558 |
max = annotations[i].value; |
705 |
|
} |
706 |
|
|
707 |
397503 |
if (annotations[i].value < min) |
708 |
|
{ |
709 |
5024 |
min = annotations[i].value; |
710 |
|
} |
711 |
397503 |
if (_linecolour == null && annotations[i].colour != null) |
712 |
|
{ |
713 |
770 |
_linecolour = annotations[i].colour; |
714 |
|
} |
715 |
|
} |
716 |
|
|
717 |
2771 |
if (min > 0) |
718 |
|
{ |
719 |
1365 |
min = 0; |
720 |
|
} |
721 |
|
else |
722 |
|
{ |
723 |
1406 |
if (max < 0) |
724 |
|
{ |
725 |
0 |
max = 0; |
726 |
|
} |
727 |
|
} |
728 |
|
} |
729 |
|
|
730 |
5260 |
graphMin = min; |
731 |
5260 |
graphMax = max; |
732 |
|
|
733 |
5260 |
areLabelsSecondaryStructure(); |
734 |
|
|
735 |
5260 |
if (!drawValues && graphType != NO_GRAPH) |
736 |
|
{ |
737 |
27176 |
for (int i = 0; i < annotations.length; i++) |
738 |
|
{ |
739 |
27004 |
if (annotations[i] != null) |
740 |
|
{ |
741 |
21912 |
annotations[i].displayCharacter = ""; |
742 |
|
} |
743 |
|
} |
744 |
|
} |
745 |
|
} |
746 |
|
|
747 |
|
|
748 |
|
|
749 |
|
|
750 |
|
|
751 |
|
@param |
752 |
|
|
|
|
| 88.4% |
Uncovered Elements: 10 (86) |
Complexity: 16 |
Complexity Density: 0.29 |
|
753 |
809 |
public AlignmentAnnotation(AlignmentAnnotation annotation)... |
754 |
|
{ |
755 |
809 |
setAnnotationId(); |
756 |
809 |
this.label = new String(annotation.label); |
757 |
809 |
if (annotation.description != null) |
758 |
|
{ |
759 |
785 |
this.description = new String(annotation.description); |
760 |
|
} |
761 |
809 |
this.graphMin = annotation.graphMin; |
762 |
809 |
this.graphMax = annotation.graphMax; |
763 |
809 |
this.graph = annotation.graph; |
764 |
809 |
this.graphHeight = annotation.graphHeight; |
765 |
809 |
this.graphGroup = annotation.graphGroup; |
766 |
809 |
this.groupRef = annotation.groupRef; |
767 |
809 |
this.editable = annotation.editable; |
768 |
809 |
this.autoCalculated = annotation.autoCalculated; |
769 |
809 |
this.hasIcons = annotation.hasIcons; |
770 |
809 |
this.hasText = annotation.hasText; |
771 |
809 |
this.height = annotation.height; |
772 |
809 |
this.label = annotation.label; |
773 |
809 |
this.padGaps = annotation.padGaps; |
774 |
809 |
this.visible = annotation.visible; |
775 |
809 |
this.hasData = annotation.hasData; |
776 |
809 |
this.centreColLabels = annotation.centreColLabels; |
777 |
809 |
this.scaleColLabel = annotation.scaleColLabel; |
778 |
809 |
this.showAllColLabels = annotation.showAllColLabels; |
779 |
809 |
this.calcId = annotation.calcId; |
780 |
809 |
if (annotation.properties != null) |
781 |
|
{ |
782 |
809 |
properties = new HashMap<>(); |
783 |
809 |
for (Map.Entry<String, String> val : annotation.properties.entrySet()) |
784 |
|
{ |
785 |
16 |
properties.put(val.getKey(), val.getValue()); |
786 |
|
} |
787 |
|
} |
788 |
? |
if (this.hasScore = annotation.hasScore) |
789 |
|
{ |
790 |
129 |
this.score = annotation.score; |
791 |
|
} |
792 |
809 |
if (annotation.threshold != null) |
793 |
|
{ |
794 |
0 |
threshold = new GraphLine(annotation.threshold); |
795 |
|
} |
796 |
809 |
Annotation[] ann = annotation.annotations; |
797 |
809 |
if (annotation.annotations != null) |
798 |
|
{ |
799 |
806 |
this.annotations = new Annotation[ann.length]; |
800 |
96370 |
for (int i = 0; i < ann.length; i++) |
801 |
|
{ |
802 |
95564 |
if (ann[i] != null) |
803 |
|
{ |
804 |
69722 |
annotations[i] = new Annotation(ann[i]); |
805 |
69722 |
if (_linecolour != null) |
806 |
|
{ |
807 |
0 |
_linecolour = annotations[i].colour; |
808 |
|
} |
809 |
|
} |
810 |
|
} |
811 |
|
} |
812 |
809 |
if (annotation.sequenceRef != null) |
813 |
|
{ |
814 |
623 |
this.sequenceRef = annotation.sequenceRef; |
815 |
623 |
if (annotation.sequenceMapping != null) |
816 |
|
{ |
817 |
621 |
Integer p = null; |
818 |
621 |
sequenceMapping = new HashMap<>(); |
819 |
621 |
Iterator<Integer> pos = annotation.sequenceMapping.keySet() |
820 |
|
.iterator(); |
821 |
49221 |
while (pos.hasNext()) |
822 |
|
{ |
823 |
|
|
824 |
48600 |
p = pos.next(); |
825 |
48600 |
Annotation a = annotation.sequenceMapping.get(p); |
826 |
48600 |
if (a == null) |
827 |
|
{ |
828 |
0 |
continue; |
829 |
|
} |
830 |
48600 |
if (ann != null) |
831 |
|
{ |
832 |
8313075 |
for (int i = 0; i < ann.length; i++) |
833 |
|
{ |
834 |
8264475 |
if (ann[i] == a) |
835 |
|
{ |
836 |
48558 |
sequenceMapping.put(p, annotations[i]); |
837 |
|
} |
838 |
|
} |
839 |
|
} |
840 |
|
} |
841 |
|
} |
842 |
|
else |
843 |
|
{ |
844 |
2 |
this.sequenceMapping = null; |
845 |
|
} |
846 |
|
|
847 |
|
} |
848 |
|
|
849 |
|
|
850 |
|
{ |
851 |
|
|
852 |
|
} |
853 |
809 |
validateRangeAndDisplay(); |
854 |
|
} |
855 |
|
|
856 |
|
|
857 |
|
|
858 |
|
|
859 |
|
|
860 |
|
@param |
861 |
|
@param |
862 |
|
|
|
|
| 78.3% |
Uncovered Elements: 10 (46) |
Complexity: 12 |
Complexity Density: 0.46 |
|
863 |
108 |
public void restrict(int startRes, int endRes)... |
864 |
|
{ |
865 |
108 |
if (annotations == null) |
866 |
|
{ |
867 |
|
|
868 |
0 |
return; |
869 |
|
} |
870 |
108 |
if (startRes < 0) |
871 |
|
{ |
872 |
0 |
startRes = 0; |
873 |
|
} |
874 |
108 |
if (startRes >= annotations.length) |
875 |
|
{ |
876 |
0 |
startRes = annotations.length - 1; |
877 |
|
} |
878 |
108 |
if (endRes >= annotations.length) |
879 |
|
{ |
880 |
100 |
endRes = annotations.length - 1; |
881 |
|
} |
882 |
108 |
if (annotations == null) |
883 |
|
{ |
884 |
0 |
return; |
885 |
|
} |
886 |
108 |
Annotation[] temp = new Annotation[endRes - startRes + 1]; |
887 |
108 |
if (startRes < annotations.length) |
888 |
|
{ |
889 |
108 |
System.arraycopy(annotations, startRes, temp, 0, |
890 |
|
endRes - startRes + 1); |
891 |
|
} |
892 |
108 |
if (sequenceRef != null) |
893 |
|
{ |
894 |
|
|
895 |
102 |
int spos = sequenceRef.findPosition(startRes); |
896 |
102 |
int epos = sequenceRef.findPosition(endRes); |
897 |
102 |
if (sequenceMapping != null) |
898 |
|
{ |
899 |
102 |
Map<Integer, Annotation> newmapping = new HashMap<>(); |
900 |
102 |
Iterator<Integer> e = sequenceMapping.keySet().iterator(); |
901 |
7896 |
while (e.hasNext()) |
902 |
|
{ |
903 |
7794 |
Integer pos = e.next(); |
904 |
7794 |
if (pos.intValue() >= spos && pos.intValue() <= epos) |
905 |
|
{ |
906 |
7750 |
newmapping.put(pos, sequenceMapping.get(pos)); |
907 |
|
} |
908 |
|
} |
909 |
102 |
sequenceMapping.clear(); |
910 |
102 |
sequenceMapping = newmapping; |
911 |
|
} |
912 |
|
} |
913 |
108 |
annotations = temp; |
914 |
|
} |
915 |
|
|
916 |
|
|
917 |
|
|
918 |
|
|
919 |
|
@param |
920 |
|
|
921 |
|
@return |
922 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
923 |
0 |
public boolean padAnnotation(int length)... |
924 |
|
{ |
925 |
0 |
if (annotations == null) |
926 |
|
{ |
927 |
0 |
return true; |
928 |
|
|
929 |
|
} |
930 |
0 |
if (annotations.length < length) |
931 |
|
{ |
932 |
0 |
Annotation[] na = new Annotation[length]; |
933 |
0 |
System.arraycopy(annotations, 0, na, 0, annotations.length); |
934 |
0 |
annotations = na; |
935 |
0 |
return true; |
936 |
|
} |
937 |
0 |
return annotations.length > length; |
938 |
|
|
939 |
|
} |
940 |
|
|
941 |
|
|
942 |
|
|
943 |
|
|
944 |
|
@return |
945 |
|
|
|
|
| 88.2% |
Uncovered Elements: 4 (34) |
Complexity: 9 |
Complexity Density: 0.5 |
|
946 |
209 |
@Override... |
947 |
|
public String toString() |
948 |
|
{ |
949 |
209 |
if (annotations == null) |
950 |
|
{ |
951 |
126 |
return ""; |
952 |
|
} |
953 |
83 |
StringBuilder buffer = new StringBuilder(256); |
954 |
|
|
955 |
192 |
for (int i = 0; i < annotations.length; i++) |
956 |
|
{ |
957 |
109 |
if (annotations[i] != null) |
958 |
|
{ |
959 |
109 |
if (graph != 0) |
960 |
|
{ |
961 |
25 |
buffer.append(annotations[i].value); |
962 |
|
} |
963 |
84 |
else if (hasIcons) |
964 |
|
{ |
965 |
84 |
buffer.append(annotations[i].secondaryStructure); |
966 |
|
} |
967 |
|
else |
968 |
|
{ |
969 |
0 |
buffer.append(annotations[i].displayCharacter); |
970 |
|
} |
971 |
|
} |
972 |
|
|
973 |
109 |
buffer.append(", "); |
974 |
|
} |
975 |
|
|
976 |
83 |
if (label.indexOf("Consensus") == 0) |
977 |
|
{ |
978 |
1 |
buffer.append("\n"); |
979 |
|
|
980 |
6 |
for (int i = 0; i < annotations.length; i++) |
981 |
|
{ |
982 |
5 |
if (annotations[i] != null) |
983 |
|
{ |
984 |
5 |
buffer.append(annotations[i].description); |
985 |
|
} |
986 |
|
|
987 |
5 |
buffer.append(", "); |
988 |
|
} |
989 |
|
} |
990 |
|
|
991 |
83 |
return buffer.toString(); |
992 |
|
} |
993 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
994 |
185 |
public void setThreshold(GraphLine line)... |
995 |
|
{ |
996 |
185 |
threshold = line; |
997 |
|
} |
998 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
999 |
630 |
public GraphLine getThreshold()... |
1000 |
|
{ |
1001 |
630 |
return threshold; |
1002 |
|
} |
1003 |
|
|
1004 |
|
|
1005 |
|
|
1006 |
|
|
1007 |
|
|
1008 |
|
|
1009 |
|
@param |
1010 |
|
@param |
1011 |
|
@param |
1012 |
|
|
|
|
| 91.3% |
Uncovered Elements: 2 (23) |
Complexity: 6 |
Complexity Density: 0.46 |
|
1013 |
1596 |
public void createSequenceMapping(SequenceI seqRef, int startRes,... |
1014 |
|
boolean alreadyMapped) |
1015 |
|
{ |
1016 |
|
|
1017 |
1596 |
if (seqRef == null) |
1018 |
|
{ |
1019 |
0 |
return; |
1020 |
|
} |
1021 |
1596 |
sequenceRef = seqRef; |
1022 |
1596 |
if (annotations == null) |
1023 |
|
{ |
1024 |
103 |
return; |
1025 |
|
} |
1026 |
1493 |
sequenceMapping = new HashMap<>(); |
1027 |
|
|
1028 |
1493 |
int seqPos; |
1029 |
|
|
1030 |
273018 |
for (int i = 0; i < annotations.length; i++) |
1031 |
|
{ |
1032 |
271525 |
if (annotations[i] != null) |
1033 |
|
{ |
1034 |
232679 |
if (alreadyMapped) |
1035 |
|
{ |
1036 |
150416 |
seqPos = seqRef.findPosition(i); |
1037 |
|
} |
1038 |
|
else |
1039 |
|
{ |
1040 |
82263 |
seqPos = i + startRes; |
1041 |
|
} |
1042 |
|
|
1043 |
232679 |
sequenceMapping.put(Integer.valueOf(seqPos), annotations[i]); |
1044 |
|
} |
1045 |
|
} |
1046 |
|
|
1047 |
|
} |
1048 |
|
|
1049 |
|
|
1050 |
|
|
1051 |
|
|
1052 |
|
|
1053 |
|
|
1054 |
|
|
|
|
| 96.7% |
Uncovered Elements: 1 (30) |
Complexity: 7 |
Complexity Density: 0.39 |
|
1055 |
2102 |
public void adjustForAlignment()... |
1056 |
|
{ |
1057 |
2102 |
if (sequenceRef == null) |
1058 |
|
{ |
1059 |
215 |
return; |
1060 |
|
} |
1061 |
|
|
1062 |
1887 |
if (annotations == null) |
1063 |
|
{ |
1064 |
103 |
return; |
1065 |
|
} |
1066 |
|
|
1067 |
1784 |
int a = 0, aSize = sequenceRef.getLength(); |
1068 |
|
|
1069 |
1784 |
if (aSize == 0) |
1070 |
|
{ |
1071 |
|
|
1072 |
1 |
return; |
1073 |
|
} |
1074 |
|
|
1075 |
1783 |
int position; |
1076 |
1783 |
Annotation[] temp = new Annotation[aSize]; |
1077 |
1783 |
Integer index; |
1078 |
1783 |
if (sequenceMapping != null) |
1079 |
|
{ |
1080 |
251236 |
for (a = sequenceRef.getStart(); a <= sequenceRef.getEnd(); a++) |
1081 |
|
{ |
1082 |
249453 |
index = Integer.valueOf(a); |
1083 |
249453 |
Annotation annot = sequenceMapping.get(index); |
1084 |
249453 |
if (annot != null) |
1085 |
|
{ |
1086 |
193897 |
position = sequenceRef.findIndex(a) - 1; |
1087 |
|
|
1088 |
193897 |
temp[position] = annot; |
1089 |
|
} |
1090 |
|
} |
1091 |
|
} |
1092 |
1783 |
annotations = temp; |
1093 |
|
} |
1094 |
|
|
1095 |
|
|
1096 |
|
|
1097 |
|
|
1098 |
|
|
1099 |
|
@return |
1100 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
1101 |
0 |
public int compactAnnotationArray()... |
1102 |
|
{ |
1103 |
0 |
int i = 0, iSize = annotations.length; |
1104 |
0 |
while (i < iSize) |
1105 |
|
{ |
1106 |
0 |
if (annotations[i] == null) |
1107 |
|
{ |
1108 |
0 |
if (i + 1 < iSize) |
1109 |
|
{ |
1110 |
0 |
System.arraycopy(annotations, i + 1, annotations, i, |
1111 |
|
iSize - i - 1); |
1112 |
|
} |
1113 |
0 |
iSize--; |
1114 |
|
} |
1115 |
|
else |
1116 |
|
{ |
1117 |
0 |
i++; |
1118 |
|
} |
1119 |
|
} |
1120 |
0 |
Annotation[] ann = annotations; |
1121 |
0 |
annotations = new Annotation[i]; |
1122 |
0 |
System.arraycopy(ann, 0, annotations, 0, i); |
1123 |
0 |
ann = null; |
1124 |
0 |
return iSize; |
1125 |
|
} |
1126 |
|
|
1127 |
|
|
1128 |
|
|
1129 |
|
|
1130 |
|
|
1131 |
|
|
1132 |
|
|
1133 |
|
|
1134 |
|
|
1135 |
|
@param |
1136 |
|
|
|
|
| 63.6% |
Uncovered Elements: 8 (22) |
Complexity: 15 |
Complexity Density: 1.07 |
|
1137 |
2626 |
public void setSequenceRef(SequenceI sequenceI)... |
1138 |
|
{ |
1139 |
2626 |
if (sequenceI != null) |
1140 |
|
{ |
1141 |
2563 |
if (sequenceRef != null) |
1142 |
|
{ |
1143 |
1491 |
boolean rIsDs = sequenceRef.getDatasetSequence() == null, |
1144 |
|
tIsDs = sequenceI.getDatasetSequence() == null; |
1145 |
1491 |
if (sequenceRef != sequenceI |
1146 |
|
&& (rIsDs && !tIsDs |
1147 |
|
&& sequenceRef != sequenceI.getDatasetSequence()) |
1148 |
|
&& (!rIsDs && tIsDs |
1149 |
|
&& sequenceRef.getDatasetSequence() != sequenceI) |
1150 |
|
&& (!rIsDs && !tIsDs |
1151 |
|
&& sequenceRef.getDatasetSequence() != sequenceI |
1152 |
|
.getDatasetSequence()) |
1153 |
|
&& !sequenceRef.equals(sequenceI)) |
1154 |
|
{ |
1155 |
|
|
1156 |
|
|
1157 |
0 |
sequenceRef = null; |
1158 |
0 |
if (sequenceMapping != null) |
1159 |
|
{ |
1160 |
0 |
sequenceMapping = null; |
1161 |
|
|
1162 |
|
} |
1163 |
0 |
createSequenceMapping(sequenceI, 1, true); |
1164 |
0 |
adjustForAlignment(); |
1165 |
|
} |
1166 |
|
else |
1167 |
|
{ |
1168 |
|
|
1169 |
1491 |
sequenceRef = sequenceI; |
1170 |
|
} |
1171 |
|
} |
1172 |
|
else |
1173 |
|
{ |
1174 |
|
|
1175 |
1072 |
createSequenceMapping(sequenceI, 1, true); |
1176 |
1072 |
adjustForAlignment(); |
1177 |
|
} |
1178 |
|
} |
1179 |
|
else |
1180 |
|
{ |
1181 |
|
|
1182 |
63 |
sequenceMapping = null; |
1183 |
63 |
sequenceRef = null; |
1184 |
|
} |
1185 |
|
} |
1186 |
|
|
1187 |
|
|
1188 |
|
@return |
1189 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1190 |
156 |
public double getScore()... |
1191 |
|
{ |
1192 |
156 |
return score; |
1193 |
|
} |
1194 |
|
|
1195 |
|
|
1196 |
|
@param |
1197 |
|
|
1198 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1199 |
34591 |
public void setScore(double score)... |
1200 |
|
{ |
1201 |
34591 |
hasScore = true; |
1202 |
34591 |
this.score = score; |
1203 |
|
} |
1204 |
|
|
1205 |
|
|
1206 |
|
|
1207 |
|
@return |
1208 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1209 |
837 |
public boolean hasScore()... |
1210 |
|
{ |
1211 |
837 |
return hasScore || !Double.isNaN(score); |
1212 |
|
} |
1213 |
|
|
1214 |
|
|
1215 |
|
|
1216 |
|
|
1217 |
|
@param |
1218 |
|
@param |
1219 |
|
@param |
1220 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1221 |
33442 |
public AlignmentAnnotation(String label, String description, double score)... |
1222 |
|
{ |
1223 |
33442 |
this(label, description, null); |
1224 |
33442 |
setScore(score); |
1225 |
|
} |
1226 |
|
|
1227 |
|
|
1228 |
|
|
1229 |
|
|
1230 |
|
@param |
1231 |
|
@param |
1232 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
1233 |
0 |
public AlignmentAnnotation(AlignmentAnnotation alignmentAnnotation,... |
1234 |
|
HiddenColumns hidden) |
1235 |
|
{ |
1236 |
0 |
this(alignmentAnnotation); |
1237 |
0 |
if (annotations == null) |
1238 |
|
{ |
1239 |
0 |
return; |
1240 |
|
} |
1241 |
0 |
makeVisibleAnnotation(hidden); |
1242 |
|
} |
1243 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 6 |
Complexity Density: 0.75 |
|
1244 |
0 |
public void setPadGaps(boolean padgaps, char gapchar)... |
1245 |
|
{ |
1246 |
0 |
this.padGaps = padgaps; |
1247 |
0 |
if (padgaps) |
1248 |
|
{ |
1249 |
0 |
hasText = true; |
1250 |
0 |
for (int i = 0; i < annotations.length; i++) |
1251 |
|
{ |
1252 |
0 |
if (annotations[i] == null) |
1253 |
|
{ |
1254 |
0 |
annotations[i] = new Annotation(String.valueOf(gapchar), null, |
1255 |
|
' ', 0f, null); |
1256 |
|
} |
1257 |
0 |
else if (annotations[i].displayCharacter == null |
1258 |
|
|| annotations[i].displayCharacter.equals(" ")) |
1259 |
|
{ |
1260 |
0 |
annotations[i].displayCharacter = String.valueOf(gapchar); |
1261 |
|
} |
1262 |
|
} |
1263 |
|
} |
1264 |
|
} |
1265 |
|
|
1266 |
|
|
1267 |
|
|
1268 |
|
|
1269 |
|
@param |
1270 |
|
@return |
1271 |
|
|
1272 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
1273 |
10 |
public String getDescription(boolean seqname)... |
1274 |
|
{ |
1275 |
10 |
if (seqname && this.sequenceRef != null) |
1276 |
|
{ |
1277 |
3 |
int i = description.toLowerCase(Locale.ROOT).indexOf("<html>"); |
1278 |
3 |
if (i > -1) |
1279 |
|
{ |
1280 |
|
|
1281 |
1 |
return "<html>" + sequenceRef.getName() + " : " |
1282 |
|
+ description.substring(i + 6); |
1283 |
|
} |
1284 |
2 |
return sequenceRef.getName() + " : " + description; |
1285 |
|
} |
1286 |
7 |
return description; |
1287 |
|
} |
1288 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1289 |
230 |
public boolean isValidStruc()... |
1290 |
|
{ |
1291 |
230 |
return invalidrnastruc == -1; |
1292 |
|
} |
1293 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1294 |
1068584 |
public long getInvalidStrucPos()... |
1295 |
|
{ |
1296 |
1068585 |
return invalidrnastruc; |
1297 |
|
} |
1298 |
|
|
1299 |
|
|
1300 |
|
|
1301 |
|
|
1302 |
|
protected String calcId = ""; |
1303 |
|
|
1304 |
|
|
1305 |
|
|
1306 |
|
|
1307 |
|
protected Map<String, String> properties = new HashMap<>(); |
1308 |
|
|
1309 |
|
|
1310 |
|
|
1311 |
|
|
1312 |
|
|
1313 |
|
public java.awt.Color _linecolour; |
1314 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1315 |
12884 |
public String getCalcId()... |
1316 |
|
{ |
1317 |
12884 |
return calcId; |
1318 |
|
} |
1319 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1320 |
1304 |
public void setCalcId(String calcId)... |
1321 |
|
{ |
1322 |
1304 |
this.calcId = calcId; |
1323 |
|
} |
1324 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1325 |
13288 |
public boolean isRNA()... |
1326 |
|
{ |
1327 |
13288 |
return isrna; |
1328 |
|
} |
1329 |
|
|
1330 |
|
|
1331 |
|
|
1332 |
|
|
1333 |
|
|
1334 |
|
@param |
1335 |
|
@param |
1336 |
|
|
1337 |
|
|
|
|
| 80% |
Uncovered Elements: 5 (25) |
Complexity: 8 |
Complexity Density: 0.62 |
|
1338 |
183 |
public void liftOver(SequenceI sq, Mapping sp2sq)... |
1339 |
|
{ |
1340 |
183 |
if (sp2sq.getMappedWidth() != sp2sq.getWidth()) |
1341 |
|
{ |
1342 |
|
|
1343 |
|
|
1344 |
0 |
throw new Error( |
1345 |
|
"liftOver currently not implemented for transfer of annotation between different types of seqeunce"); |
1346 |
|
} |
1347 |
183 |
boolean mapIsTo = (sp2sq != null) |
1348 |
|
? (sp2sq.getTo() == sq |
1349 |
|
|| sp2sq.getTo() == sq.getDatasetSequence()) |
1350 |
|
: false; |
1351 |
|
|
1352 |
|
|
1353 |
183 |
Map<Integer, Annotation> mapForsq = new HashMap<>(); |
1354 |
183 |
if (sequenceMapping != null) |
1355 |
|
{ |
1356 |
183 |
if (sp2sq != null) |
1357 |
|
{ |
1358 |
183 |
for (Entry<Integer, Annotation> ie : sequenceMapping.entrySet()) |
1359 |
|
{ |
1360 |
16336 |
Integer mpos = Integer |
1361 |
16336 |
.valueOf(mapIsTo ? sp2sq.getMappedPosition(ie.getKey()) |
1362 |
|
: sp2sq.getPosition(ie.getKey())); |
1363 |
16336 |
if (mpos >= sq.getStart() && mpos <= sq.getEnd()) |
1364 |
|
{ |
1365 |
16328 |
mapForsq.put(mpos, ie.getValue()); |
1366 |
|
} |
1367 |
|
} |
1368 |
183 |
sequenceMapping = mapForsq; |
1369 |
183 |
sequenceRef = sq; |
1370 |
183 |
adjustForAlignment(); |
1371 |
|
} |
1372 |
|
else |
1373 |
|
{ |
1374 |
|
|
1375 |
|
} |
1376 |
|
} |
1377 |
|
} |
1378 |
|
|
1379 |
|
|
1380 |
|
|
1381 |
|
|
1382 |
|
|
1383 |
|
|
1384 |
|
|
1385 |
|
@param |
1386 |
|
|
1387 |
|
|
1388 |
|
@param |
1389 |
|
|
1390 |
|
@param |
1391 |
|
|
1392 |
|
@param |
1393 |
|
|
1394 |
|
@param |
1395 |
|
|
1396 |
|
|
1397 |
|
|
1398 |
|
|
1399 |
|
|
|
|
| 0% |
Uncovered Elements: 38 (38) |
Complexity: 11 |
Complexity Density: 0.5 |
|
1400 |
0 |
public void remap(SequenceI newref, HashMap<Integer, int[]> mapping,... |
1401 |
|
int from, int to, int idxoffset) |
1402 |
|
{ |
1403 |
0 |
if (mapping != null) |
1404 |
|
{ |
1405 |
0 |
Map<Integer, Annotation> old = sequenceMapping; |
1406 |
0 |
Map<Integer, Annotation> remap = new HashMap<>(); |
1407 |
0 |
int index = -1; |
1408 |
0 |
for (int mp[] : mapping.values()) |
1409 |
|
{ |
1410 |
0 |
if (index++ < 0) |
1411 |
|
{ |
1412 |
0 |
continue; |
1413 |
|
} |
1414 |
0 |
Annotation ann = null; |
1415 |
0 |
if (from == -1) |
1416 |
|
{ |
1417 |
0 |
ann = sequenceMapping.get(Integer.valueOf(idxoffset + index)); |
1418 |
|
} |
1419 |
|
else |
1420 |
|
{ |
1421 |
0 |
if (mp != null && mp.length > from) |
1422 |
|
{ |
1423 |
0 |
ann = sequenceMapping.get(Integer.valueOf(mp[from])); |
1424 |
|
} |
1425 |
|
} |
1426 |
0 |
if (ann != null) |
1427 |
|
{ |
1428 |
0 |
if (to == -1) |
1429 |
|
{ |
1430 |
0 |
remap.put(Integer.valueOf(idxoffset + index), ann); |
1431 |
|
} |
1432 |
|
else |
1433 |
|
{ |
1434 |
0 |
if (to > -1 && to < mp.length) |
1435 |
|
{ |
1436 |
0 |
remap.put(Integer.valueOf(mp[to]), ann); |
1437 |
|
} |
1438 |
|
} |
1439 |
|
} |
1440 |
|
} |
1441 |
0 |
sequenceMapping = remap; |
1442 |
0 |
old.clear(); |
1443 |
0 |
if (newref != null) |
1444 |
|
{ |
1445 |
0 |
sequenceRef = newref; |
1446 |
|
} |
1447 |
0 |
adjustForAlignment(); |
1448 |
|
} |
1449 |
|
} |
1450 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1451 |
146 |
public String getProperty(String property)... |
1452 |
|
{ |
1453 |
146 |
if (properties == null) |
1454 |
|
{ |
1455 |
0 |
return null; |
1456 |
|
} |
1457 |
146 |
return properties.get(property); |
1458 |
|
} |
1459 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1460 |
49 |
public void setProperty(String property, String value)... |
1461 |
|
{ |
1462 |
49 |
if (properties == null) |
1463 |
|
{ |
1464 |
0 |
properties = new HashMap<>(); |
1465 |
|
} |
1466 |
49 |
properties.put(property, value); |
1467 |
|
} |
1468 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1469 |
441 |
public boolean hasProperties()... |
1470 |
|
{ |
1471 |
441 |
return properties != null && properties.size() > 0; |
1472 |
|
} |
1473 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1474 |
1 |
public Collection<String> getProperties()... |
1475 |
|
{ |
1476 |
1 |
if (properties == null) |
1477 |
|
{ |
1478 |
0 |
return Collections.emptyList(); |
1479 |
|
} |
1480 |
1 |
return properties.keySet(); |
1481 |
|
} |
1482 |
|
|
1483 |
|
|
1484 |
|
|
1485 |
|
|
1486 |
|
|
1487 |
|
@param |
1488 |
|
@return |
1489 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
1490 |
27 |
public Annotation getAnnotationForPosition(int position)... |
1491 |
|
{ |
1492 |
27 |
return sequenceMapping == null ? null : sequenceMapping.get(position); |
1493 |
|
|
1494 |
|
} |
1495 |
|
|
1496 |
|
|
1497 |
|
|
1498 |
|
|
1499 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1500 |
38033 |
protected final void setAnnotationId()... |
1501 |
|
{ |
1502 |
38033 |
this.annotationId = ANNOTATION_ID_PREFIX + Long.toString(nextId()); |
1503 |
|
} |
1504 |
|
|
1505 |
|
|
1506 |
|
|
1507 |
|
|
1508 |
|
|
1509 |
|
@param |
1510 |
|
@return |
1511 |
|
|
|
|
| 91.3% |
Uncovered Elements: 4 (46) |
Complexity: 12 |
Complexity Density: 0.46 |
|
1512 |
43 |
public String getDefaultRnaHelixSymbol(int column)... |
1513 |
|
{ |
1514 |
43 |
String result = "("; |
1515 |
43 |
if (annotations == null) |
1516 |
|
{ |
1517 |
1 |
return result; |
1518 |
|
} |
1519 |
|
|
1520 |
|
|
1521 |
|
|
1522 |
|
|
1523 |
|
|
1524 |
|
|
1525 |
150 |
for (int col = column - 1; col >= 0; col--) |
1526 |
|
{ |
1527 |
142 |
Annotation annotation = annotations[col]; |
1528 |
142 |
if (annotation == null) |
1529 |
|
{ |
1530 |
66 |
continue; |
1531 |
|
} |
1532 |
76 |
String displayed = annotation.displayCharacter; |
1533 |
76 |
if (displayed == null || displayed.length() != 1) |
1534 |
|
{ |
1535 |
0 |
continue; |
1536 |
|
} |
1537 |
76 |
char symbol = displayed.charAt(0); |
1538 |
76 |
if (!Rna.isOpeningParenthesis(symbol)) |
1539 |
|
{ |
1540 |
24 |
continue; |
1541 |
|
} |
1542 |
|
|
1543 |
|
|
1544 |
|
|
1545 |
|
|
1546 |
|
|
1547 |
|
|
1548 |
|
|
1549 |
52 |
String closer = String |
1550 |
|
.valueOf(Rna.getMatchingClosingParenthesis(symbol)); |
1551 |
52 |
String opener = String.valueOf(symbol); |
1552 |
52 |
int count = 0; |
1553 |
256 |
for (int j = col + 1; j < column; j++) |
1554 |
|
{ |
1555 |
204 |
if (annotations[j] != null) |
1556 |
|
{ |
1557 |
90 |
String s = annotations[j].displayCharacter; |
1558 |
90 |
if (closer.equals(s)) |
1559 |
|
{ |
1560 |
18 |
count++; |
1561 |
|
} |
1562 |
72 |
else if (opener.equals(s)) |
1563 |
|
{ |
1564 |
0 |
count--; |
1565 |
|
} |
1566 |
|
} |
1567 |
|
} |
1568 |
52 |
if (count < 1) |
1569 |
|
{ |
1570 |
34 |
return closer; |
1571 |
|
} |
1572 |
|
} |
1573 |
8 |
return result; |
1574 |
|
} |
1575 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1576 |
38033 |
protected static synchronized long nextId()... |
1577 |
|
{ |
1578 |
38033 |
return counter++; |
1579 |
|
} |
1580 |
|
|
1581 |
|
|
1582 |
|
|
1583 |
|
@return |
1584 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1585 |
5 |
public boolean isQuantitative()... |
1586 |
|
{ |
1587 |
5 |
return graphMin < graphMax; |
1588 |
|
} |
1589 |
|
|
1590 |
|
|
1591 |
|
@return |
1592 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1593 |
76079 |
public boolean isForDisplay()... |
1594 |
|
{ |
1595 |
76079 |
return hasData && visible; |
1596 |
|
} |
1597 |
|
|
1598 |
|
|
1599 |
|
|
1600 |
|
|
1601 |
|
|
1602 |
|
@param |
1603 |
|
|
1604 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
1605 |
2 |
public void makeVisibleAnnotation(HiddenColumns hiddenColumns)... |
1606 |
|
{ |
1607 |
2 |
if (annotations != null) |
1608 |
|
{ |
1609 |
1 |
makeVisibleAnnotation(0, annotations.length, hiddenColumns); |
1610 |
|
} |
1611 |
|
} |
1612 |
|
|
1613 |
|
|
1614 |
|
|
1615 |
|
|
1616 |
|
|
1617 |
|
@param |
1618 |
|
|
1619 |
|
@param |
1620 |
|
|
1621 |
|
@param |
1622 |
|
|
1623 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
1624 |
10 |
public void makeVisibleAnnotation(int start, int end,... |
1625 |
|
HiddenColumns hiddenColumns) |
1626 |
|
{ |
1627 |
10 |
if (annotations != null) |
1628 |
|
{ |
1629 |
9 |
if (hiddenColumns.hasHiddenColumns()) |
1630 |
|
{ |
1631 |
3 |
removeHiddenAnnotation(start, end, hiddenColumns); |
1632 |
|
} |
1633 |
|
else |
1634 |
|
{ |
1635 |
6 |
restrict(start, end); |
1636 |
|
} |
1637 |
|
} |
1638 |
|
} |
1639 |
|
|
1640 |
|
|
1641 |
|
|
1642 |
|
|
1643 |
|
@param |
1644 |
|
|
1645 |
|
@param |
1646 |
|
|
1647 |
|
@param |
1648 |
|
|
1649 |
|
|
|
|
| 96.9% |
Uncovered Elements: 1 (32) |
Complexity: 5 |
Complexity Density: 0.21 |
|
1650 |
3 |
private void removeHiddenAnnotation(int start, int end,... |
1651 |
|
HiddenColumns hiddenColumns) |
1652 |
|
{ |
1653 |
|
|
1654 |
3 |
ArrayList<Annotation[]> annels = new ArrayList<>(); |
1655 |
3 |
Annotation[] els = null; |
1656 |
|
|
1657 |
3 |
int w = 0; |
1658 |
|
|
1659 |
3 |
Iterator<int[]> blocks = hiddenColumns.getVisContigsIterator(start, |
1660 |
|
end + 1, false); |
1661 |
|
|
1662 |
3 |
int copylength; |
1663 |
3 |
int annotationLength; |
1664 |
9 |
while (blocks.hasNext()) |
1665 |
|
{ |
1666 |
6 |
int[] block = blocks.next(); |
1667 |
6 |
annotationLength = block[1] - block[0] + 1; |
1668 |
|
|
1669 |
6 |
if (blocks.hasNext()) |
1670 |
|
{ |
1671 |
|
|
1672 |
3 |
copylength = annotationLength; |
1673 |
|
} |
1674 |
|
else |
1675 |
|
{ |
1676 |
3 |
if (annotationLength + block[0] <= annotations.length) |
1677 |
|
{ |
1678 |
|
|
1679 |
2 |
copylength = annotationLength; |
1680 |
|
} |
1681 |
|
else |
1682 |
|
{ |
1683 |
|
|
1684 |
1 |
copylength = annotations.length - block[0]; |
1685 |
|
} |
1686 |
|
} |
1687 |
|
|
1688 |
6 |
els = new Annotation[annotationLength]; |
1689 |
6 |
annels.add(els); |
1690 |
6 |
System.arraycopy(annotations, block[0], els, 0, copylength); |
1691 |
6 |
w += annotationLength; |
1692 |
|
} |
1693 |
|
|
1694 |
3 |
if (w != 0) |
1695 |
|
{ |
1696 |
3 |
annotations = new Annotation[w]; |
1697 |
|
|
1698 |
3 |
w = 0; |
1699 |
3 |
for (Annotation[] chnk : annels) |
1700 |
|
{ |
1701 |
6 |
System.arraycopy(chnk, 0, annotations, w, chnk.length); |
1702 |
6 |
w += chnk.length; |
1703 |
|
} |
1704 |
|
} |
1705 |
|
} |
1706 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 10 |
Complexity Density: 2 |
|
1707 |
163 |
public static Iterable<AlignmentAnnotation> findAnnotations(... |
1708 |
|
Iterable<AlignmentAnnotation> list, SequenceI seq, String calcId, |
1709 |
|
String label) |
1710 |
|
{ |
1711 |
|
|
1712 |
163 |
ArrayList<AlignmentAnnotation> aa = new ArrayList<>(); |
1713 |
163 |
for (AlignmentAnnotation ann : list) |
1714 |
|
{ |
1715 |
1129 |
if ((calcId == null || (ann.getCalcId() != null |
1716 |
|
&& ann.getCalcId().equals(calcId))) |
1717 |
|
&& (seq == null || (ann.sequenceRef != null |
1718 |
|
&& ann.sequenceRef == seq)) |
1719 |
|
&& (label == null |
1720 |
|
|| (ann.label != null && ann.label.equals(label)))) |
1721 |
|
{ |
1722 |
182 |
aa.add(ann); |
1723 |
|
} |
1724 |
|
} |
1725 |
163 |
return aa; |
1726 |
|
} |
1727 |
|
|
1728 |
|
|
1729 |
|
|
1730 |
|
|
1731 |
|
@param |
1732 |
|
|
1733 |
|
@param |
1734 |
|
@return |
1735 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 4 |
Complexity Density: 0.8 |
|
1736 |
0 |
public static boolean hasAnnotation(List<AlignmentAnnotation> list,... |
1737 |
|
String calcId) |
1738 |
|
{ |
1739 |
|
|
1740 |
0 |
if (calcId != null && !"".equals(calcId)) |
1741 |
|
{ |
1742 |
0 |
for (AlignmentAnnotation a : list) |
1743 |
|
{ |
1744 |
0 |
if (a.getCalcId() == calcId) |
1745 |
|
{ |
1746 |
0 |
return true; |
1747 |
|
} |
1748 |
|
} |
1749 |
|
} |
1750 |
0 |
return false; |
1751 |
|
} |
1752 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 6 |
Complexity Density: 0.86 |
|
1753 |
489 |
public static Iterable<AlignmentAnnotation> findAnnotation(... |
1754 |
|
List<AlignmentAnnotation> list, String calcId) |
1755 |
|
{ |
1756 |
|
|
1757 |
489 |
List<AlignmentAnnotation> aa = new ArrayList<>(); |
1758 |
489 |
if (calcId == null) |
1759 |
|
{ |
1760 |
1 |
return aa; |
1761 |
|
} |
1762 |
488 |
for (AlignmentAnnotation a : list) |
1763 |
|
{ |
1764 |
|
|
1765 |
2570 |
if (a.getCalcId() == calcId || (a.getCalcId() != null |
1766 |
|
&& calcId != null && a.getCalcId().equals(calcId))) |
1767 |
|
{ |
1768 |
509 |
aa.add(a); |
1769 |
|
} |
1770 |
|
} |
1771 |
488 |
return aa; |
1772 |
|
} |
1773 |
|
|
1774 |
|
|
1775 |
|
|
1776 |
|
|
1777 |
|
|
1778 |
|
@return |
1779 |
|
|
1780 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1781 |
140 |
public boolean isShowGroupsForContactMatrix()... |
1782 |
|
{ |
1783 |
140 |
return getProperty(AlignmentAnnotation.CONTACT_MAP_NOGROUPS) == null |
1784 |
|
|| "".equals( |
1785 |
|
getProperty(AlignmentAnnotation.CONTACT_MAP_NOGROUPS)); |
1786 |
|
} |
1787 |
|
|
1788 |
|
|
1789 |
|
|
1790 |
|
|
1791 |
|
@see |
1792 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
1793 |
2 |
public void setShowGroupsForContactMatrix(boolean showGroups)... |
1794 |
|
{ |
1795 |
2 |
setProperty(AlignmentAnnotation.CONTACT_MAP_NOGROUPS, |
1796 |
2 |
showGroups ? "" : "nogroups"); |
1797 |
|
} |
1798 |
|
|
1799 |
|
} |