1 Clazz.declarePackage ("jalview.workers");
2 Clazz.load (["jalview.api.AlignCalcWorkerI", "jalview.workers.AlignCalcWorker"], "jalview.workers.ConservationThread", ["jalview.analysis.Conservation", "jalview.schemes.ResidueProperties", "java.util.ArrayList"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.ConsPercGaps = 25;
6 this.conservation = null;
8 Clazz.instantialize (this, arguments);
9 }, jalview.workers, "ConservationThread", jalview.workers.AlignCalcWorker, jalview.api.AlignCalcWorkerI);
10 Clazz.overrideMethod (c$, "getNewWorker",
12 return new jalview.workers.ConservationThread (this.alignViewport, this.ap);
14 Clazz.makeConstructor (c$,
15 function (alignViewport, alignPanel) {
16 Clazz.superConstructor (this, jalview.workers.ConservationThread, [alignViewport, alignPanel]);
17 this.ConsPercGaps = alignViewport.getConsPercGaps ();
18 }, "jalview.api.AlignViewportI,jalview.api.AlignmentViewPanel");
19 Clazz.overrideMethod (c$, "run1",
21 while (!Thread.interrupted ()) {
25 if (this.calcMan.isPending (this)) return;
26 this.calcMan.notifyStart (this);
30 while (!this.calcMan.notifyWorking (this)) {
31 if (this.ap != null) {
32 this.ap.paintAlignment (false);
34 if (this.sleepAndReturn (200, state)) return;
36 if (Clazz.exceptionOf (e, InterruptedException)) {
44 if (this.alignViewport.isClosed ()) {
45 this.abortAndDestroy ();
48 }var ourAnnot = new java.util.ArrayList ();
49 this.alignment = this.alignViewport.getAlignment ();
50 this.conservation = this.alignViewport.getAlignmentConservationAnnotation ();
51 this.quality = this.alignViewport.getAlignmentQualityAnnot ();
52 ourAnnot.add (this.conservation);
53 ourAnnot.add (this.quality);
54 this.ourAnnots = ourAnnot;
55 this.ConsPercGaps = this.alignViewport.getConsPercGaps ();
56 if (this.alignment == null || (this.aWidth = this.alignment.getWidth ()) < 0) {
57 this.calcMan.workerComplete (this);
62 this.iFirst = this.iLast;
63 this.nPer = this.aWidth + 1;
64 this.iLast = Math.min (this.iLast + this.nPer, this.aWidth);
65 if (this.iLast == this.iFirst) {
68 this.computeConsensus ();
69 if (this.sleepAndReturn (0, state)) return;
72 this.updateResultAnnotation (true);
77 if (Clazz.exceptionOf (e$$, OutOfMemoryError)) {
80 this.calcMan.workerCannotRun (this);
81 this.ap.raiseOOMWarning ("calculating conservation", error);
86 System.out.println ("Error in ConsensusThread: " + e);
88 this.calcMan.workerComplete (this);
94 Clazz.defineMethod (c$, "computeConsensus",
96 this.cons = jalview.analysis.Conservation.calculateConservation ("All", jalview.schemes.ResidueProperties.propHash, 3, this.alignment.getSequences (), 0, this.aWidth - 1, false, this.ConsPercGaps, this.quality != null);
97 }, $fz.isPrivate = true, $fz));
98 Clazz.defineMethod (c$, "updateResultAnnotation",
100 if (b || !this.calcMan.isWorking (this) && this.cons != null && this.conservation != null && this.quality != null) {
101 this.alignViewport.setConservation (this.cons);
102 this.cons.completeAnnotations (this.conservation, this.quality, 0, this.aWidth);
103 }}, $fz.isPrivate = true, $fz), "~B");
104 Clazz.overrideMethod (c$, "updateAnnotation",
106 this.updateResultAnnotation (false);