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