| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package jalview.workers; |
| 22 |
|
|
| 23 |
|
import jalview.analysis.Conservation; |
| 24 |
|
import jalview.api.AlignViewportI; |
| 25 |
|
import jalview.api.AlignmentViewPanel; |
| 26 |
|
import jalview.datamodel.AlignmentAnnotation; |
| 27 |
|
import jalview.datamodel.AlignmentI; |
| 28 |
|
|
| 29 |
|
import java.util.ArrayList; |
| 30 |
|
import java.util.List; |
| 31 |
|
|
| |
|
| 0% |
Uncovered Elements: 42 (42) |
Complexity: 19 |
Complexity Density: 0.68 |
|
| 32 |
|
public class ConservationThread extends AlignCalcWorker |
| 33 |
|
{ |
| 34 |
|
|
| 35 |
|
private int ConsPercGaps = 25; |
| 36 |
|
|
| 37 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 38 |
0 |
public ConservationThread(AlignViewportI alignViewport,... |
| 39 |
|
AlignmentViewPanel alignPanel) |
| 40 |
|
{ |
| 41 |
0 |
super(alignViewport, alignPanel); |
| 42 |
0 |
ConsPercGaps = alignViewport.getConsPercGaps(); |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
private Conservation cons; |
| 46 |
|
|
| 47 |
|
AlignmentAnnotation conservation, quality; |
| 48 |
|
|
| 49 |
|
int alWidth; |
| 50 |
|
|
| |
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 11 |
Complexity Density: 0.5 |
|
| 51 |
0 |
@Override... |
| 52 |
|
public void run() |
| 53 |
|
{ |
| 54 |
0 |
if ((alignViewport == null) || (calcMan == null) |
| 55 |
|
|| (alignViewport.isClosed())) |
| 56 |
|
{ |
| 57 |
0 |
abortAndDestroy(); |
| 58 |
0 |
return; |
| 59 |
|
} |
| 60 |
0 |
List<AlignmentAnnotation> ourAnnot = new ArrayList<>(); |
| 61 |
0 |
AlignmentI alignment = alignViewport.getAlignment(); |
| 62 |
0 |
conservation = alignViewport.getAlignmentConservationAnnotation(); |
| 63 |
0 |
quality = alignViewport.getAlignmentQualityAnnot(); |
| 64 |
0 |
ourAnnot.add(conservation); |
| 65 |
0 |
ourAnnot.add(quality); |
| 66 |
0 |
ourAnnots = ourAnnot; |
| 67 |
0 |
ConsPercGaps = alignViewport.getConsPercGaps(); |
| 68 |
|
|
| 69 |
|
|
| 70 |
0 |
if (alignment == null || (alWidth = alignment.getWidth()) < 0) |
| 71 |
|
{ |
| 72 |
|
|
| 73 |
|
|
| 74 |
0 |
return; |
| 75 |
|
} |
| 76 |
0 |
try |
| 77 |
|
{ |
| 78 |
0 |
cons = Conservation.calculateConservation("All", |
| 79 |
|
alignment.getSequences(), 0, alWidth - 1, false, |
| 80 |
|
ConsPercGaps, quality != null); |
| 81 |
|
} catch (IndexOutOfBoundsException x) |
| 82 |
|
{ |
| 83 |
|
|
| 84 |
0 |
return; |
| 85 |
|
} |
| 86 |
0 |
updateResultAnnotation(true); |
| 87 |
|
|
| 88 |
0 |
if ((alignViewport == null) || (calcMan == null) |
| 89 |
|
|| (alignViewport.isClosed())) |
| 90 |
|
{ |
| 91 |
0 |
abortAndDestroy(); |
| 92 |
0 |
return; |
| 93 |
|
} |
| 94 |
0 |
if (ap != null) |
| 95 |
|
{ |
| 96 |
0 |
ap.paintAlignment(true, true); |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
} |
| 100 |
|
|
| |
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 6 |
Complexity Density: 2 |
|
| 101 |
0 |
private void updateResultAnnotation(boolean b)... |
| 102 |
|
{ |
| 103 |
0 |
if (b || !calcMan.isWorking(this) && cons != null |
| 104 |
|
&& conservation != null && quality != null) |
| 105 |
|
{ |
| 106 |
0 |
alignViewport.setConservation(cons); |
| 107 |
0 |
cons.completeAnnotations(conservation, quality, 0, alWidth); |
| 108 |
|
} |
| 109 |
|
} |
| 110 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 111 |
0 |
@Override... |
| 112 |
|
public void updateAnnotation() |
| 113 |
|
{ |
| 114 |
0 |
updateResultAnnotation(false); |
| 115 |
|
|
| 116 |
|
} |
| 117 |
|
} |