JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / jalview / workers / ComplementConsensusThread.js
1 Clazz.declarePackage ("jalview.workers");\r
2 Clazz.load (["jalview.workers.ConsensusThread"], "jalview.workers.ComplementConsensusThread", ["jalview.analysis.AAFrequency"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.mappings = null;\r
5 Clazz.instantialize (this, arguments);\r
6 }, jalview.workers, "ComplementConsensusThread", jalview.workers.ConsensusThread);\r
7 Clazz.overrideMethod (c$, "getNewWorker", \r
8 function () {\r
9 return  new jalview.workers.ComplementConsensusThread (this.alignViewport, this.ap);\r
10 });\r
11 Clazz.overrideMethod (c$, "getConsensusAnnotation", \r
12 function () {\r
13 return this.alignViewport.getComplementConsensusAnnotation ();\r
14 });\r
15 Clazz.overrideMethod (c$, "getViewportConsensus", \r
16 function () {\r
17 return this.alignViewport.getComplementConsensusHash ();\r
18 });\r
19 Clazz.defineMethod (c$, "initializeCalc", \r
20 function () {\r
21 this.mappings = this.alignment.getCodonFrames ();\r
22 return (this.mappings != null && !this.mappings.isEmpty () && Clazz.superCall (this, jalview.workers.ComplementConsensusThread, "initializeCalc", []));\r
23 });\r
24 Clazz.overrideMethod (c$, "computeConsensus", \r
25 function () {\r
26 for (var i = 0; i < 3; i++) {\r
27 try {\r
28 jalview.analysis.AAFrequency.calculateCdna (this.alignment, this.mappings, this.hconsensus, this.iFirst, this.iLast);\r
29 break;\r
30 } catch (e) {\r
31 if (Clazz.exceptionOf (e, java.util.ConcurrentModificationException)) {\r
32 } else {\r
33 throw e;\r
34 }\r
35 }\r
36 }\r
37 });\r
38 Clazz.overrideMethod (c$, "finalizeCalc", \r
39 function () {\r
40 this.alignViewport.setComplementConsensusHash (this.hconsensus);\r
41 });\r
42 Clazz.overrideMethod (c$, "deriveConsensus", \r
43 function (consensusAnnotation, consensusData) {\r
44 jalview.analysis.AAFrequency.completeCdnaConsensus (consensusAnnotation, consensusData, this.alignViewport.isShowSequenceLogo (), this.getSequences ().length);\r
45 }, "jalview.datamodel.AlignmentAnnotation,~A");\r
46 });\r