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