X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=bin%2Fjalview%2Fworkers%2FStrucConsensusThread.js;h=dbe6d50a176bc520dfc219e7a00e0fc3a5186a82;hp=4010f84a002518c99ce3d0a32a69d3d6aefa43b8;hb=8ffd05b3abe52c0b6b79b011c0966361f82d5fe6;hpb=6154cb57a6eac3bb1344b8342495f5bb701ee921 diff --git a/bin/jalview/workers/StrucConsensusThread.js b/bin/jalview/workers/StrucConsensusThread.js index 4010f84..dbe6d50 100644 --- a/bin/jalview/workers/StrucConsensusThread.js +++ b/bin/jalview/workers/StrucConsensusThread.js @@ -1,95 +1,95 @@ -Clazz.declarePackage ("jalview.workers"); -Clazz.load (["jalview.api.AlignCalcWorkerI", "jalview.workers.AlignCalcWorker"], "jalview.workers.StrucConsensusThread", ["jalview.analysis.StructureFrequency", "java.lang.Thread"], function () { -c$ = Clazz.decorateAsClass (function () { -this.strucConsensus = null; -this.hStrucConsensus = null; -this.nseq = -1; -Clazz.instantialize (this, arguments); -}, jalview.workers, "StrucConsensusThread", jalview.workers.AlignCalcWorker, jalview.api.AlignCalcWorkerI); -Clazz.overrideMethod (c$, "getNewWorker", -function () { -return new jalview.workers.StrucConsensusThread (this.alignViewport, this.ap); -}); -Clazz.overrideMethod (c$, "run", -function () { -try { -if (this.calcMan.isPending (this)) { -return; -}this.calcMan.notifyStart (this); -while (!this.calcMan.notifyWorking (this)) { -try { -if (this.ap != null) { -}Thread.sleep (200); -} catch (ex) { -if (Clazz.exceptionOf (ex, Exception)) { -ex.printStackTrace (); -} else { -throw ex; -} -} -} -if (this.alignViewport.isClosed ()) { -this.abortAndDestroy (); -return; -}var alignment = this.alignViewport.getAlignment (); -var aWidth = -1; -if (alignment == null || (aWidth = alignment.getWidth ()) < 0) { -this.calcMan.workerComplete (this); -return; -}this.strucConsensus = this.alignViewport.getAlignmentStrucConsensusAnnotation (); -this.hStrucConsensus = this.alignViewport.getRnaStructureConsensusHash (); -this.strucConsensus.annotations = null; -this.strucConsensus.annotations = new Array (aWidth); -this.hStrucConsensus = new Array (aWidth); -var aa = this.alignViewport.getAlignment ().getAlignmentAnnotation (); -var rnaStruc = null; -for (var i = 0; i < aa.length; i++) { -if (aa[i].getRNAStruc () != null && aa[i].isValidStruc ()) { -rnaStruc = aa[i]; -break; -}} -if (rnaStruc == null || !rnaStruc.isValidStruc ()) { -this.calcMan.workerComplete (this); -return; -}try { -var arr = alignment.getSequencesArray (); -this.nseq = arr.length; -jalview.analysis.StructureFrequency.calculate (arr, 0, alignment.getWidth (), this.hStrucConsensus, true, rnaStruc); -} catch (x) { -if (Clazz.exceptionOf (x, ArrayIndexOutOfBoundsException)) { -this.calcMan.workerComplete (this); -return; -} else { -throw x; -} -} -this.alignViewport.setRnaStructureConsensusHash (this.hStrucConsensus); -this.updateResultAnnotation (true); -if (this.alignViewport.getGlobalColourScheme () != null) { -this.alignViewport.getGlobalColourScheme ().setConsensus (this.hStrucConsensus); -}} catch (error) { -if (Clazz.exceptionOf (error, OutOfMemoryError)) { -this.calcMan.workerCannotRun (this); -this.ap.raiseOOMWarning ("calculating RNA structure consensus", error); -} else { -throw error; -} -} finally { -this.calcMan.workerComplete (this); -if (this.ap != null) { -this.ap.paintAlignment (true); -}} -}); -Clazz.overrideMethod (c$, "updateAnnotation", -function () { -this.updateResultAnnotation (false); -}); -Clazz.defineMethod (c$, "updateResultAnnotation", -function (immediate) { -if (immediate || !this.calcMan.isWorking (this) && this.strucConsensus != null && this.hStrucConsensus != null) { -jalview.analysis.StructureFrequency.completeConsensus (this.strucConsensus, this.hStrucConsensus, 0, this.hStrucConsensus.length, this.alignViewport.isIgnoreGapsConsensus (), this.alignViewport.isShowSequenceLogo (), this.nseq); -}}, "~B"); -Clazz.overrideMethod (c$, "run1", -function (state) { -}, "~N"); -}); +Clazz.declarePackage ("jalview.workers"); +Clazz.load (["jalview.api.AlignCalcWorkerI", "jalview.workers.AlignCalcWorker"], "jalview.workers.StrucConsensusThread", ["jalview.analysis.StructureFrequency", "java.lang.Thread"], function () { +c$ = Clazz.decorateAsClass (function () { +this.strucConsensus = null; +this.hStrucConsensus = null; +this.nseq = -1; +Clazz.instantialize (this, arguments); +}, jalview.workers, "StrucConsensusThread", jalview.workers.AlignCalcWorker, jalview.api.AlignCalcWorkerI); +Clazz.overrideMethod (c$, "getNewWorker", +function () { +return new jalview.workers.StrucConsensusThread (this.alignViewport, this.ap); +}); +Clazz.overrideMethod (c$, "run", +function () { +try { +if (this.calcMan.isPending (this)) { +return; +}this.calcMan.notifyStart (this); +while (!this.calcMan.notifyWorking (this)) { +try { +if (this.ap != null) { +}Thread.sleep (200); +} catch (ex) { +if (Clazz.exceptionOf (ex, Exception)) { +ex.printStackTrace (); +} else { +throw ex; +} +} +} +if (this.alignViewport.isClosed ()) { +this.abortAndDestroy (); +return; +}var alignment = this.alignViewport.getAlignment (); +var aWidth = -1; +if (alignment == null || (aWidth = alignment.getWidth ()) < 0) { +this.calcMan.workerComplete (this); +return; +}this.strucConsensus = this.alignViewport.getAlignmentStrucConsensusAnnotation (); +this.hStrucConsensus = this.alignViewport.getRnaStructureConsensusHash (); +this.strucConsensus.annotations = null; +this.strucConsensus.annotations = new Array (aWidth); +this.hStrucConsensus = new Array (aWidth); +var aa = this.alignViewport.getAlignment ().getAlignmentAnnotation (); +var rnaStruc = null; +for (var i = 0; i < aa.length; i++) { +if (aa[i].getRNAStruc () != null && aa[i].isValidStruc ()) { +rnaStruc = aa[i]; +break; +}} +if (rnaStruc == null || !rnaStruc.isValidStruc ()) { +this.calcMan.workerComplete (this); +return; +}try { +var arr = alignment.getSequencesArray (); +this.nseq = arr.length; +jalview.analysis.StructureFrequency.calculate (arr, 0, alignment.getWidth (), this.hStrucConsensus, true, rnaStruc); +} catch (x) { +if (Clazz.exceptionOf (x, ArrayIndexOutOfBoundsException)) { +this.calcMan.workerComplete (this); +return; +} else { +throw x; +} +} +this.alignViewport.setRnaStructureConsensusHash (this.hStrucConsensus); +this.updateResultAnnotation (true); +if (this.alignViewport.getGlobalColourScheme () != null) { +this.alignViewport.getGlobalColourScheme ().setConsensus (this.hStrucConsensus); +}} catch (error) { +if (Clazz.exceptionOf (error, OutOfMemoryError)) { +this.calcMan.workerCannotRun (this); +this.ap.raiseOOMWarning ("calculating RNA structure consensus", error); +} else { +throw error; +} +} finally { +this.calcMan.workerComplete (this); +if (this.ap != null) { +this.ap.paintAlignment (true); +}} +}); +Clazz.overrideMethod (c$, "updateAnnotation", +function () { +this.updateResultAnnotation (false); +}); +Clazz.defineMethod (c$, "updateResultAnnotation", +function (immediate) { +if (immediate || !this.calcMan.isWorking (this) && this.strucConsensus != null && this.hStrucConsensus != null) { +jalview.analysis.StructureFrequency.completeConsensus (this.strucConsensus, this.hStrucConsensus, 0, this.hStrucConsensus.length, this.alignViewport.isIgnoreGapsConsensus (), this.alignViewport.isShowSequenceLogo (), this.nseq); +}}, "~B"); +Clazz.overrideMethod (c$, "run1", +function (state) { +}, "~N"); +});