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 |
|
|
|
|
| 0% |
Uncovered Elements: 661 (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 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
168 |
0 |
public SequenceGroup()... |
169 |
|
{ |
170 |
0 |
groupName = "JGroup:" + this.hashCode(); |
171 |
0 |
cs = new ResidueShader(); |
172 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
|
189 |
0 |
public SequenceGroup(List<SequenceI> sequences, String groupName,... |
190 |
|
ColourSchemeI scheme, boolean displayBoxes, boolean displayText, |
191 |
|
boolean colourText, int start, int end) |
192 |
|
{ |
193 |
0 |
this(); |
194 |
0 |
this.sequences = sequences; |
195 |
0 |
this.groupName = groupName; |
196 |
0 |
this.displayBoxes = displayBoxes; |
197 |
0 |
this.displayText = displayText; |
198 |
0 |
this.colourText = colourText; |
199 |
0 |
this.cs = new ResidueShader(scheme); |
200 |
0 |
startRes = start; |
201 |
0 |
endRes = end; |
202 |
0 |
recalcConservation(); |
203 |
|
} |
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
@param |
209 |
|
|
|
|
| 0% |
Uncovered Elements: 39 (39) |
Complexity: 5 |
Complexity Density: 0.16 |
|
210 |
0 |
public SequenceGroup(SequenceGroup seqsel)... |
211 |
|
{ |
212 |
0 |
this(); |
213 |
0 |
if (seqsel != null) |
214 |
|
{ |
215 |
0 |
sequences = new ArrayList<>(); |
216 |
0 |
sequences.addAll(seqsel.sequences); |
217 |
0 |
if (seqsel.groupName != null) |
218 |
|
{ |
219 |
0 |
groupName = new String(seqsel.groupName); |
220 |
|
} |
221 |
0 |
displayBoxes = seqsel.displayBoxes; |
222 |
0 |
displayText = seqsel.displayText; |
223 |
0 |
colourText = seqsel.colourText; |
224 |
|
|
225 |
0 |
startRes = seqsel.startRes; |
226 |
0 |
endRes = seqsel.endRes; |
227 |
0 |
cs = new ResidueShader((ResidueShader) seqsel.cs); |
228 |
0 |
if (seqsel.description != null) |
229 |
|
{ |
230 |
0 |
description = new String(seqsel.description); |
231 |
|
} |
232 |
0 |
hidecols = seqsel.hidecols; |
233 |
0 |
hidereps = seqsel.hidereps; |
234 |
0 |
showNonconserved = seqsel.showNonconserved; |
235 |
0 |
showSequenceLogo = seqsel.showSequenceLogo; |
236 |
0 |
normaliseSequenceLogo = seqsel.normaliseSequenceLogo; |
237 |
0 |
showConsensusHistogram = seqsel.showConsensusHistogram; |
238 |
0 |
showSSConsensusHistogram = seqsel.showSSConsensusHistogram; |
239 |
0 |
idColour = seqsel.idColour; |
240 |
0 |
outlineColour = seqsel.outlineColour; |
241 |
0 |
seqrep = seqsel.seqrep; |
242 |
0 |
textColour = seqsel.textColour; |
243 |
0 |
textColour2 = seqsel.textColour2; |
244 |
0 |
thresholdTextColour = seqsel.thresholdTextColour; |
245 |
0 |
width = seqsel.width; |
246 |
0 |
ignoreGapsInConsensus = seqsel.ignoreGapsInConsensus; |
247 |
0 |
if (seqsel.conserve != null) |
248 |
|
{ |
249 |
0 |
recalcConservation(); |
250 |
|
|
251 |
|
} |
252 |
|
} |
253 |
|
} |
254 |
|
|
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
@param |
259 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
260 |
0 |
public SequenceGroup(List<SequenceI> seqs)... |
261 |
|
{ |
262 |
0 |
this(); |
263 |
0 |
this.sequences.addAll(seqs); |
264 |
|
} |
265 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
266 |
0 |
public boolean isShowSequenceLogo()... |
267 |
|
{ |
268 |
0 |
return showSequenceLogo; |
269 |
|
} |
270 |
|
|
|
|
| 0% |
Uncovered Elements: 54 (54) |
Complexity: 11 |
Complexity Density: 0.32 |
|
271 |
0 |
public SequenceI[] getSelectionAsNewSequences(AlignmentI align)... |
272 |
|
{ |
273 |
0 |
int iSize = sequences.size(); |
274 |
0 |
SequenceI[] seqs = new SequenceI[iSize]; |
275 |
0 |
SequenceI[] inorder = getSequencesInOrder(align); |
276 |
|
|
277 |
0 |
for (int i = 0, ipos = 0; i < inorder.length; i++) |
278 |
|
{ |
279 |
0 |
SequenceI seq = inorder[i]; |
280 |
0 |
SequenceI seqipos = seqs[ipos] = seq.getSubSequence(startRes, |
281 |
|
endRes + 1); |
282 |
0 |
if (seqipos != null) |
283 |
|
{ |
284 |
0 |
if (seq.getAnnotation() != null) |
285 |
|
{ |
286 |
0 |
AlignmentAnnotation[] alann = align.getAlignmentAnnotation(); |
287 |
|
|
288 |
|
|
289 |
0 |
for (int a = 0; a < seq.getAnnotation().length; a++) |
290 |
|
{ |
291 |
0 |
AlignmentAnnotation tocopy = seq.getAnnotation()[a]; |
292 |
0 |
if (alann != null) |
293 |
|
{ |
294 |
0 |
boolean found = false; |
295 |
0 |
for (int pos = 0, np = alann.length; pos < np; pos++) |
296 |
|
{ |
297 |
0 |
if (alann[pos] == tocopy) |
298 |
|
{ |
299 |
0 |
found = true; |
300 |
0 |
break; |
301 |
|
} |
302 |
|
} |
303 |
0 |
if (!found) |
304 |
|
{ |
305 |
0 |
continue; |
306 |
|
} |
307 |
|
} |
308 |
0 |
AlignmentAnnotation newannot = new AlignmentAnnotation( |
309 |
|
seq.getAnnotation()[a]); |
310 |
0 |
newannot.restrict(startRes, endRes); |
311 |
0 |
newannot.setSequenceRef(seqs[ipos]); |
312 |
0 |
newannot.adjustForAlignment(); |
313 |
0 |
ContactMatrixI cm = seq |
314 |
|
.getContactMatrixFor(seq.getAnnotation()[a]); |
315 |
0 |
if (cm != null) |
316 |
|
{ |
317 |
0 |
seqs[ipos].addContactListFor(newannot, cm); |
318 |
|
} |
319 |
0 |
seqipos.addAlignmentAnnotation(newannot); |
320 |
|
} |
321 |
|
} |
322 |
0 |
ipos++; |
323 |
|
} |
324 |
|
else |
325 |
|
{ |
326 |
0 |
iSize--; |
327 |
|
} |
328 |
|
} |
329 |
0 |
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 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
368 |
0 |
@Override... |
369 |
|
public List<SequenceI> getSequences() |
370 |
|
{ |
371 |
0 |
return sequences; |
372 |
|
} |
373 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 5 |
Complexity Density: 0.45 |
|
374 |
0 |
@Override... |
375 |
|
public List<SequenceI> getSequences( |
376 |
|
Map<SequenceI, SequenceCollectionI> hiddenReps) |
377 |
|
{ |
378 |
0 |
if (hiddenReps == null) |
379 |
|
{ |
380 |
|
|
381 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
406 |
0 |
public SequenceI[] getSequencesAsArray(... |
407 |
|
Map<SequenceI, SequenceCollectionI> map) |
408 |
|
{ |
409 |
0 |
List<SequenceI> tmp = getSequences(map); |
410 |
0 |
if (tmp == null) |
411 |
|
{ |
412 |
0 |
return null; |
413 |
|
} |
414 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
480 |
0 |
public String getName()... |
481 |
|
{ |
482 |
0 |
return groupName; |
483 |
|
} |
484 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
485 |
0 |
public String getDescription()... |
486 |
|
{ |
487 |
0 |
return description; |
488 |
|
} |
489 |
|
|
490 |
|
|
491 |
|
|
492 |
|
|
493 |
|
@param |
494 |
|
|
495 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
496 |
0 |
public void setName(String name)... |
497 |
|
{ |
498 |
0 |
groupName = name; |
499 |
|
|
500 |
|
} |
501 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
502 |
0 |
public void setDescription(String desc)... |
503 |
|
{ |
504 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
538 |
0 |
public void addSequence(SequenceI s, boolean recalc)... |
539 |
|
{ |
540 |
0 |
synchronized (sequences) |
541 |
|
{ |
542 |
0 |
if (s != null && !sequences.contains(s)) |
543 |
|
{ |
544 |
0 |
sequences.add(s); |
545 |
0 |
changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, |
546 |
|
sequences.size() - 1, sequences.size()); |
547 |
|
} |
548 |
|
|
549 |
0 |
if (recalc) |
550 |
|
{ |
551 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
584 |
0 |
public boolean recalcConservation()... |
585 |
|
{ |
586 |
0 |
return recalcConservation(false); |
587 |
|
} |
588 |
|
|
589 |
|
|
590 |
|
|
591 |
|
|
592 |
|
|
593 |
|
@param |
594 |
|
|
595 |
|
|
596 |
|
|
|
|
| 0% |
Uncovered Elements: 56 (56) |
Complexity: 18 |
Complexity Density: 0.53 |
|
597 |
0 |
public boolean recalcConservation(boolean defer)... |
598 |
|
{ |
599 |
0 |
if (cs == null && consensus == null && conservation == null) |
600 |
|
{ |
601 |
0 |
return false; |
602 |
|
} |
603 |
|
|
604 |
|
|
605 |
0 |
boolean upd = false; |
606 |
0 |
try |
607 |
|
{ |
608 |
0 |
ProfilesI cnsns = AAFrequency.calculate(sequences, startRes, |
609 |
|
endRes + 1, showSequenceLogo); |
610 |
0 |
if (consensus != null) |
611 |
|
{ |
612 |
0 |
_updateConsensusRow(cnsns, sequences.size()); |
613 |
0 |
upd = true; |
614 |
|
} |
615 |
0 |
if (cs != null) |
616 |
|
{ |
617 |
0 |
cs.setConsensus(cnsns); |
618 |
0 |
upd = true; |
619 |
|
} |
620 |
|
|
621 |
0 |
ProfilesI ssCnsns = AAFrequency.calculateSS(sequences, startRes, |
622 |
|
endRes + 1, showSequenceLogo); |
623 |
0 |
if (ssConsensus != null) |
624 |
|
{ |
625 |
0 |
_updateSSConsensusRow(ssCnsns, sequences.size()); |
626 |
0 |
upd = true; |
627 |
|
} |
628 |
0 |
if (cs != null) |
629 |
|
{ |
630 |
0 |
cs.setSsConsensus(ssCnsns); |
631 |
0 |
upd = true; |
632 |
|
} |
633 |
|
|
634 |
0 |
if ((conservation != null) |
635 |
|
|| (cs != null && cs.conservationApplied())) |
636 |
|
{ |
637 |
0 |
Conservation c = new Conservation(groupName, sequences, startRes, |
638 |
|
endRes + 1); |
639 |
0 |
c.calculate(); |
640 |
0 |
c.verdict(false, consPercGaps); |
641 |
0 |
if (conservation != null) |
642 |
|
{ |
643 |
0 |
_updateConservationRow(c); |
644 |
|
} |
645 |
0 |
if (cs != null) |
646 |
|
{ |
647 |
0 |
if (cs.conservationApplied()) |
648 |
|
{ |
649 |
0 |
cs.setConservation(c); |
650 |
|
} |
651 |
|
} |
652 |
|
|
653 |
0 |
upd = true; |
654 |
|
} |
655 |
0 |
if (cs != null && !defer) |
656 |
|
{ |
657 |
|
|
658 |
0 |
cs.alignmentChanged(context != null ? context : this, null); |
659 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 4 |
Complexity Density: 0.44 |
|
698 |
0 |
private void _updateConsensusRow(ProfilesI cnsns, long nseq)... |
699 |
|
{ |
700 |
0 |
if (consensus == null) |
701 |
|
{ |
702 |
0 |
getConsensus(); |
703 |
|
} |
704 |
0 |
consensus.label = "Consensus for " + getName(); |
705 |
0 |
consensus.description = "Percent Identity"; |
706 |
0 |
consensusData = cnsns; |
707 |
|
|
708 |
0 |
int aWidth = (consensus.annotations != null) |
709 |
0 |
? (endRes < consensus.annotations.length |
710 |
|
? consensus.annotations.length |
711 |
|
: endRes + 1) |
712 |
|
: endRes + 1; |
713 |
0 |
consensus.annotations = null; |
714 |
0 |
consensus.annotations = new Annotation[aWidth]; |
715 |
|
|
716 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
759 |
0 |
public void addOrRemove(SequenceI s, boolean recalc)... |
760 |
|
{ |
761 |
0 |
synchronized (sequences) |
762 |
|
{ |
763 |
0 |
if (sequences.contains(s)) |
764 |
|
{ |
765 |
0 |
deleteSequence(s, recalc); |
766 |
|
} |
767 |
|
else |
768 |
|
{ |
769 |
0 |
addSequence(s, recalc); |
770 |
|
} |
771 |
|
} |
772 |
|
} |
773 |
|
|
774 |
|
|
775 |
|
|
776 |
|
|
777 |
|
@param |
778 |
|
|
779 |
|
@param |
780 |
|
|
781 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
782 |
0 |
public void deleteSequence(SequenceI s, boolean recalc)... |
783 |
|
{ |
784 |
0 |
synchronized (sequences) |
785 |
|
{ |
786 |
0 |
sequences.remove(s); |
787 |
0 |
changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, |
788 |
|
sequences.size() + 1, sequences.size()); |
789 |
|
|
790 |
0 |
if (recalc) |
791 |
|
{ |
792 |
0 |
recalcConservation(); |
793 |
|
} |
794 |
|
} |
795 |
|
} |
796 |
|
|
797 |
|
|
798 |
|
|
799 |
|
|
800 |
|
@return |
801 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
802 |
0 |
@Override... |
803 |
|
public int getStartRes() |
804 |
|
{ |
805 |
0 |
return startRes; |
806 |
|
} |
807 |
|
|
808 |
|
|
809 |
|
|
810 |
|
@return |
811 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
812 |
0 |
@Override... |
813 |
|
public int getEndRes() |
814 |
|
{ |
815 |
0 |
return endRes; |
816 |
|
} |
817 |
|
|
818 |
|
|
819 |
|
|
820 |
|
|
821 |
|
@param |
822 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
823 |
0 |
public void setStartRes(int newStart)... |
824 |
|
{ |
825 |
0 |
int before = startRes; |
826 |
0 |
startRes = Math.max(0, newStart); |
827 |
|
|
828 |
0 |
changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes); |
829 |
|
|
830 |
|
} |
831 |
|
|
832 |
|
|
833 |
|
|
834 |
|
|
835 |
|
@param |
836 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
837 |
0 |
public void setEndRes(int i)... |
838 |
|
{ |
839 |
0 |
int before = endRes; |
840 |
0 |
endRes = i; |
841 |
0 |
changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, endRes); |
842 |
|
} |
843 |
|
|
844 |
|
|
845 |
|
@return |
846 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
847 |
0 |
public int getSize()... |
848 |
|
{ |
849 |
0 |
return sequences.size(); |
850 |
|
} |
851 |
|
|
852 |
|
|
853 |
|
@param |
854 |
|
@return |
855 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
856 |
0 |
public SequenceI getSequenceAt(int i)... |
857 |
|
{ |
858 |
0 |
return sequences.get(i); |
859 |
|
} |
860 |
|
|
861 |
|
|
862 |
|
@param |
863 |
|
|
864 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
865 |
0 |
public void setColourText(boolean state)... |
866 |
|
{ |
867 |
0 |
colourText = state; |
868 |
|
} |
869 |
|
|
870 |
|
|
871 |
|
|
872 |
|
|
873 |
|
@return |
874 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
875 |
0 |
public boolean getColourText()... |
876 |
|
{ |
877 |
0 |
return colourText; |
878 |
|
} |
879 |
|
|
880 |
|
|
881 |
|
|
882 |
|
|
883 |
|
@param |
884 |
|
|
885 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
886 |
0 |
public void setDisplayText(boolean state)... |
887 |
|
{ |
888 |
0 |
displayText = state; |
889 |
|
} |
890 |
|
|
891 |
|
|
892 |
|
|
893 |
|
|
894 |
|
@return |
895 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
896 |
0 |
public boolean getDisplayText()... |
897 |
|
{ |
898 |
0 |
return displayText; |
899 |
|
} |
900 |
|
|
901 |
|
|
902 |
|
|
903 |
|
|
904 |
|
@param |
905 |
|
|
906 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
907 |
0 |
public void setDisplayBoxes(boolean state)... |
908 |
|
{ |
909 |
0 |
displayBoxes = state; |
910 |
|
} |
911 |
|
|
912 |
|
|
913 |
|
|
914 |
|
|
915 |
|
@return |
916 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
917 |
0 |
public boolean getDisplayBoxes()... |
918 |
|
{ |
919 |
0 |
return displayBoxes; |
920 |
|
} |
921 |
|
|
922 |
|
|
923 |
|
|
924 |
|
|
925 |
|
@return |
926 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
927 |
0 |
@Override... |
928 |
|
public int getWidth() |
929 |
|
{ |
930 |
0 |
synchronized (sequences) |
931 |
|
{ |
932 |
|
|
933 |
0 |
boolean first = true; |
934 |
0 |
for (SequenceI seq : sequences) |
935 |
|
{ |
936 |
0 |
if (first || seq.getLength() > width) |
937 |
|
{ |
938 |
0 |
width = seq.getLength(); |
939 |
0 |
first = false; |
940 |
|
} |
941 |
|
} |
942 |
0 |
return width; |
943 |
|
} |
944 |
|
} |
945 |
|
|
946 |
|
|
947 |
|
|
948 |
|
|
949 |
|
@param |
950 |
|
|
951 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
952 |
0 |
public void setOutlineColour(Color c)... |
953 |
|
{ |
954 |
0 |
outlineColour = c; |
955 |
|
} |
956 |
|
|
957 |
|
|
958 |
|
|
959 |
|
|
960 |
|
@return |
961 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
962 |
0 |
public Color getOutlineColour()... |
963 |
|
{ |
964 |
0 |
return outlineColour; |
965 |
|
} |
966 |
|
|
967 |
|
|
968 |
|
|
969 |
|
|
970 |
|
|
971 |
|
|
972 |
|
|
973 |
|
@param |
974 |
|
|
975 |
|
@return |
976 |
|
|
977 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
978 |
0 |
public SequenceI[] getSequencesInOrder(AlignmentI al)... |
979 |
|
{ |
980 |
0 |
return getSequencesInOrder(al, true); |
981 |
|
} |
982 |
|
|
983 |
|
|
984 |
|
|
985 |
|
|
986 |
|
|
987 |
|
|
988 |
|
@param |
989 |
|
@param |
990 |
|
@return |
991 |
|
|
|
|
| 0% |
Uncovered Elements: 36 (36) |
Complexity: 10 |
Complexity Density: 0.5 |
|
992 |
0 |
public SequenceI[] getSequencesInOrder(AlignmentI al, boolean trim)... |
993 |
|
{ |
994 |
0 |
synchronized (sequences) |
995 |
|
{ |
996 |
0 |
int sSize = sequences.size(); |
997 |
0 |
int alHeight = al.getHeight(); |
998 |
|
|
999 |
0 |
SequenceI[] seqs = new SequenceI[(trim) ? sSize : alHeight]; |
1000 |
|
|
1001 |
0 |
int index = 0; |
1002 |
0 |
for (int i = 0; i < alHeight && index < sSize; i++) |
1003 |
|
{ |
1004 |
0 |
if (sequences.contains(al.getSequenceAt(i))) |
1005 |
|
{ |
1006 |
0 |
seqs[(trim) ? index : i] = al.getSequenceAt(i); |
1007 |
0 |
index++; |
1008 |
|
} |
1009 |
|
} |
1010 |
0 |
if (index == 0) |
1011 |
|
{ |
1012 |
0 |
return null; |
1013 |
|
} |
1014 |
0 |
if (!trim) |
1015 |
|
{ |
1016 |
0 |
return seqs; |
1017 |
|
} |
1018 |
0 |
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 |
0 |
return seqs; |
1029 |
|
} |
1030 |
|
} |
1031 |
|
|
1032 |
|
|
1033 |
|
@return |
1034 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1035 |
0 |
public Color getIdColour()... |
1036 |
|
{ |
1037 |
0 |
return idColour; |
1038 |
|
} |
1039 |
|
|
1040 |
|
|
1041 |
|
@param |
1042 |
|
|
1043 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1044 |
0 |
public void setIdColour(Color idColour)... |
1045 |
|
{ |
1046 |
0 |
this.idColour = idColour; |
1047 |
|
} |
1048 |
|
|
1049 |
|
|
1050 |
|
@return |
1051 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1052 |
0 |
@Override... |
1053 |
|
public SequenceI getSeqrep() |
1054 |
|
{ |
1055 |
0 |
return seqrep; |
1056 |
|
} |
1057 |
|
|
1058 |
|
|
1059 |
|
|
1060 |
|
|
1061 |
|
|
1062 |
|
@param |
1063 |
|
|
1064 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1065 |
0 |
@Override... |
1066 |
|
public void setSeqrep(SequenceI seqrep) |
1067 |
|
{ |
1068 |
0 |
this.seqrep = seqrep; |
1069 |
|
} |
1070 |
|
|
1071 |
|
|
1072 |
|
|
1073 |
|
@return |
1074 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1075 |
0 |
@Override... |
1076 |
|
public boolean hasSeqrep() |
1077 |
|
{ |
1078 |
0 |
return seqrep != null; |
1079 |
|
} |
1080 |
|
|
1081 |
|
|
1082 |
|
|
1083 |
|
|
1084 |
|
|
1085 |
|
@param |
1086 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1087 |
0 |
public void setHidereps(boolean visibility)... |
1088 |
|
{ |
1089 |
0 |
hidereps = visibility; |
1090 |
|
} |
1091 |
|
|
1092 |
|
|
1093 |
|
|
1094 |
|
@return |
1095 |
|
|
1096 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1097 |
0 |
public boolean isHidereps()... |
1098 |
|
{ |
1099 |
0 |
return hidereps; |
1100 |
|
} |
1101 |
|
|
1102 |
|
|
1103 |
|
|
1104 |
|
|
1105 |
|
@param |
1106 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1107 |
0 |
public void setHideCols(boolean visibility)... |
1108 |
|
{ |
1109 |
0 |
hidecols = visibility; |
1110 |
|
} |
1111 |
|
|
1112 |
|
|
1113 |
|
|
1114 |
|
@return |
1115 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1116 |
0 |
public boolean isHideCols()... |
1117 |
|
{ |
1118 |
0 |
return hidecols; |
1119 |
|
} |
1120 |
|
|
1121 |
|
|
1122 |
|
|
1123 |
|
|
1124 |
|
|
1125 |
|
@param |
1126 |
|
|
1127 |
|
@param |
1128 |
|
|
1129 |
|
@return |
1130 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 5 |
Complexity Density: 0.71 |
|
1131 |
0 |
public SequenceGroup intersect(AlignmentI alignment,... |
1132 |
|
Map<SequenceI, SequenceCollectionI> map) |
1133 |
|
{ |
1134 |
0 |
SequenceGroup sgroup = new SequenceGroup(this); |
1135 |
0 |
SequenceI[] insect = getSequencesInOrder(alignment); |
1136 |
0 |
sgroup.sequences = new ArrayList<>(); |
1137 |
0 |
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 |
0 |
return sgroup; |
1145 |
|
} |
1146 |
|
|
1147 |
|
|
1148 |
|
@return |
1149 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1150 |
0 |
public boolean getShowNonconserved()... |
1151 |
|
{ |
1152 |
0 |
return showNonconserved; |
1153 |
|
} |
1154 |
|
|
1155 |
|
|
1156 |
|
@param |
1157 |
|
|
1158 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1159 |
0 |
public void setShowNonconserved(boolean displayNonconserved)... |
1160 |
|
{ |
1161 |
0 |
this.showNonconserved = displayNonconserved; |
1162 |
|
} |
1163 |
|
|
1164 |
|
|
1165 |
|
|
1166 |
|
|
1167 |
|
|
1168 |
|
@param |
1169 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
1170 |
0 |
public void setConsensus(AlignmentAnnotation aan)... |
1171 |
|
{ |
1172 |
0 |
if (consensus == null) |
1173 |
|
{ |
1174 |
0 |
consensus = aan; |
1175 |
|
} |
1176 |
|
} |
1177 |
|
|
1178 |
|
|
1179 |
|
|
1180 |
|
@return |
1181 |
|
|
1182 |
|
|
|
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 3 |
Complexity Density: 0.27 |
|
1183 |
0 |
public AlignmentAnnotation getConsensus()... |
1184 |
|
{ |
1185 |
|
|
1186 |
0 |
int aWidth = this.getWidth(); |
1187 |
|
|
1188 |
|
|
1189 |
|
|
1190 |
0 |
if (aWidth < 0) |
1191 |
|
{ |
1192 |
0 |
return null; |
1193 |
|
} |
1194 |
0 |
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 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
1303 |
0 |
public void setIgnoreGapsConsensus(boolean state)... |
1304 |
|
{ |
1305 |
0 |
if (this.ignoreGapsInConsensus != state && consensus != null) |
1306 |
|
{ |
1307 |
0 |
ignoreGapsInConsensus = state; |
1308 |
0 |
recalcConservation(); |
1309 |
|
} |
1310 |
0 |
ignoreGapsInConsensus = state; |
1311 |
|
} |
1312 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1313 |
0 |
public boolean getIgnoreGapsConsensus()... |
1314 |
|
{ |
1315 |
0 |
return ignoreGapsInConsensus; |
1316 |
|
} |
1317 |
|
|
1318 |
|
|
1319 |
|
@param |
1320 |
|
|
1321 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
1322 |
0 |
public void setshowSequenceLogo(boolean showSequenceLogo)... |
1323 |
|
{ |
1324 |
|
|
1325 |
0 |
if (this.showSequenceLogo != showSequenceLogo && consensus != null) |
1326 |
|
{ |
1327 |
0 |
this.showSequenceLogo = showSequenceLogo; |
1328 |
0 |
recalcConservation(); |
1329 |
|
} |
1330 |
0 |
this.showSequenceLogo = showSequenceLogo; |
1331 |
|
} |
1332 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
1333 |
0 |
public void setshowSequenceSSLogo(boolean showSequenceSSLogo)... |
1334 |
|
{ |
1335 |
|
|
1336 |
0 |
if (this.showSequenceSSLogo != showSequenceSSLogo |
1337 |
|
&& ssConsensus != null) |
1338 |
|
{ |
1339 |
0 |
this.showSequenceSSLogo = showSequenceSSLogo; |
1340 |
0 |
recalcConservation(); |
1341 |
|
} |
1342 |
0 |
this.showSequenceSSLogo = showSequenceSSLogo; |
1343 |
|
} |
1344 |
|
|
1345 |
|
|
1346 |
|
|
1347 |
|
@param |
1348 |
|
|
1349 |
|
|
1350 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
1351 |
0 |
public void setShowConsensusHistogram(boolean showConsHist)... |
1352 |
|
{ |
1353 |
|
|
1354 |
0 |
if (showConsensusHistogram != showConsHist && consensus != null) |
1355 |
|
{ |
1356 |
0 |
this.showConsensusHistogram = showConsHist; |
1357 |
0 |
recalcConservation(); |
1358 |
|
} |
1359 |
0 |
this.showConsensusHistogram = showConsHist; |
1360 |
|
} |
1361 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
1362 |
0 |
public void setShowSSConsensusHistogram(boolean showSSConsHist)... |
1363 |
|
{ |
1364 |
|
|
1365 |
0 |
if (showSSConsensusHistogram != showSSConsHist && consensus != null) |
1366 |
|
{ |
1367 |
0 |
this.showSSConsensusHistogram = showSSConsHist; |
1368 |
0 |
recalcConservation(); |
1369 |
|
} |
1370 |
0 |
this.showSSConsensusHistogram = showSSConsHist; |
1371 |
|
} |
1372 |
|
|
1373 |
|
|
1374 |
|
@return |
1375 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1376 |
0 |
public boolean isShowConsensusHistogram()... |
1377 |
|
{ |
1378 |
0 |
return showConsensusHistogram; |
1379 |
|
} |
1380 |
|
|
1381 |
|
|
1382 |
|
|
1383 |
|
|
1384 |
|
@param |
1385 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1386 |
0 |
public void setNormaliseSequenceLogo(boolean norm)... |
1387 |
|
{ |
1388 |
0 |
normaliseSequenceLogo = norm; |
1389 |
|
} |
1390 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1391 |
0 |
public boolean isNormaliseSequenceLogo()... |
1392 |
|
{ |
1393 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
1463 |
0 |
public void clear()... |
1464 |
|
{ |
1465 |
0 |
synchronized (sequences) |
1466 |
|
{ |
1467 |
0 |
int before = sequences.size(); |
1468 |
0 |
sequences.clear(); |
1469 |
0 |
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 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1486 |
0 |
public void setContext(AnnotatedCollectionI ctx, boolean defined)... |
1487 |
|
{ |
1488 |
0 |
setContext(ctx); |
1489 |
0 |
this.isDefined = defined; |
1490 |
|
} |
1491 |
|
|
1492 |
|
|
1493 |
|
|
1494 |
|
|
1495 |
|
@param |
1496 |
|
|
1497 |
|
@throws |
1498 |
|
|
1499 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
1500 |
0 |
public void setContext(AnnotatedCollectionI ctx)... |
1501 |
|
{ |
1502 |
0 |
AnnotatedCollectionI ref = ctx; |
1503 |
0 |
while (ref != null) |
1504 |
|
{ |
1505 |
0 |
if (ref == this || ref.getContext() == ctx) |
1506 |
|
{ |
1507 |
0 |
throw new IllegalArgumentException( |
1508 |
|
"Circular reference in SequenceGroup.context"); |
1509 |
|
} |
1510 |
0 |
ref = ref.getContext(); |
1511 |
|
} |
1512 |
0 |
this.context = ctx; |
1513 |
|
} |
1514 |
|
|
1515 |
|
|
1516 |
|
|
1517 |
|
|
1518 |
|
@see |
1519 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1520 |
0 |
@Override... |
1521 |
|
public AnnotatedCollectionI getContext() |
1522 |
|
{ |
1523 |
0 |
return context; |
1524 |
|
} |
1525 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1526 |
0 |
public boolean isDefined()... |
1527 |
|
{ |
1528 |
0 |
return isDefined; |
1529 |
|
} |
1530 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1531 |
0 |
public void setColourScheme(ColourSchemeI scheme)... |
1532 |
|
{ |
1533 |
0 |
if (cs == null) |
1534 |
|
{ |
1535 |
0 |
cs = new ResidueShader(); |
1536 |
|
} |
1537 |
0 |
cs.setColourScheme(scheme); |
1538 |
|
} |
1539 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1540 |
0 |
public void setGroupColourScheme(ResidueShaderI scheme)... |
1541 |
|
{ |
1542 |
0 |
cs = scheme; |
1543 |
|
} |
1544 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
1545 |
0 |
public ColourSchemeI getColourScheme()... |
1546 |
|
{ |
1547 |
0 |
return cs == null ? null : cs.getColourScheme(); |
1548 |
|
} |
1549 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1550 |
0 |
public ResidueShaderI getGroupColourScheme()... |
1551 |
|
{ |
1552 |
0 |
return cs; |
1553 |
|
} |
1554 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1555 |
0 |
@Override... |
1556 |
|
public boolean isNucleotide() |
1557 |
|
{ |
1558 |
0 |
if (context != null) |
1559 |
|
{ |
1560 |
0 |
return context.isNucleotide(); |
1561 |
|
} |
1562 |
0 |
return false; |
1563 |
|
} |
1564 |
|
|
1565 |
|
|
1566 |
|
@param |
1567 |
|
@return |
1568 |
|
|
1569 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1570 |
0 |
public boolean contains(SequenceI seq1)... |
1571 |
|
{ |
1572 |
0 |
return sequences.contains(seq1); |
1573 |
|
} |
1574 |
|
|
1575 |
|
|
1576 |
|
@param |
1577 |
|
@param |
1578 |
|
@return |
1579 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1580 |
0 |
public boolean contains(SequenceI seq, int apos)... |
1581 |
|
{ |
1582 |
0 |
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 |
|
} |