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.awt.Color; |
24 |
|
import java.beans.PropertyChangeListener; |
25 |
|
import java.beans.PropertyChangeSupport; |
26 |
|
import java.util.ArrayList; |
27 |
|
import java.util.Arrays; |
28 |
|
import java.util.Collection; |
29 |
|
import java.util.List; |
30 |
|
import java.util.Map; |
31 |
|
|
32 |
|
import jalview.analysis.AAFrequency; |
33 |
|
import jalview.analysis.Conservation; |
34 |
|
import jalview.renderer.ResidueShader; |
35 |
|
import jalview.renderer.ResidueShaderI; |
36 |
|
import jalview.schemes.ColourSchemeI; |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
@author |
42 |
|
@version |
43 |
|
|
|
|
| 57.6% |
Uncovered Elements: 280 (661) |
Complexity: 203 |
Complexity Density: 0.52 |
|
44 |
|
public class SequenceGroup implements AnnotatedCollectionI |
45 |
|
{ |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
public static final String SEQ_GROUP_CHANGED = "Sequence group changed"; |
51 |
|
|
52 |
|
protected PropertyChangeSupport changeSupport = new PropertyChangeSupport( |
53 |
|
this); |
54 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
55 |
0 |
public void addPropertyChangeListener(PropertyChangeListener listener)... |
56 |
|
{ |
57 |
0 |
changeSupport.addPropertyChangeListener(listener); |
58 |
|
} |
59 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
60 |
0 |
public void removePropertyChangeListener(PropertyChangeListener listener)... |
61 |
|
{ |
62 |
0 |
changeSupport.removePropertyChangeListener(listener); |
63 |
|
} |
64 |
|
|
65 |
|
|
66 |
|
String groupName; |
67 |
|
|
68 |
|
String description; |
69 |
|
|
70 |
|
Conservation conserve; |
71 |
|
|
72 |
|
boolean displayBoxes = true; |
73 |
|
|
74 |
|
boolean displayText = true; |
75 |
|
|
76 |
|
boolean colourText = false; |
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
boolean isDefined = false; |
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
boolean showNonconserved = false; |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
private List<SequenceI> sequences; |
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
private SequenceI seqrep = null; |
98 |
|
|
99 |
|
int width = -1; |
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
public ResidueShaderI cs; |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
private int startRes = 0; |
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
private int endRes = 0; |
115 |
|
|
116 |
|
public Color outlineColour = Color.black; |
117 |
|
|
118 |
|
public Color idColour = null; |
119 |
|
|
120 |
|
public int thresholdTextColour = 0; |
121 |
|
|
122 |
|
public Color textColour = Color.black; |
123 |
|
|
124 |
|
public Color textColour2 = Color.white; |
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
private boolean ignoreGapsInConsensus = true; |
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
private boolean showSequenceLogo = false; |
135 |
|
|
136 |
|
private boolean showSequenceSSLogo = false; |
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
private boolean normaliseSequenceLogo; |
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
private boolean hidereps = false; |
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
|
151 |
|
private boolean hidecols = false; |
152 |
|
|
153 |
|
AlignmentAnnotation consensus = null; |
154 |
|
|
155 |
|
AlignmentAnnotation ssConsensus = null; |
156 |
|
|
157 |
|
AlignmentAnnotation conservation = null; |
158 |
|
|
159 |
|
private boolean showConsensusHistogram; |
160 |
|
|
161 |
|
private boolean showSSConsensusHistogram; |
162 |
|
|
163 |
|
private AnnotatedCollectionI context; |
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
168 |
977 |
public SequenceGroup()... |
169 |
|
{ |
170 |
977 |
groupName = "JGroup:" + this.hashCode(); |
171 |
977 |
cs = new ResidueShader(); |
172 |
977 |
sequences = new ArrayList<>(); |
173 |
|
} |
174 |
|
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
|
@param |
179 |
|
@param |
180 |
|
@param |
181 |
|
@param |
182 |
|
@param |
183 |
|
@param |
184 |
|
@param |
185 |
|
|
186 |
|
@param |
187 |
|
|
188 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
|
189 |
79 |
public SequenceGroup(List<SequenceI> sequences, String groupName,... |
190 |
|
ColourSchemeI scheme, boolean displayBoxes, boolean displayText, |
191 |
|
boolean colourText, int start, int end) |
192 |
|
{ |
193 |
79 |
this(); |
194 |
79 |
this.sequences = sequences; |
195 |
79 |
this.groupName = groupName; |
196 |
79 |
this.displayBoxes = displayBoxes; |
197 |
79 |
this.displayText = displayText; |
198 |
79 |
this.colourText = colourText; |
199 |
79 |
this.cs = new ResidueShader(scheme); |
200 |
79 |
startRes = start; |
201 |
79 |
endRes = end; |
202 |
79 |
recalcConservation(); |
203 |
|
} |
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
@param |
209 |
|
|
|
|
| 92.3% |
Uncovered Elements: 3 (39) |
Complexity: 5 |
Complexity Density: 0.16 |
|
210 |
113 |
public SequenceGroup(SequenceGroup seqsel)... |
211 |
|
{ |
212 |
113 |
this(); |
213 |
113 |
if (seqsel != null) |
214 |
|
{ |
215 |
105 |
sequences = new ArrayList<>(); |
216 |
105 |
sequences.addAll(seqsel.sequences); |
217 |
105 |
if (seqsel.groupName != null) |
218 |
|
{ |
219 |
105 |
groupName = new String(seqsel.groupName); |
220 |
|
} |
221 |
105 |
displayBoxes = seqsel.displayBoxes; |
222 |
105 |
displayText = seqsel.displayText; |
223 |
105 |
colourText = seqsel.colourText; |
224 |
|
|
225 |
105 |
startRes = seqsel.startRes; |
226 |
105 |
endRes = seqsel.endRes; |
227 |
105 |
cs = new ResidueShader((ResidueShader) seqsel.cs); |
228 |
105 |
if (seqsel.description != null) |
229 |
|
{ |
230 |
1 |
description = new String(seqsel.description); |
231 |
|
} |
232 |
105 |
hidecols = seqsel.hidecols; |
233 |
105 |
hidereps = seqsel.hidereps; |
234 |
105 |
showNonconserved = seqsel.showNonconserved; |
235 |
105 |
showSequenceLogo = seqsel.showSequenceLogo; |
236 |
105 |
normaliseSequenceLogo = seqsel.normaliseSequenceLogo; |
237 |
105 |
showConsensusHistogram = seqsel.showConsensusHistogram; |
238 |
105 |
showSSConsensusHistogram = seqsel.showSSConsensusHistogram; |
239 |
105 |
idColour = seqsel.idColour; |
240 |
105 |
outlineColour = seqsel.outlineColour; |
241 |
105 |
seqrep = seqsel.seqrep; |
242 |
105 |
textColour = seqsel.textColour; |
243 |
105 |
textColour2 = seqsel.textColour2; |
244 |
105 |
thresholdTextColour = seqsel.thresholdTextColour; |
245 |
105 |
width = seqsel.width; |
246 |
105 |
ignoreGapsInConsensus = seqsel.ignoreGapsInConsensus; |
247 |
105 |
if (seqsel.conserve != null) |
248 |
|
{ |
249 |
0 |
recalcConservation(); |
250 |
|
|
251 |
|
} |
252 |
|
} |
253 |
|
} |
254 |
|
|
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
@param |
259 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
260 |
11 |
public SequenceGroup(List<SequenceI> seqs)... |
261 |
|
{ |
262 |
11 |
this(); |
263 |
11 |
this.sequences.addAll(seqs); |
264 |
|
} |
265 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
266 |
26579 |
public boolean isShowSequenceLogo()... |
267 |
|
{ |
268 |
26579 |
return showSequenceLogo; |
269 |
|
} |
270 |
|
|
|
|
| 77.8% |
Uncovered Elements: 12 (54) |
Complexity: 11 |
Complexity Density: 0.32 |
|
271 |
2 |
public SequenceI[] getSelectionAsNewSequences(AlignmentI align)... |
272 |
|
{ |
273 |
2 |
int iSize = sequences.size(); |
274 |
2 |
SequenceI[] seqs = new SequenceI[iSize]; |
275 |
2 |
SequenceI[] inorder = getSequencesInOrder(align); |
276 |
|
|
277 |
18 |
for (int i = 0, ipos = 0; i < inorder.length; i++) |
278 |
|
{ |
279 |
16 |
SequenceI seq = inorder[i]; |
280 |
16 |
SequenceI seqipos = seqs[ipos] = seq.getSubSequence(startRes, |
281 |
|
endRes + 1); |
282 |
16 |
if (seqipos != null) |
283 |
|
{ |
284 |
16 |
if (seq.getAnnotation() != null) |
285 |
|
{ |
286 |
1 |
AlignmentAnnotation[] alann = align.getAlignmentAnnotation(); |
287 |
|
|
288 |
|
|
289 |
2 |
for (int a = 0; a < seq.getAnnotation().length; a++) |
290 |
|
{ |
291 |
1 |
AlignmentAnnotation tocopy = seq.getAnnotation()[a]; |
292 |
1 |
if (alann != null) |
293 |
|
{ |
294 |
1 |
boolean found = false; |
295 |
1 |
for (int pos = 0, np = alann.length; pos < np; pos++) |
296 |
|
{ |
297 |
1 |
if (alann[pos] == tocopy) |
298 |
|
{ |
299 |
1 |
found = true; |
300 |
1 |
break; |
301 |
|
} |
302 |
|
} |
303 |
1 |
if (!found) |
304 |
|
{ |
305 |
0 |
continue; |
306 |
|
} |
307 |
|
} |
308 |
1 |
AlignmentAnnotation newannot = new AlignmentAnnotation( |
309 |
|
seq.getAnnotation()[a]); |
310 |
1 |
newannot.restrict(startRes, endRes); |
311 |
1 |
newannot.setSequenceRef(seqs[ipos]); |
312 |
1 |
newannot.adjustForAlignment(); |
313 |
1 |
ContactMatrixI cm = seq |
314 |
|
.getContactMatrixFor(seq.getAnnotation()[a]); |
315 |
1 |
if (cm != null) |
316 |
|
{ |
317 |
1 |
seqs[ipos].addContactListFor(newannot, cm); |
318 |
|
} |
319 |
1 |
seqipos.addAlignmentAnnotation(newannot); |
320 |
|
} |
321 |
|
} |
322 |
16 |
ipos++; |
323 |
|
} |
324 |
|
else |
325 |
|
{ |
326 |
0 |
iSize--; |
327 |
|
} |
328 |
|
} |
329 |
2 |
if (iSize != inorder.length) |
330 |
|
{ |
331 |
0 |
SequenceI[] nseqs = new SequenceI[iSize]; |
332 |
0 |
System.arraycopy(seqs, 0, nseqs, 0, iSize); |
333 |
0 |
seqs = nseqs; |
334 |
|
} |
335 |
2 |
return seqs; |
336 |
|
|
337 |
|
} |
338 |
|
|
339 |
|
|
340 |
|
|
341 |
|
|
342 |
|
@param |
343 |
|
|
344 |
|
@return |
345 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 5 |
Complexity Density: 0.56 |
|
346 |
0 |
public int findEndRes(SequenceI seq)... |
347 |
|
{ |
348 |
0 |
int eres = 0; |
349 |
0 |
char ch; |
350 |
|
|
351 |
0 |
for (int j = 0; j < endRes + 1 && j < seq.getLength(); j++) |
352 |
|
{ |
353 |
0 |
ch = seq.getCharAt(j); |
354 |
0 |
if (!jalview.util.Comparison.isGap((ch))) |
355 |
|
{ |
356 |
0 |
eres++; |
357 |
|
} |
358 |
|
} |
359 |
|
|
360 |
0 |
if (eres > 0) |
361 |
|
{ |
362 |
0 |
eres += seq.getStart() - 1; |
363 |
|
} |
364 |
|
|
365 |
0 |
return eres; |
366 |
|
} |
367 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
368 |
12532 |
@Override... |
369 |
|
public List<SequenceI> getSequences() |
370 |
|
{ |
371 |
12532 |
return sequences; |
372 |
|
} |
373 |
|
|
|
|
| 17.6% |
Uncovered Elements: 14 (17) |
Complexity: 5 |
Complexity Density: 0.45 |
|
374 |
1163 |
@Override... |
375 |
|
public List<SequenceI> getSequences( |
376 |
|
Map<SequenceI, SequenceCollectionI> hiddenReps) |
377 |
|
{ |
378 |
1163 |
if (hiddenReps == null) |
379 |
|
{ |
380 |
|
|
381 |
1163 |
return sequences; |
382 |
|
} |
383 |
|
else |
384 |
|
{ |
385 |
0 |
List<SequenceI> allSequences = new ArrayList<>(); |
386 |
0 |
for (SequenceI seq : sequences) |
387 |
|
{ |
388 |
0 |
allSequences.add(seq); |
389 |
0 |
if (hiddenReps.containsKey(seq)) |
390 |
|
{ |
391 |
0 |
SequenceCollectionI hsg = hiddenReps.get(seq); |
392 |
0 |
for (SequenceI seq2 : hsg.getSequences()) |
393 |
|
{ |
394 |
0 |
if (seq2 != seq && !allSequences.contains(seq2)) |
395 |
|
{ |
396 |
0 |
allSequences.add(seq2); |
397 |
|
} |
398 |
|
} |
399 |
|
} |
400 |
|
} |
401 |
|
|
402 |
0 |
return allSequences; |
403 |
|
} |
404 |
|
} |
405 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
406 |
5 |
public SequenceI[] getSequencesAsArray(... |
407 |
|
Map<SequenceI, SequenceCollectionI> map) |
408 |
|
{ |
409 |
5 |
List<SequenceI> tmp = getSequences(map); |
410 |
5 |
if (tmp == null) |
411 |
|
{ |
412 |
0 |
return null; |
413 |
|
} |
414 |
5 |
return tmp.toArray(new SequenceI[tmp.size()]); |
415 |
|
} |
416 |
|
|
417 |
|
|
418 |
|
|
419 |
|
|
420 |
|
@param |
421 |
|
|
422 |
|
|
423 |
|
@return |
424 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
425 |
0 |
public boolean adjustForRemoveLeft(int col)... |
426 |
|
{ |
427 |
|
|
428 |
0 |
if (startRes >= col) |
429 |
|
{ |
430 |
0 |
startRes = startRes - col; |
431 |
|
} |
432 |
|
|
433 |
0 |
if (endRes >= col) |
434 |
|
{ |
435 |
0 |
endRes = endRes - col; |
436 |
|
|
437 |
0 |
if (startRes > endRes) |
438 |
|
{ |
439 |
0 |
startRes = 0; |
440 |
|
} |
441 |
|
} |
442 |
|
else |
443 |
|
{ |
444 |
|
|
445 |
0 |
return false; |
446 |
|
} |
447 |
|
|
448 |
0 |
return true; |
449 |
|
} |
450 |
|
|
451 |
|
|
452 |
|
|
453 |
|
|
454 |
|
@param |
455 |
|
|
456 |
|
|
457 |
|
@return |
458 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
459 |
0 |
public boolean adjustForRemoveRight(int col)... |
460 |
|
{ |
461 |
0 |
if (startRes > col) |
462 |
|
{ |
463 |
|
|
464 |
0 |
return false; |
465 |
|
} |
466 |
|
|
467 |
0 |
if (endRes >= col) |
468 |
|
{ |
469 |
0 |
endRes = col; |
470 |
|
} |
471 |
|
|
472 |
0 |
return true; |
473 |
|
} |
474 |
|
|
475 |
|
|
476 |
|
|
477 |
|
|
478 |
|
@return |
479 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
480 |
247 |
public String getName()... |
481 |
|
{ |
482 |
247 |
return groupName; |
483 |
|
} |
484 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
485 |
16 |
public String getDescription()... |
486 |
|
{ |
487 |
16 |
return description; |
488 |
|
} |
489 |
|
|
490 |
|
|
491 |
|
|
492 |
|
|
493 |
|
@param |
494 |
|
|
495 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
496 |
23 |
public void setName(String name)... |
497 |
|
{ |
498 |
23 |
groupName = name; |
499 |
|
|
500 |
|
} |
501 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
502 |
20 |
public void setDescription(String desc)... |
503 |
|
{ |
504 |
20 |
description = desc; |
505 |
|
} |
506 |
|
|
507 |
|
|
508 |
|
|
509 |
|
|
510 |
|
@return |
511 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
512 |
0 |
public Conservation getConservation()... |
513 |
|
{ |
514 |
0 |
return conserve; |
515 |
|
} |
516 |
|
|
517 |
|
|
518 |
|
|
519 |
|
|
520 |
|
@param |
521 |
|
|
522 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
523 |
0 |
public void setConservation(Conservation c)... |
524 |
|
{ |
525 |
0 |
conserve = c; |
526 |
|
} |
527 |
|
|
528 |
|
|
529 |
|
|
530 |
|
|
531 |
|
|
532 |
|
|
533 |
|
@param |
534 |
|
|
535 |
|
@param |
536 |
|
|
537 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
538 |
623 |
public void addSequence(SequenceI s, boolean recalc)... |
539 |
|
{ |
540 |
623 |
synchronized (sequences) |
541 |
|
{ |
542 |
623 |
if (s != null && !sequences.contains(s)) |
543 |
|
{ |
544 |
612 |
sequences.add(s); |
545 |
612 |
changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, |
546 |
|
sequences.size() - 1, sequences.size()); |
547 |
|
} |
548 |
|
|
549 |
623 |
if (recalc) |
550 |
|
{ |
551 |
1 |
recalcConservation(); |
552 |
|
} |
553 |
|
} |
554 |
|
} |
555 |
|
|
556 |
|
|
557 |
|
|
558 |
|
|
559 |
|
private int consPercGaps = 25; |
560 |
|
|
561 |
|
|
562 |
|
@return |
563 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
564 |
0 |
public int getConsPercGaps()... |
565 |
|
{ |
566 |
0 |
return consPercGaps; |
567 |
|
} |
568 |
|
|
569 |
|
|
570 |
|
|
571 |
|
|
572 |
|
@param |
573 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
574 |
0 |
public void setConsPercGaps(int consPercGaps)... |
575 |
|
{ |
576 |
0 |
this.consPercGaps = consPercGaps; |
577 |
|
} |
578 |
|
|
579 |
|
|
580 |
|
|
581 |
|
|
582 |
|
|
583 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
584 |
381 |
public boolean recalcConservation()... |
585 |
|
{ |
586 |
381 |
return recalcConservation(false); |
587 |
|
} |
588 |
|
|
589 |
|
|
590 |
|
|
591 |
|
|
592 |
|
|
593 |
|
@param |
594 |
|
|
595 |
|
|
596 |
|
|
|
|
| 73.2% |
Uncovered Elements: 15 (56) |
Complexity: 18 |
Complexity Density: 0.53 |
|
597 |
381 |
public boolean recalcConservation(boolean defer)... |
598 |
|
{ |
599 |
381 |
if (cs == null && consensus == null && conservation == null) |
600 |
|
{ |
601 |
0 |
return false; |
602 |
|
} |
603 |
|
|
604 |
|
|
605 |
381 |
boolean upd = false; |
606 |
381 |
try |
607 |
|
{ |
608 |
381 |
ProfilesI cnsns = AAFrequency.calculate(sequences, startRes, |
609 |
|
endRes + 1, showSequenceLogo); |
610 |
381 |
if (consensus != null) |
611 |
|
{ |
612 |
120 |
_updateConsensusRow(cnsns, sequences.size()); |
613 |
120 |
upd = true; |
614 |
|
} |
615 |
381 |
if (cs != null) |
616 |
|
{ |
617 |
381 |
cs.setConsensus(cnsns); |
618 |
381 |
upd = true; |
619 |
|
} |
620 |
|
|
621 |
381 |
ProfilesI ssCnsns = AAFrequency.calculateSS(sequences, startRes, |
622 |
|
endRes + 1, showSequenceLogo); |
623 |
381 |
if (ssConsensus != null) |
624 |
|
{ |
625 |
0 |
_updateSSConsensusRow(ssCnsns, sequences.size()); |
626 |
0 |
upd = true; |
627 |
|
} |
628 |
381 |
if (cs != null) |
629 |
|
{ |
630 |
381 |
cs.setSsConsensus(ssCnsns); |
631 |
381 |
upd = true; |
632 |
|
} |
633 |
|
|
634 |
381 |
if ((conservation != null) |
635 |
|
|| (cs != null && cs.conservationApplied())) |
636 |
|
{ |
637 |
3 |
Conservation c = new Conservation(groupName, sequences, startRes, |
638 |
|
endRes + 1); |
639 |
3 |
c.calculate(); |
640 |
3 |
c.verdict(false, consPercGaps); |
641 |
3 |
if (conservation != null) |
642 |
|
{ |
643 |
0 |
_updateConservationRow(c); |
644 |
|
} |
645 |
3 |
if (cs != null) |
646 |
|
{ |
647 |
3 |
if (cs.conservationApplied()) |
648 |
|
{ |
649 |
3 |
cs.setConservation(c); |
650 |
|
} |
651 |
|
} |
652 |
|
|
653 |
3 |
upd = true; |
654 |
|
} |
655 |
381 |
if (cs != null && !defer) |
656 |
|
{ |
657 |
|
|
658 |
381 |
cs.alignmentChanged(context != null ? context : this, null); |
659 |
381 |
return true; |
660 |
|
} |
661 |
|
else |
662 |
|
{ |
663 |
0 |
return upd; |
664 |
|
} |
665 |
|
} catch (java.lang.OutOfMemoryError err) |
666 |
|
{ |
667 |
|
|
668 |
0 |
jalview.bin.Console |
669 |
|
.outPrintln("Out of memory loading groups: " + err); |
670 |
|
} |
671 |
0 |
return upd; |
672 |
|
} |
673 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
674 |
0 |
private void _updateConservationRow(Conservation c)... |
675 |
|
{ |
676 |
0 |
if (conservation == null) |
677 |
|
{ |
678 |
0 |
getConservation(); |
679 |
|
} |
680 |
|
|
681 |
0 |
conservation.label = "Conservation for " + getName(); |
682 |
0 |
conservation.description = "Conservation for group " + getName() |
683 |
|
+ " less than " + consPercGaps + "% gaps"; |
684 |
|
|
685 |
0 |
int aWidth = (conservation.annotations != null) |
686 |
0 |
? (endRes < conservation.annotations.length |
687 |
|
? conservation.annotations.length |
688 |
|
: endRes + 1) |
689 |
|
: endRes + 1; |
690 |
0 |
conservation.annotations = null; |
691 |
0 |
conservation.annotations = new Annotation[aWidth]; |
692 |
|
|
693 |
0 |
c.completeAnnotations(conservation, null, startRes, endRes + 1); |
694 |
|
} |
695 |
|
|
696 |
|
public ProfilesI consensusData = null; |
697 |
|
|
|
|
| 73.3% |
Uncovered Elements: 4 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
698 |
120 |
private void _updateConsensusRow(ProfilesI cnsns, long nseq)... |
699 |
|
{ |
700 |
120 |
if (consensus == null) |
701 |
|
{ |
702 |
0 |
getConsensus(); |
703 |
|
} |
704 |
120 |
consensus.label = "Consensus for " + getName(); |
705 |
120 |
consensus.description = "Percent Identity"; |
706 |
120 |
consensusData = cnsns; |
707 |
|
|
708 |
120 |
int aWidth = (consensus.annotations != null) |
709 |
120 |
? (endRes < consensus.annotations.length |
710 |
|
? consensus.annotations.length |
711 |
|
: endRes + 1) |
712 |
|
: endRes + 1; |
713 |
120 |
consensus.annotations = null; |
714 |
120 |
consensus.annotations = new Annotation[aWidth]; |
715 |
|
|
716 |
120 |
AAFrequency.completeConsensus(consensus, cnsns, startRes, endRes + 1, |
717 |
|
ignoreGapsInConsensus, showSequenceLogo, nseq); |
718 |
|
|
719 |
|
|
720 |
|
|
721 |
|
} |
722 |
|
|
723 |
|
public ProfilesI ssConsensusData = null; |
724 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
725 |
0 |
private void _updateSSConsensusRow(ProfilesI ssCnsns, long nseq)... |
726 |
|
{ |
727 |
0 |
if (ssConsensus == null) |
728 |
|
{ |
729 |
0 |
getSSConsensus(); |
730 |
|
} |
731 |
0 |
ssConsensus.label = "Sec Str Consensus for " + getName(); |
732 |
0 |
ssConsensus.description = "Percent Identity"; |
733 |
0 |
ssConsensusData = ssCnsns; |
734 |
|
|
735 |
0 |
int aWidth = (ssConsensus.annotations != null) |
736 |
0 |
? (endRes < ssConsensus.annotations.length |
737 |
|
? ssConsensus.annotations.length |
738 |
|
: endRes + 1) |
739 |
|
: endRes + 1; |
740 |
0 |
ssConsensus.annotations = null; |
741 |
0 |
ssConsensus.annotations = new Annotation[aWidth]; |
742 |
|
|
743 |
|
|
744 |
0 |
AAFrequency.completeSSConsensus(ssConsensus, ssCnsns, startRes, |
745 |
|
endRes + 1, ignoreGapsInConsensus, showSequenceLogo, nseq); |
746 |
|
|
747 |
|
|
748 |
|
|
749 |
|
|
750 |
|
} |
751 |
|
|
752 |
|
|
753 |
|
@param |
754 |
|
|
755 |
|
@param |
756 |
|
|
757 |
|
|
758 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
759 |
4 |
public void addOrRemove(SequenceI s, boolean recalc)... |
760 |
|
{ |
761 |
4 |
synchronized (sequences) |
762 |
|
{ |
763 |
4 |
if (sequences.contains(s)) |
764 |
|
{ |
765 |
1 |
deleteSequence(s, recalc); |
766 |
|
} |
767 |
|
else |
768 |
|
{ |
769 |
3 |
addSequence(s, recalc); |
770 |
|
} |
771 |
|
} |
772 |
|
} |
773 |
|
|
774 |
|
|
775 |
|
|
776 |
|
|
777 |
|
@param |
778 |
|
|
779 |
|
@param |
780 |
|
|
781 |
|
|
|
|
| 71.4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
782 |
35 |
public void deleteSequence(SequenceI s, boolean recalc)... |
783 |
|
{ |
784 |
35 |
synchronized (sequences) |
785 |
|
{ |
786 |
35 |
sequences.remove(s); |
787 |
35 |
changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, |
788 |
|
sequences.size() + 1, sequences.size()); |
789 |
|
|
790 |
35 |
if (recalc) |
791 |
|
{ |
792 |
0 |
recalcConservation(); |
793 |
|
} |
794 |
|
} |
795 |
|
} |
796 |
|
|
797 |
|
|
798 |
|
|
799 |
|
|
800 |
|
@return |
801 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
802 |
542649 |
@Override... |
803 |
|
public int getStartRes() |
804 |
|
{ |
805 |
542714 |
return startRes; |
806 |
|
} |
807 |
|
|
808 |
|
|
809 |
|
|
810 |
|
@return |
811 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
812 |
475784 |
@Override... |
813 |
|
public int getEndRes() |
814 |
|
{ |
815 |
475820 |
return endRes; |
816 |
|
} |
817 |
|
|
818 |
|
|
819 |
|
|
820 |
|
|
821 |
|
@param |
822 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
823 |
91 |
public void setStartRes(int newStart)... |
824 |
|
{ |
825 |
91 |
int before = startRes; |
826 |
91 |
startRes = Math.max(0, newStart); |
827 |
|
|
828 |
91 |
changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes); |
829 |
|
|
830 |
|
} |
831 |
|
|
832 |
|
|
833 |
|
|
834 |
|
|
835 |
|
@param |
836 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
837 |
112 |
public void setEndRes(int i)... |
838 |
|
{ |
839 |
112 |
int before = endRes; |
840 |
112 |
endRes = i; |
841 |
112 |
changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, endRes); |
842 |
|
} |
843 |
|
|
844 |
|
|
845 |
|
@return |
846 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
847 |
484 |
public int getSize()... |
848 |
|
{ |
849 |
484 |
return sequences.size(); |
850 |
|
} |
851 |
|
|
852 |
|
|
853 |
|
@param |
854 |
|
@return |
855 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
856 |
58 |
public SequenceI getSequenceAt(int i)... |
857 |
|
{ |
858 |
58 |
return sequences.get(i); |
859 |
|
} |
860 |
|
|
861 |
|
|
862 |
|
@param |
863 |
|
|
864 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
865 |
18 |
public void setColourText(boolean state)... |
866 |
|
{ |
867 |
18 |
colourText = state; |
868 |
|
} |
869 |
|
|
870 |
|
|
871 |
|
|
872 |
|
|
873 |
|
@return |
874 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
875 |
171751 |
public boolean getColourText()... |
876 |
|
{ |
877 |
171751 |
return colourText; |
878 |
|
} |
879 |
|
|
880 |
|
|
881 |
|
|
882 |
|
|
883 |
|
@param |
884 |
|
|
885 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
886 |
14 |
public void setDisplayText(boolean state)... |
887 |
|
{ |
888 |
14 |
displayText = state; |
889 |
|
} |
890 |
|
|
891 |
|
|
892 |
|
|
893 |
|
|
894 |
|
@return |
895 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
896 |
171736 |
public boolean getDisplayText()... |
897 |
|
{ |
898 |
171736 |
return displayText; |
899 |
|
} |
900 |
|
|
901 |
|
|
902 |
|
|
903 |
|
|
904 |
|
@param |
905 |
|
|
906 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
907 |
14 |
public void setDisplayBoxes(boolean state)... |
908 |
|
{ |
909 |
14 |
displayBoxes = state; |
910 |
|
} |
911 |
|
|
912 |
|
|
913 |
|
|
914 |
|
|
915 |
|
@return |
916 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
917 |
171745 |
public boolean getDisplayBoxes()... |
918 |
|
{ |
919 |
171745 |
return displayBoxes; |
920 |
|
} |
921 |
|
|
922 |
|
|
923 |
|
|
924 |
|
|
925 |
|
@return |
926 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
927 |
447 |
@Override... |
928 |
|
public int getWidth() |
929 |
|
{ |
930 |
447 |
synchronized (sequences) |
931 |
|
{ |
932 |
|
|
933 |
447 |
boolean first = true; |
934 |
447 |
for (SequenceI seq : sequences) |
935 |
|
{ |
936 |
1480 |
if (first || seq.getLength() > width) |
937 |
|
{ |
938 |
447 |
width = seq.getLength(); |
939 |
447 |
first = false; |
940 |
|
} |
941 |
|
} |
942 |
447 |
return width; |
943 |
|
} |
944 |
|
} |
945 |
|
|
946 |
|
|
947 |
|
|
948 |
|
|
949 |
|
@param |
950 |
|
|
951 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
952 |
69 |
public void setOutlineColour(Color c)... |
953 |
|
{ |
954 |
69 |
outlineColour = c; |
955 |
|
} |
956 |
|
|
957 |
|
|
958 |
|
|
959 |
|
|
960 |
|
@return |
961 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
962 |
952 |
public Color getOutlineColour()... |
963 |
|
{ |
964 |
952 |
return outlineColour; |
965 |
|
} |
966 |
|
|
967 |
|
|
968 |
|
|
969 |
|
|
970 |
|
|
971 |
|
|
972 |
|
|
973 |
|
@param |
974 |
|
|
975 |
|
@return |
976 |
|
|
977 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
978 |
127 |
public SequenceI[] getSequencesInOrder(AlignmentI al)... |
979 |
|
{ |
980 |
127 |
return getSequencesInOrder(al, true); |
981 |
|
} |
982 |
|
|
983 |
|
|
984 |
|
|
985 |
|
|
986 |
|
|
987 |
|
|
988 |
|
@param |
989 |
|
@param |
990 |
|
@return |
991 |
|
|
|
|
| 66.7% |
Uncovered Elements: 12 (36) |
Complexity: 10 |
Complexity Density: 0.5 |
|
992 |
133 |
public SequenceI[] getSequencesInOrder(AlignmentI al, boolean trim)... |
993 |
|
{ |
994 |
133 |
synchronized (sequences) |
995 |
|
{ |
996 |
133 |
int sSize = sequences.size(); |
997 |
133 |
int alHeight = al.getHeight(); |
998 |
|
|
999 |
133 |
SequenceI[] seqs = new SequenceI[(trim) ? sSize : alHeight]; |
1000 |
|
|
1001 |
133 |
int index = 0; |
1002 |
1049 |
for (int i = 0; i < alHeight && index < sSize; i++) |
1003 |
|
{ |
1004 |
916 |
if (sequences.contains(al.getSequenceAt(i))) |
1005 |
|
{ |
1006 |
281 |
seqs[(trim) ? index : i] = al.getSequenceAt(i); |
1007 |
281 |
index++; |
1008 |
|
} |
1009 |
|
} |
1010 |
133 |
if (index == 0) |
1011 |
|
{ |
1012 |
63 |
return null; |
1013 |
|
} |
1014 |
70 |
if (!trim) |
1015 |
|
{ |
1016 |
0 |
return seqs; |
1017 |
|
} |
1018 |
70 |
if (index < seqs.length) |
1019 |
|
{ |
1020 |
0 |
SequenceI[] dummy = seqs; |
1021 |
0 |
seqs = new SequenceI[index]; |
1022 |
0 |
while (--index >= 0) |
1023 |
|
{ |
1024 |
0 |
seqs[index] = dummy[index]; |
1025 |
0 |
dummy[index] = null; |
1026 |
|
} |
1027 |
|
} |
1028 |
70 |
return seqs; |
1029 |
|
} |
1030 |
|
} |
1031 |
|
|
1032 |
|
|
1033 |
|
@return |
1034 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1035 |
18 |
public Color getIdColour()... |
1036 |
|
{ |
1037 |
18 |
return idColour; |
1038 |
|
} |
1039 |
|
|
1040 |
|
|
1041 |
|
@param |
1042 |
|
|
1043 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1044 |
7 |
public void setIdColour(Color idColour)... |
1045 |
|
{ |
1046 |
7 |
this.idColour = idColour; |
1047 |
|
} |
1048 |
|
|
1049 |
|
|
1050 |
|
@return |
1051 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1052 |
171710 |
@Override... |
1053 |
|
public SequenceI getSeqrep() |
1054 |
|
{ |
1055 |
171710 |
return seqrep; |
1056 |
|
} |
1057 |
|
|
1058 |
|
|
1059 |
|
|
1060 |
|
|
1061 |
|
|
1062 |
|
@param |
1063 |
|
|
1064 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1065 |
17 |
@Override... |
1066 |
|
public void setSeqrep(SequenceI seqrep) |
1067 |
|
{ |
1068 |
17 |
this.seqrep = seqrep; |
1069 |
|
} |
1070 |
|
|
1071 |
|
|
1072 |
|
|
1073 |
|
@return |
1074 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1075 |
6 |
@Override... |
1076 |
|
public boolean hasSeqrep() |
1077 |
|
{ |
1078 |
6 |
return seqrep != null; |
1079 |
|
} |
1080 |
|
|
1081 |
|
|
1082 |
|
|
1083 |
|
|
1084 |
|
|
1085 |
|
@param |
1086 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1087 |
6 |
public void setHidereps(boolean visibility)... |
1088 |
|
{ |
1089 |
6 |
hidereps = visibility; |
1090 |
|
} |
1091 |
|
|
1092 |
|
|
1093 |
|
|
1094 |
|
@return |
1095 |
|
|
1096 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1097 |
8 |
public boolean isHidereps()... |
1098 |
|
{ |
1099 |
8 |
return hidereps; |
1100 |
|
} |
1101 |
|
|
1102 |
|
|
1103 |
|
|
1104 |
|
|
1105 |
|
@param |
1106 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1107 |
1 |
public void setHideCols(boolean visibility)... |
1108 |
|
{ |
1109 |
1 |
hidecols = visibility; |
1110 |
|
} |
1111 |
|
|
1112 |
|
|
1113 |
|
|
1114 |
|
@return |
1115 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1116 |
8 |
public boolean isHideCols()... |
1117 |
|
{ |
1118 |
8 |
return hidecols; |
1119 |
|
} |
1120 |
|
|
1121 |
|
|
1122 |
|
|
1123 |
|
|
1124 |
|
|
1125 |
|
@param |
1126 |
|
|
1127 |
|
@param |
1128 |
|
|
1129 |
|
@return |
1130 |
|
|
|
|
| 54.5% |
Uncovered Elements: 5 (11) |
Complexity: 5 |
Complexity Density: 0.71 |
|
1131 |
63 |
public SequenceGroup intersect(AlignmentI alignment,... |
1132 |
|
Map<SequenceI, SequenceCollectionI> map) |
1133 |
|
{ |
1134 |
63 |
SequenceGroup sgroup = new SequenceGroup(this); |
1135 |
63 |
SequenceI[] insect = getSequencesInOrder(alignment); |
1136 |
63 |
sgroup.sequences = new ArrayList<>(); |
1137 |
63 |
for (int s = 0; insect != null && s < insect.length; s++) |
1138 |
|
{ |
1139 |
0 |
if (map == null || map.containsKey(insect[s])) |
1140 |
|
{ |
1141 |
0 |
sgroup.sequences.add(insect[s]); |
1142 |
|
} |
1143 |
|
} |
1144 |
63 |
return sgroup; |
1145 |
|
} |
1146 |
|
|
1147 |
|
|
1148 |
|
@return |
1149 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1150 |
167158 |
public boolean getShowNonconserved()... |
1151 |
|
{ |
1152 |
167158 |
return showNonconserved; |
1153 |
|
} |
1154 |
|
|
1155 |
|
|
1156 |
|
@param |
1157 |
|
|
1158 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1159 |
74 |
public void setShowNonconserved(boolean displayNonconserved)... |
1160 |
|
{ |
1161 |
74 |
this.showNonconserved = displayNonconserved; |
1162 |
|
} |
1163 |
|
|
1164 |
|
|
1165 |
|
|
1166 |
|
|
1167 |
|
|
1168 |
|
@param |
1169 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
1170 |
24 |
public void setConsensus(AlignmentAnnotation aan)... |
1171 |
|
{ |
1172 |
24 |
if (consensus == null) |
1173 |
|
{ |
1174 |
24 |
consensus = aan; |
1175 |
|
} |
1176 |
|
} |
1177 |
|
|
1178 |
|
|
1179 |
|
|
1180 |
|
@return |
1181 |
|
|
1182 |
|
|
|
|
| 40% |
Uncovered Elements: 9 (15) |
Complexity: 3 |
Complexity Density: 0.27 |
|
1183 |
441 |
public AlignmentAnnotation getConsensus()... |
1184 |
|
{ |
1185 |
|
|
1186 |
441 |
int aWidth = this.getWidth(); |
1187 |
|
|
1188 |
|
|
1189 |
|
|
1190 |
441 |
if (aWidth < 0) |
1191 |
|
{ |
1192 |
0 |
return null; |
1193 |
|
} |
1194 |
441 |
if (consensus == null) |
1195 |
|
{ |
1196 |
0 |
consensus = new AlignmentAnnotation("", "", new Annotation[1], 0f, |
1197 |
|
100f, AlignmentAnnotation.BAR_GRAPH); |
1198 |
0 |
consensus.hasText = true; |
1199 |
0 |
consensus.autoCalculated = true; |
1200 |
0 |
consensus.groupRef = this; |
1201 |
0 |
consensus.label = "Consensus for " + getName(); |
1202 |
0 |
consensus.description = "Percent Identity"; |
1203 |
|
} |
1204 |
441 |
return consensus; |
1205 |
|
} |
1206 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 3 |
Complexity Density: 0.27 |
|
1207 |
0 |
public AlignmentAnnotation getSSConsensus()... |
1208 |
|
{ |
1209 |
|
|
1210 |
0 |
int aWidth = this.getWidth(); |
1211 |
|
|
1212 |
|
|
1213 |
|
|
1214 |
0 |
if (aWidth < 0) |
1215 |
|
{ |
1216 |
0 |
return null; |
1217 |
|
} |
1218 |
0 |
if (ssConsensus == null) |
1219 |
|
{ |
1220 |
0 |
ssConsensus = new AlignmentAnnotation("", "", new Annotation[1], 0f, |
1221 |
|
100f, AlignmentAnnotation.BAR_GRAPH); |
1222 |
0 |
ssConsensus.hasText = true; |
1223 |
0 |
ssConsensus.autoCalculated = true; |
1224 |
0 |
ssConsensus.groupRef = this; |
1225 |
0 |
ssConsensus.label = "Sec Str Consensus for " + getName(); |
1226 |
0 |
ssConsensus.description = "Percent Identity"; |
1227 |
|
} |
1228 |
0 |
return ssConsensus; |
1229 |
|
} |
1230 |
|
|
1231 |
|
|
1232 |
|
|
1233 |
|
|
1234 |
|
|
1235 |
|
@param |
1236 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
1237 |
0 |
public void setConservationRow(AlignmentAnnotation aan)... |
1238 |
|
{ |
1239 |
0 |
if (conservation == null) |
1240 |
|
{ |
1241 |
0 |
conservation = aan; |
1242 |
|
} |
1243 |
|
} |
1244 |
|
|
1245 |
|
|
1246 |
|
|
1247 |
|
|
1248 |
|
@return |
1249 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
1250 |
0 |
public AlignmentAnnotation getConservationRow()... |
1251 |
|
{ |
1252 |
0 |
if (conservation == null) |
1253 |
|
{ |
1254 |
0 |
conservation = new AlignmentAnnotation("", "", new Annotation[1], 0f, |
1255 |
|
11f, AlignmentAnnotation.BAR_GRAPH); |
1256 |
|
} |
1257 |
|
|
1258 |
0 |
conservation.hasText = true; |
1259 |
0 |
conservation.autoCalculated = true; |
1260 |
0 |
conservation.groupRef = this; |
1261 |
0 |
conservation.label = "Conservation for " + getName(); |
1262 |
0 |
conservation.description = "Conservation for group " + getName() |
1263 |
|
+ " less than " + consPercGaps + "% gaps"; |
1264 |
0 |
return conservation; |
1265 |
|
} |
1266 |
|
|
1267 |
|
|
1268 |
|
|
1269 |
|
@return |
1270 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1271 |
0 |
public boolean hasAnnotationRows()... |
1272 |
|
{ |
1273 |
0 |
return consensus != null || conservation != null; |
1274 |
|
} |
1275 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 6 |
Complexity Density: 0.55 |
|
1276 |
0 |
public SequenceI getConsensusSeq()... |
1277 |
|
{ |
1278 |
0 |
getConsensus(); |
1279 |
0 |
StringBuffer seqs = new StringBuffer(); |
1280 |
0 |
for (int i = 0; i < consensus.annotations.length; i++) |
1281 |
|
{ |
1282 |
0 |
if (consensus.annotations[i] != null) |
1283 |
|
{ |
1284 |
0 |
String desc = consensus.annotations[i].description; |
1285 |
0 |
if (desc.length() > 1 && desc.charAt(0) == '[') |
1286 |
|
{ |
1287 |
0 |
seqs.append(desc.charAt(1)); |
1288 |
|
} |
1289 |
|
else |
1290 |
|
{ |
1291 |
0 |
seqs.append(consensus.annotations[i].displayCharacter); |
1292 |
|
} |
1293 |
|
} |
1294 |
|
} |
1295 |
|
|
1296 |
0 |
SequenceI sq = new Sequence("Group" + getName() + " Consensus", |
1297 |
|
seqs.toString()); |
1298 |
0 |
sq.setDescription("Percentage Identity Consensus " |
1299 |
0 |
+ ((ignoreGapsInConsensus) ? " without gaps" : "")); |
1300 |
0 |
return sq; |
1301 |
|
} |
1302 |
|
|
|
|
| 50% |
Uncovered Elements: 3 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
1303 |
48 |
public void setIgnoreGapsConsensus(boolean state)... |
1304 |
|
{ |
1305 |
48 |
if (this.ignoreGapsInConsensus != state && consensus != null) |
1306 |
|
{ |
1307 |
0 |
ignoreGapsInConsensus = state; |
1308 |
0 |
recalcConservation(); |
1309 |
|
} |
1310 |
48 |
ignoreGapsInConsensus = state; |
1311 |
|
} |
1312 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1313 |
26170 |
public boolean getIgnoreGapsConsensus()... |
1314 |
|
{ |
1315 |
26170 |
return ignoreGapsInConsensus; |
1316 |
|
} |
1317 |
|
|
1318 |
|
|
1319 |
|
@param |
1320 |
|
|
1321 |
|
|
|
|
| 50% |
Uncovered Elements: 3 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
1322 |
57 |
public void setshowSequenceLogo(boolean showSequenceLogo)... |
1323 |
|
{ |
1324 |
|
|
1325 |
57 |
if (this.showSequenceLogo != showSequenceLogo && consensus != null) |
1326 |
|
{ |
1327 |
0 |
this.showSequenceLogo = showSequenceLogo; |
1328 |
0 |
recalcConservation(); |
1329 |
|
} |
1330 |
57 |
this.showSequenceLogo = showSequenceLogo; |
1331 |
|
} |
1332 |
|
|
|
|
| 50% |
Uncovered Elements: 3 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
1333 |
9 |
public void setshowSequenceSSLogo(boolean showSequenceSSLogo)... |
1334 |
|
{ |
1335 |
|
|
1336 |
9 |
if (this.showSequenceSSLogo != showSequenceSSLogo |
1337 |
|
&& ssConsensus != null) |
1338 |
|
{ |
1339 |
0 |
this.showSequenceSSLogo = showSequenceSSLogo; |
1340 |
0 |
recalcConservation(); |
1341 |
|
} |
1342 |
9 |
this.showSequenceSSLogo = showSequenceSSLogo; |
1343 |
|
} |
1344 |
|
|
1345 |
|
|
1346 |
|
|
1347 |
|
@param |
1348 |
|
|
1349 |
|
|
1350 |
|
|
|
|
| 50% |
Uncovered Elements: 3 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
1351 |
57 |
public void setShowConsensusHistogram(boolean showConsHist)... |
1352 |
|
{ |
1353 |
|
|
1354 |
57 |
if (showConsensusHistogram != showConsHist && consensus != null) |
1355 |
|
{ |
1356 |
0 |
this.showConsensusHistogram = showConsHist; |
1357 |
0 |
recalcConservation(); |
1358 |
|
} |
1359 |
57 |
this.showConsensusHistogram = showConsHist; |
1360 |
|
} |
1361 |
|
|
|
|
| 50% |
Uncovered Elements: 3 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
1362 |
9 |
public void setShowSSConsensusHistogram(boolean showSSConsHist)... |
1363 |
|
{ |
1364 |
|
|
1365 |
9 |
if (showSSConsensusHistogram != showSSConsHist && consensus != null) |
1366 |
|
{ |
1367 |
0 |
this.showSSConsensusHistogram = showSSConsHist; |
1368 |
0 |
recalcConservation(); |
1369 |
|
} |
1370 |
9 |
this.showSSConsensusHistogram = showSSConsHist; |
1371 |
|
} |
1372 |
|
|
1373 |
|
|
1374 |
|
@return |
1375 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1376 |
434 |
public boolean isShowConsensusHistogram()... |
1377 |
|
{ |
1378 |
434 |
return showConsensusHistogram; |
1379 |
|
} |
1380 |
|
|
1381 |
|
|
1382 |
|
|
1383 |
|
|
1384 |
|
@param |
1385 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1386 |
57 |
public void setNormaliseSequenceLogo(boolean norm)... |
1387 |
|
{ |
1388 |
57 |
normaliseSequenceLogo = norm; |
1389 |
|
} |
1390 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1391 |
434 |
public boolean isNormaliseSequenceLogo()... |
1392 |
|
{ |
1393 |
434 |
return normaliseSequenceLogo; |
1394 |
|
} |
1395 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 5 |
Complexity Density: 0.38 |
|
1396 |
0 |
@Override... |
1397 |
|
|
1398 |
|
|
1399 |
|
|
1400 |
|
public AlignmentAnnotation[] getAlignmentAnnotation() |
1401 |
|
{ |
1402 |
|
|
1403 |
|
|
1404 |
0 |
ArrayList<AlignmentAnnotation> annot = new ArrayList<>(); |
1405 |
0 |
synchronized (sequences) |
1406 |
|
{ |
1407 |
0 |
for (SequenceI seq : sequences) |
1408 |
|
{ |
1409 |
0 |
AlignmentAnnotation[] aa = seq.getAnnotation(); |
1410 |
0 |
if (aa != null) |
1411 |
|
{ |
1412 |
0 |
for (AlignmentAnnotation al : aa) |
1413 |
|
{ |
1414 |
0 |
if (al.groupRef == this) |
1415 |
|
{ |
1416 |
0 |
annot.add(al); |
1417 |
|
} |
1418 |
|
} |
1419 |
|
} |
1420 |
|
} |
1421 |
0 |
if (consensus != null) |
1422 |
|
{ |
1423 |
0 |
annot.add(consensus); |
1424 |
|
} |
1425 |
0 |
if (conservation != null) |
1426 |
|
{ |
1427 |
0 |
annot.add(conservation); |
1428 |
|
} |
1429 |
|
} |
1430 |
0 |
return annot.toArray(new AlignmentAnnotation[0]); |
1431 |
|
} |
1432 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1433 |
0 |
@Override... |
1434 |
|
public Iterable<AlignmentAnnotation> findAnnotation(String calcId) |
1435 |
|
{ |
1436 |
0 |
return AlignmentAnnotation.findAnnotation( |
1437 |
|
Arrays.asList(getAlignmentAnnotation()), calcId); |
1438 |
|
} |
1439 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1440 |
0 |
@Override... |
1441 |
|
public Iterable<AlignmentAnnotation> findAnnotations(SequenceI seq, |
1442 |
|
String calcId, String label) |
1443 |
|
{ |
1444 |
0 |
return AlignmentAnnotation.findAnnotations( |
1445 |
|
Arrays.asList(getAlignmentAnnotation()), seq, calcId, label); |
1446 |
|
} |
1447 |
|
|
1448 |
|
|
1449 |
|
|
1450 |
|
|
1451 |
|
@param |
1452 |
|
@return |
1453 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1454 |
0 |
public boolean hasAnnotation(String calcId)... |
1455 |
|
{ |
1456 |
0 |
return AlignmentAnnotation |
1457 |
|
.hasAnnotation(Arrays.asList(getAlignmentAnnotation()), calcId); |
1458 |
|
} |
1459 |
|
|
1460 |
|
|
1461 |
|
|
1462 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
1463 |
15 |
public void clear()... |
1464 |
|
{ |
1465 |
15 |
synchronized (sequences) |
1466 |
|
{ |
1467 |
15 |
int before = sequences.size(); |
1468 |
15 |
sequences.clear(); |
1469 |
15 |
changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, |
1470 |
|
sequences.size()); |
1471 |
|
} |
1472 |
|
} |
1473 |
|
|
1474 |
|
|
1475 |
|
|
1476 |
|
|
1477 |
|
|
1478 |
|
@param |
1479 |
|
|
1480 |
|
@param |
1481 |
|
|
1482 |
|
|
1483 |
|
@throws |
1484 |
|
|
1485 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1486 |
107 |
public void setContext(AnnotatedCollectionI ctx, boolean defined)... |
1487 |
|
{ |
1488 |
107 |
setContext(ctx); |
1489 |
106 |
this.isDefined = defined; |
1490 |
|
} |
1491 |
|
|
1492 |
|
|
1493 |
|
|
1494 |
|
|
1495 |
|
@param |
1496 |
|
|
1497 |
|
@throws |
1498 |
|
|
1499 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
1500 |
151 |
public void setContext(AnnotatedCollectionI ctx)... |
1501 |
|
{ |
1502 |
151 |
AnnotatedCollectionI ref = ctx; |
1503 |
397 |
while (ref != null) |
1504 |
|
{ |
1505 |
249 |
if (ref == this || ref.getContext() == ctx) |
1506 |
|
{ |
1507 |
3 |
throw new IllegalArgumentException( |
1508 |
|
"Circular reference in SequenceGroup.context"); |
1509 |
|
} |
1510 |
246 |
ref = ref.getContext(); |
1511 |
|
} |
1512 |
148 |
this.context = ctx; |
1513 |
|
} |
1514 |
|
|
1515 |
|
|
1516 |
|
|
1517 |
|
|
1518 |
|
@see |
1519 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1520 |
136 |
@Override... |
1521 |
|
public AnnotatedCollectionI getContext() |
1522 |
|
{ |
1523 |
136 |
return context; |
1524 |
|
} |
1525 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1526 |
9 |
public boolean isDefined()... |
1527 |
|
{ |
1528 |
9 |
return isDefined; |
1529 |
|
} |
1530 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1531 |
51 |
public void setColourScheme(ColourSchemeI scheme)... |
1532 |
|
{ |
1533 |
51 |
if (cs == null) |
1534 |
|
{ |
1535 |
1 |
cs = new ResidueShader(); |
1536 |
|
} |
1537 |
51 |
cs.setColourScheme(scheme); |
1538 |
|
} |
1539 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1540 |
2 |
public void setGroupColourScheme(ResidueShaderI scheme)... |
1541 |
|
{ |
1542 |
2 |
cs = scheme; |
1543 |
|
} |
1544 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
1545 |
73 |
public ColourSchemeI getColourScheme()... |
1546 |
|
{ |
1547 |
73 |
return cs == null ? null : cs.getColourScheme(); |
1548 |
|
} |
1549 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1550 |
269260 |
public ResidueShaderI getGroupColourScheme()... |
1551 |
|
{ |
1552 |
269273 |
return cs; |
1553 |
|
} |
1554 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1555 |
68 |
@Override... |
1556 |
|
public boolean isNucleotide() |
1557 |
|
{ |
1558 |
68 |
if (context != null) |
1559 |
|
{ |
1560 |
68 |
return context.isNucleotide(); |
1561 |
|
} |
1562 |
0 |
return false; |
1563 |
|
} |
1564 |
|
|
1565 |
|
|
1566 |
|
@param |
1567 |
|
@return |
1568 |
|
|
1569 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1570 |
35 |
public boolean contains(SequenceI seq1)... |
1571 |
|
{ |
1572 |
35 |
return sequences.contains(seq1); |
1573 |
|
} |
1574 |
|
|
1575 |
|
|
1576 |
|
@param |
1577 |
|
@param |
1578 |
|
@return |
1579 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1580 |
15 |
public boolean contains(SequenceI seq, int apos)... |
1581 |
|
{ |
1582 |
15 |
return (startRes <= apos && endRes >= apos) && sequences.contains(seq); |
1583 |
|
} |
1584 |
|
|
1585 |
|
|
1586 |
|
|
1587 |
|
|
1588 |
|
ContactMapHolder cmholder = new ContactMapHolder(); |
1589 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1590 |
0 |
@Override... |
1591 |
|
public Collection<ContactMatrixI> getContactMaps() |
1592 |
|
{ |
1593 |
0 |
return cmholder.getContactMaps(); |
1594 |
|
} |
1595 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1596 |
0 |
@Override... |
1597 |
|
public ContactMatrixI getContactMatrixFor(AlignmentAnnotation ann) |
1598 |
|
{ |
1599 |
0 |
return cmholder.getContactMatrixFor(ann); |
1600 |
|
} |
1601 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1602 |
0 |
@Override... |
1603 |
|
public ContactListI getContactListFor(AlignmentAnnotation _aa, int column) |
1604 |
|
{ |
1605 |
0 |
return cmholder.getContactListFor(_aa, column); |
1606 |
|
} |
1607 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
1608 |
0 |
@Override... |
1609 |
|
public AlignmentAnnotation addContactList(ContactMatrixI cm) |
1610 |
|
{ |
1611 |
0 |
AlignmentAnnotation aa = cmholder.addContactList(cm); |
1612 |
|
|
1613 |
0 |
Annotation _aa[] = new Annotation[getWidth()]; |
1614 |
0 |
Annotation dummy = new Annotation(0.0f); |
1615 |
0 |
for (int i = 0; i < _aa.length; _aa[i++] = dummy) |
1616 |
|
{ |
1617 |
0 |
; |
1618 |
|
} |
1619 |
0 |
aa.annotations = _aa; |
1620 |
|
|
1621 |
0 |
return aa; |
1622 |
|
} |
1623 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1624 |
0 |
@Override... |
1625 |
|
public void addContactListFor(AlignmentAnnotation annotation, |
1626 |
|
ContactMatrixI cm) |
1627 |
|
{ |
1628 |
0 |
cmholder.addContactListFor(annotation, cm); |
1629 |
|
} |
1630 |
|
|
1631 |
|
} |