| 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.api.AlignViewportI; |
| 24 |
|
import jalview.api.AlignmentViewPanel; |
| 25 |
|
import jalview.datamodel.AlignmentAnnotation; |
| 26 |
|
import jalview.datamodel.AlignmentI; |
| 27 |
|
import jalview.renderer.seqfeatures.FeatureRenderer; |
| 28 |
|
|
| 29 |
|
import java.util.ArrayList; |
| 30 |
|
import java.util.List; |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| |
|
| 67.3% |
Uncovered Elements: 16 (49) |
Complexity: 12 |
Complexity Density: 0.34 |
|
| 37 |
|
class AnnotationWorker extends AlignCalcWorker |
| 38 |
|
{ |
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
AnnotationProviderI counter; |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
@param |
| 48 |
|
@param |
| 49 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 50 |
2 |
public AnnotationWorker(AlignViewportI viewport, AlignmentViewPanel panel,... |
| 51 |
|
AnnotationProviderI counter) |
| 52 |
|
{ |
| 53 |
2 |
super(viewport, panel); |
| 54 |
2 |
ourAnnots = new ArrayList<>(); |
| 55 |
2 |
this.counter = counter; |
| 56 |
2 |
calcMan.registerWorker(this); |
| 57 |
|
} |
| 58 |
|
|
| |
|
| 67.5% |
Uncovered Elements: 13 (40) |
Complexity: 9 |
Complexity Density: 0.3 |
|
| 59 |
2 |
@Override... |
| 60 |
|
public void run() |
| 61 |
|
{ |
| 62 |
2 |
try |
| 63 |
|
{ |
| 64 |
2 |
calcMan.notifyStart(this); |
| 65 |
|
|
| 66 |
2 |
while (!calcMan.notifyWorking(this)) |
| 67 |
|
{ |
| 68 |
0 |
try |
| 69 |
|
{ |
| 70 |
0 |
Thread.sleep(200); |
| 71 |
|
} catch (InterruptedException ex) |
| 72 |
|
{ |
| 73 |
0 |
ex.printStackTrace(); |
| 74 |
|
} |
| 75 |
|
} |
| 76 |
2 |
if (alignViewport.isClosed()) |
| 77 |
|
{ |
| 78 |
0 |
abortAndDestroy(); |
| 79 |
0 |
return; |
| 80 |
|
} |
| 81 |
|
|
| 82 |
|
|
| 83 |
2 |
AlignmentI alignment = alignViewport.getAlignment(); |
| 84 |
2 |
if (alignment != null) |
| 85 |
|
{ |
| 86 |
2 |
try |
| 87 |
|
{ |
| 88 |
2 |
List<AlignmentAnnotation> anns = counter.calculateAnnotation( |
| 89 |
|
alignment, new FeatureRenderer(alignViewport)); |
| 90 |
2 |
for (AlignmentAnnotation ann : anns) |
| 91 |
|
{ |
| 92 |
2 |
AlignmentAnnotation theAnn = alignment.findOrCreateAnnotation( |
| 93 |
|
ann.label, ann.description, false, null, null); |
| 94 |
2 |
theAnn.showAllColLabels = true; |
| 95 |
2 |
theAnn.graph = AlignmentAnnotation.BAR_GRAPH; |
| 96 |
2 |
theAnn.scaleColLabel = true; |
| 97 |
2 |
theAnn.annotations = ann.annotations; |
| 98 |
2 |
setGraphMinMax(theAnn, theAnn.annotations); |
| 99 |
2 |
theAnn.validateRangeAndDisplay(); |
| 100 |
2 |
if (!ourAnnots.contains(theAnn)) |
| 101 |
|
{ |
| 102 |
2 |
ourAnnots.add(theAnn); |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
} |
| 106 |
|
} catch (IndexOutOfBoundsException x) |
| 107 |
|
{ |
| 108 |
|
|
| 109 |
0 |
return; |
| 110 |
|
} |
| 111 |
|
} |
| 112 |
|
} catch (OutOfMemoryError error) |
| 113 |
|
{ |
| 114 |
0 |
ap.raiseOOMWarning("calculating annotations", error); |
| 115 |
0 |
calcMan.disableWorker(this); |
| 116 |
|
} finally |
| 117 |
|
{ |
| 118 |
2 |
calcMan.workerComplete(this); |
| 119 |
|
} |
| 120 |
|
|
| 121 |
2 |
if (ap != null) |
| 122 |
|
{ |
| 123 |
2 |
ap.adjustAnnotationHeight(); |
| 124 |
|
|
| 125 |
|
|
| 126 |
|
|
| 127 |
2 |
ap.paintAlignment(true, true); |
| 128 |
|
} |
| 129 |
|
} |
| 130 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 131 |
0 |
@Override... |
| 132 |
|
public void updateAnnotation() |
| 133 |
|
{ |
| 134 |
|
|
| 135 |
|
} |
| 136 |
|
|
| 137 |
|
|
| 138 |
|
|
| 139 |
|
|
| 140 |
|
|
| 141 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 142 |
0 |
@Override... |
| 143 |
|
public boolean isDeletable() |
| 144 |
|
{ |
| 145 |
0 |
return true; |
| 146 |
|
} |
| 147 |
|
} |