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