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