X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fjalview%2Fworkers%2FConservationThread.js;h=072fbdcdb305aa58d7b834ce00f77158d1dfbaea;hp=83e54e71f011d4e46a0d641c39e6190b2696dfd3;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=8ffd05b3abe52c0b6b79b011c0966361f82d5fe6 diff --git a/site/j2s/jalview/workers/ConservationThread.js b/site/j2s/jalview/workers/ConservationThread.js index 83e54e7..072fbdc 100644 --- a/site/j2s/jalview/workers/ConservationThread.js +++ b/site/j2s/jalview/workers/ConservationThread.js @@ -1,108 +1,108 @@ -Clazz.declarePackage ("jalview.workers"); -Clazz.load (["jalview.api.AlignCalcWorkerI", "jalview.workers.AlignCalcWorker"], "jalview.workers.ConservationThread", ["jalview.analysis.Conservation", "jalview.schemes.ResidueProperties", "java.util.ArrayList"], function () { -c$ = Clazz.decorateAsClass (function () { -this.ConsPercGaps = 25; -this.cons = null; -this.conservation = null; -this.quality = null; -Clazz.instantialize (this, arguments); -}, jalview.workers, "ConservationThread", jalview.workers.AlignCalcWorker, jalview.api.AlignCalcWorkerI); -Clazz.overrideMethod (c$, "getNewWorker", -function () { -return new jalview.workers.ConservationThread (this.alignViewport, this.ap); -}); -Clazz.makeConstructor (c$, -function (alignViewport, alignPanel) { -Clazz.superConstructor (this, jalview.workers.ConservationThread, [alignViewport, alignPanel]); -this.ConsPercGaps = alignViewport.getConsPercGaps (); -}, "jalview.api.AlignViewportI,jalview.api.AlignmentViewPanel"); -Clazz.overrideMethod (c$, "run1", -function (state) { -while (!Thread.interrupted ()) { -try { -switch (state) { -case 0: -if (this.calcMan.isPending (this)) return; -this.calcMan.notifyStart (this); -state = 3; -break; -case 3: -while (!this.calcMan.notifyWorking (this)) { -if (this.ap != null) { -this.ap.paintAlignment (false); -}try { -if (this.sleepAndReturn (200, state)) return; -} catch (e) { -if (Clazz.exceptionOf (e, InterruptedException)) { -state = 2; -break; -} else { -throw e; -} -} -} -if (this.alignViewport.isClosed ()) { -this.abortAndDestroy (); -state = 2; -break; -}var ourAnnot = new java.util.ArrayList (); -this.alignment = this.alignViewport.getAlignment (); -this.conservation = this.alignViewport.getAlignmentConservationAnnotation (); -this.quality = this.alignViewport.getAlignmentQualityAnnot (); -ourAnnot.add (this.conservation); -ourAnnot.add (this.quality); -this.ourAnnots = ourAnnot; -this.ConsPercGaps = this.alignViewport.getConsPercGaps (); -if (this.alignment == null || (this.aWidth = this.alignment.getWidth ()) < 0) { -this.calcMan.workerComplete (this); -return; -}state = 4; -break; -case 4: -this.iFirst = this.iLast; -this.nPer = this.aWidth + 1; -this.iLast = Math.min (this.iLast + this.nPer, this.aWidth); -if (this.iLast == this.iFirst) { -state = 2; -} else { -this.computeConsensus (); -if (this.sleepAndReturn (0, state)) return; -}break; -case 2: -this.updateResultAnnotation (true); -this.notifyDone (); -return; -} -} catch (e$$) { -if (Clazz.exceptionOf (e$$, OutOfMemoryError)) { -var error = e$$; -{ -this.calcMan.workerCannotRun (this); -this.ap.raiseOOMWarning ("calculating conservation", error); -} -} else { -var e = e$$; -{ -System.out.println ("Error in ConsensusThread: " + e); -e.printStackTrace (); -this.calcMan.workerComplete (this); -} -} -} -} -}, "~N"); -Clazz.defineMethod (c$, "computeConsensus", - function () { -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); -}); -Clazz.defineMethod (c$, "updateResultAnnotation", - function (b) { -if (b || !this.calcMan.isWorking (this) && this.cons != null && this.conservation != null && this.quality != null) { -this.alignViewport.setConservation (this.cons); -this.cons.completeAnnotations (this.conservation, this.quality, 0, this.aWidth); -}}, "~B"); -Clazz.overrideMethod (c$, "updateAnnotation", -function () { -this.updateResultAnnotation (false); -}); -}); +Clazz.declarePackage ("jalview.workers"); +Clazz.load (["jalview.api.AlignCalcWorkerI", "jalview.workers.AlignCalcWorker"], "jalview.workers.ConservationThread", ["jalview.analysis.Conservation", "jalview.schemes.ResidueProperties", "java.util.ArrayList"], function () { +c$ = Clazz.decorateAsClass (function () { +this.ConsPercGaps = 25; +this.cons = null; +this.conservation = null; +this.quality = null; +Clazz.instantialize (this, arguments); +}, jalview.workers, "ConservationThread", jalview.workers.AlignCalcWorker, jalview.api.AlignCalcWorkerI); +Clazz.overrideMethod (c$, "getNewWorker", +function () { +return new jalview.workers.ConservationThread (this.alignViewport, this.ap); +}); +Clazz.makeConstructor (c$, +function (alignViewport, alignPanel) { +Clazz.superConstructor (this, jalview.workers.ConservationThread, [alignViewport, alignPanel]); +this.ConsPercGaps = alignViewport.getConsPercGaps (); +}, "jalview.api.AlignViewportI,jalview.api.AlignmentViewPanel"); +Clazz.overrideMethod (c$, "run1", +function (state) { +while (!Thread.interrupted ()) { +try { +switch (state) { +case 0: +if (this.calcMan.isPending (this)) return; +this.calcMan.notifyStart (this); +state = 3; +break; +case 3: +while (!this.calcMan.notifyWorking (this)) { +if (this.ap != null) { +this.ap.paintAlignment (false); +}try { +if (this.sleepAndReturn (200, state)) return; +} catch (e) { +if (Clazz.exceptionOf (e, InterruptedException)) { +state = 2; +break; +} else { +throw e; +} +} +} +if (this.alignViewport.isClosed ()) { +this.abortAndDestroy (); +state = 2; +break; +}var ourAnnot = new java.util.ArrayList (); +this.alignment = this.alignViewport.getAlignment (); +this.conservation = this.alignViewport.getAlignmentConservationAnnotation (); +this.quality = this.alignViewport.getAlignmentQualityAnnot (); +ourAnnot.add (this.conservation); +ourAnnot.add (this.quality); +this.ourAnnots = ourAnnot; +this.ConsPercGaps = this.alignViewport.getConsPercGaps (); +if (this.alignment == null || (this.aWidth = this.alignment.getWidth ()) < 0) { +this.calcMan.workerComplete (this); +return; +}state = 4; +break; +case 4: +this.iFirst = this.iLast; +this.nPer = this.aWidth + 1; +this.iLast = Math.min (this.iLast + this.nPer, this.aWidth); +if (this.iLast == this.iFirst) { +state = 2; +} else { +this.computeConsensus (); +if (this.sleepAndReturn (0, state)) return; +}break; +case 2: +this.updateResultAnnotation (true); +this.notifyDone (); +return; +} +} catch (e$$) { +if (Clazz.exceptionOf (e$$, OutOfMemoryError)) { +var error = e$$; +{ +this.calcMan.workerCannotRun (this); +this.ap.raiseOOMWarning ("calculating conservation", error); +} +} else { +var e = e$$; +{ +System.out.println ("Error in ConsensusThread: " + e); +e.printStackTrace (); +this.calcMan.workerComplete (this); +} +} +} +} +}, "~N"); +Clazz.defineMethod (c$, "computeConsensus", + function () { +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); +}); +Clazz.defineMethod (c$, "updateResultAnnotation", + function (b) { +if (b || !this.calcMan.isWorking (this) && this.cons != null && this.conservation != null && this.quality != null) { +this.alignViewport.setConservation (this.cons); +this.cons.completeAnnotations (this.conservation, this.quality, 0, this.aWidth); +}}, "~B"); +Clazz.overrideMethod (c$, "updateAnnotation", +function () { +this.updateResultAnnotation (false); +}); +});