JAL-1807 test
[jalviewjs.git] / bin / jalview / datamodel / AlignedCodonFrame.js
index 8d854b4..043b032 100644 (file)
-Clazz.declarePackage ("jalview.datamodel");\r
-Clazz.load (null, "jalview.datamodel.AlignedCodonFrame", ["jalview.datamodel.Mapping", "jalview.util.MappingUtils", "java.util.ArrayList"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.dnaSeqs = null;\r
-this.dnaToProt = null;\r
-Clazz.instantialize (this, arguments);\r
-}, jalview.datamodel, "AlignedCodonFrame");\r
-Clazz.makeConstructor (c$, \r
-function () {\r
-});\r
-Clazz.defineMethod (c$, "addMap", \r
-function (dnaseq, aaseq, map) {\r
-var nlen = 1;\r
-if (this.dnaSeqs != null) {\r
-nlen = this.dnaSeqs.length + 1;\r
-}var ndna =  new Array (nlen);\r
-var ndtp =  new Array (nlen);\r
-if (this.dnaSeqs != null) {\r
-System.arraycopy (this.dnaSeqs, 0, ndna, 0, this.dnaSeqs.length);\r
-System.arraycopy (this.dnaToProt, 0, ndtp, 0, this.dnaSeqs.length);\r
-}this.dnaSeqs = ndna;\r
-this.dnaToProt = ndtp;\r
-nlen--;\r
-this.dnaSeqs[nlen] = (dnaseq.getDatasetSequence () == null) ? dnaseq : dnaseq.getDatasetSequence ();\r
-var mp =  new jalview.datamodel.Mapping (map);\r
-mp.to = (aaseq.getDatasetSequence () == null) ? aaseq : aaseq.getDatasetSequence ();\r
-this.dnaToProt[nlen] = mp;\r
-}, "jalview.datamodel.SequenceI,jalview.datamodel.SequenceI,jalview.util.MapList");\r
-Clazz.defineMethod (c$, "getdnaSeqs", \r
-function () {\r
-return this.dnaSeqs;\r
-});\r
-Clazz.defineMethod (c$, "getAaSeqs", \r
-function () {\r
-if (this.dnaToProt == null) {\r
-return null;\r
-}var sqs =  new Array (this.dnaToProt.length);\r
-for (var sz = 0; sz < this.dnaToProt.length; sz++) {\r
-sqs[sz] = this.dnaToProt[sz].to;\r
-}\r
-return sqs;\r
-});\r
-Clazz.defineMethod (c$, "getdnaToProt", \r
-function () {\r
-if (this.dnaToProt == null) {\r
-return null;\r
-}var sqs =  new Array (this.dnaToProt.length);\r
-for (var sz = 0; sz < this.dnaToProt.length; sz++) {\r
-sqs[sz] = this.dnaToProt[sz].map;\r
-}\r
-return sqs;\r
-});\r
-Clazz.defineMethod (c$, "getProtMappings", \r
-function () {\r
-return this.dnaToProt;\r
-});\r
-Clazz.defineMethod (c$, "getMappingForSequence", \r
-function (seq) {\r
-if (this.dnaSeqs == null) {\r
-return null;\r
-}var seqDs = seq.getDatasetSequence ();\r
-seqDs = seqDs != null ? seqDs : seq;\r
-for (var ds = 0; ds < this.dnaSeqs.length; ds++) {\r
-if (this.dnaSeqs[ds] === seqDs || this.dnaToProt[ds].to === seqDs) {\r
-return this.dnaToProt[ds];\r
-}}\r
-return null;\r
-}, "jalview.datamodel.SequenceI");\r
-Clazz.defineMethod (c$, "getAaForDnaSeq", \r
-function (dnaSeqRef) {\r
-if (this.dnaSeqs == null) {\r
-return null;\r
-}var dnads = dnaSeqRef.getDatasetSequence ();\r
-for (var ds = 0; ds < this.dnaSeqs.length; ds++) {\r
-if (this.dnaSeqs[ds] === dnaSeqRef || this.dnaSeqs[ds] === dnads) {\r
-return this.dnaToProt[ds].to;\r
-}}\r
-return null;\r
-}, "jalview.datamodel.SequenceI");\r
-Clazz.defineMethod (c$, "getDnaForAaSeq", \r
-function (aaSeqRef) {\r
-if (this.dnaToProt == null) {\r
-return null;\r
-}var aads = aaSeqRef.getDatasetSequence ();\r
-for (var as = 0; as < this.dnaToProt.length; as++) {\r
-if (this.dnaToProt[as].to === aaSeqRef || this.dnaToProt[as].to === aads) {\r
-return this.dnaSeqs[as];\r
-}}\r
-return null;\r
-}, "jalview.datamodel.SequenceI");\r
-Clazz.defineMethod (c$, "involvesSequence", \r
-function (seq) {\r
-return this.getAaForDnaSeq (seq) != null || this.getDnaForAaSeq (seq) != null;\r
-}, "jalview.datamodel.SequenceI");\r
-Clazz.defineMethod (c$, "markMappedRegion", \r
-function (seq, index, results) {\r
-if (this.dnaToProt == null) {\r
-return;\r
-}var codon;\r
-var ds = seq.getDatasetSequence ();\r
-for (var mi = 0; mi < this.dnaToProt.length; mi++) {\r
-if (this.dnaSeqs[mi] === seq || this.dnaSeqs[mi] === ds) {\r
-codon = this.dnaToProt[mi].map.locateInTo (index, index);\r
-if (codon != null) {\r
-for (var i = 0; i < codon.length; i += 2) {\r
-results.addResult (this.dnaToProt[mi].to, codon[i], codon[i + 1]);\r
-}\r
-}} else if (this.dnaToProt[mi].to === seq || this.dnaToProt[mi].to === ds) {\r
-{\r
-codon = this.dnaToProt[mi].map.locateInFrom (index, index);\r
-if (codon != null) {\r
-for (var i = 0; i < codon.length; i += 2) {\r
-results.addResult (this.dnaSeqs[mi], codon[i], codon[i + 1]);\r
-}\r
-}}}}\r
-}, "jalview.datamodel.SequenceI,~N,jalview.datamodel.SearchResults");\r
-Clazz.defineMethod (c$, "getDnaPosition", \r
-function (seq, aaPos) {\r
-var ml = null;\r
-for (var i = 0; i < this.dnaToProt.length; i++) {\r
-if (this.dnaSeqs[i] === seq) {\r
-ml = this.getdnaToProt ()[i];\r
-break;\r
-}}\r
-return ml == null ? null : ml.locateInFrom (aaPos, aaPos);\r
-}, "jalview.datamodel.SequenceI,~N");\r
-Clazz.defineMethod (c$, "findAlignedSequence", \r
-function (seq, al) {\r
-if (this.dnaToProt != null) {\r
-for (var i = 0; i < this.dnaToProt.length; i++) {\r
-if (this.dnaSeqs[i] === seq) {\r
-for (var sourceAligned, $sourceAligned = al.getSequences ().iterator (); $sourceAligned.hasNext () && ((sourceAligned = $sourceAligned.next ()) || true);) {\r
-if (this.dnaToProt[i].to === sourceAligned.getDatasetSequence ()) {\r
-return sourceAligned;\r
-}}\r
-}}\r
-}if (this.dnaToProt != null) {\r
-for (var i = 0; i < this.dnaToProt.length; i++) {\r
-if (this.dnaToProt[i].to === seq) {\r
-for (var sourceAligned, $sourceAligned = al.getSequences ().iterator (); $sourceAligned.hasNext () && ((sourceAligned = $sourceAligned.next ()) || true);) {\r
-if (this.dnaSeqs[i] === sourceAligned.getDatasetSequence ()) {\r
-return sourceAligned;\r
-}}\r
-}}\r
-}return null;\r
-}, "jalview.datamodel.SequenceI,jalview.datamodel.AlignmentI");\r
-Clazz.defineMethod (c$, "getMappedRegion", \r
-function (mappedFrom, mappedTo, pos) {\r
-var targetDs = mappedFrom.getDatasetSequence () == null ? mappedFrom : mappedFrom.getDatasetSequence ();\r
-var sourceDs = mappedTo.getDatasetSequence () == null ? mappedTo : mappedTo.getDatasetSequence ();\r
-if (targetDs == null || sourceDs == null || this.dnaToProt == null) {\r
-return null;\r
-}for (var mi = 0; mi < this.dnaToProt.length; mi++) {\r
-if (this.dnaSeqs[mi] === targetDs && this.dnaToProt[mi].to === sourceDs) {\r
-var codon = this.dnaToProt[mi].map.locateInFrom (pos, pos);\r
-if (codon != null) {\r
-return codon;\r
-}}}\r
-return null;\r
-}, "jalview.datamodel.SequenceI,jalview.datamodel.SequenceI,~N");\r
-Clazz.defineMethod (c$, "getMappedCodon", \r
-function (protein, aaPos) {\r
-if (this.dnaToProt == null) {\r
-return null;\r
-}var ml = null;\r
-var dnaSeq = null;\r
-for (var i = 0; i < this.dnaToProt.length; i++) {\r
-if (this.dnaToProt[i].to === protein) {\r
-ml = this.getdnaToProt ()[i];\r
-dnaSeq = this.dnaSeqs[i].getSequence ();\r
-break;\r
-}}\r
-if (ml == null) {\r
-return null;\r
-}var codonPos = ml.locateInFrom (aaPos, aaPos);\r
-if (codonPos == null) {\r
-return null;\r
-}codonPos = jalview.util.MappingUtils.flattenRanges (codonPos);\r
-return  Clazz.newCharArray (-1, [dnaSeq[codonPos[0] - 1], dnaSeq[codonPos[1] - 1], dnaSeq[codonPos[2] - 1]]);\r
-}, "jalview.datamodel.SequenceI,~N");\r
-Clazz.defineMethod (c$, "getMappingsForSequence", \r
-function (seq) {\r
-var result =  new java.util.ArrayList ();\r
-if (this.dnaSeqs == null) {\r
-return result;\r
-}var related =  new java.util.ArrayList ();\r
-var seqDs = seq.getDatasetSequence ();\r
-seqDs = seqDs != null ? seqDs : seq;\r
-for (var ds = 0; ds < this.dnaSeqs.length; ds++) {\r
-var mapping = this.dnaToProt[ds];\r
-if (this.dnaSeqs[ds] === seqDs || mapping.to === seqDs) {\r
-if (!related.contains (mapping.to)) {\r
-result.add (mapping);\r
-related.add (mapping.to);\r
-}}}\r
-return result;\r
-}, "jalview.datamodel.SequenceI");\r
-});\r
+Clazz.declarePackage ("jalview.datamodel");
+Clazz.load (null, "jalview.datamodel.AlignedCodonFrame", ["jalview.datamodel.Mapping", "jalview.util.MappingUtils", "java.util.ArrayList"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.dnaSeqs = null;
+this.dnaToProt = null;
+Clazz.instantialize (this, arguments);
+}, jalview.datamodel, "AlignedCodonFrame");
+Clazz.makeConstructor (c$, 
+function () {
+});
+Clazz.defineMethod (c$, "addMap", 
+function (dnaseq, aaseq, map) {
+var nlen = 1;
+if (this.dnaSeqs != null) {
+nlen = this.dnaSeqs.length + 1;
+}var ndna =  new Array (nlen);
+var ndtp =  new Array (nlen);
+if (this.dnaSeqs != null) {
+System.arraycopy (this.dnaSeqs, 0, ndna, 0, this.dnaSeqs.length);
+System.arraycopy (this.dnaToProt, 0, ndtp, 0, this.dnaSeqs.length);
+}this.dnaSeqs = ndna;
+this.dnaToProt = ndtp;
+nlen--;
+this.dnaSeqs[nlen] = (dnaseq.getDatasetSequence () == null) ? dnaseq : dnaseq.getDatasetSequence ();
+var mp =  new jalview.datamodel.Mapping (map);
+mp.to = (aaseq.getDatasetSequence () == null) ? aaseq : aaseq.getDatasetSequence ();
+this.dnaToProt[nlen] = mp;
+}, "jalview.datamodel.SequenceI,jalview.datamodel.SequenceI,jalview.util.MapList");
+Clazz.defineMethod (c$, "getdnaSeqs", 
+function () {
+return this.dnaSeqs;
+});
+Clazz.defineMethod (c$, "getAaSeqs", 
+function () {
+if (this.dnaToProt == null) {
+return null;
+}var sqs =  new Array (this.dnaToProt.length);
+for (var sz = 0; sz < this.dnaToProt.length; sz++) {
+sqs[sz] = this.dnaToProt[sz].to;
+}
+return sqs;
+});
+Clazz.defineMethod (c$, "getdnaToProt", 
+function () {
+if (this.dnaToProt == null) {
+return null;
+}var sqs =  new Array (this.dnaToProt.length);
+for (var sz = 0; sz < this.dnaToProt.length; sz++) {
+sqs[sz] = this.dnaToProt[sz].map;
+}
+return sqs;
+});
+Clazz.defineMethod (c$, "getProtMappings", 
+function () {
+return this.dnaToProt;
+});
+Clazz.defineMethod (c$, "getMappingForSequence", 
+function (seq) {
+if (this.dnaSeqs == null) {
+return null;
+}var seqDs = seq.getDatasetSequence ();
+seqDs = seqDs != null ? seqDs : seq;
+for (var ds = 0; ds < this.dnaSeqs.length; ds++) {
+if (this.dnaSeqs[ds] === seqDs || this.dnaToProt[ds].to === seqDs) {
+return this.dnaToProt[ds];
+}}
+return null;
+}, "jalview.datamodel.SequenceI");
+Clazz.defineMethod (c$, "getAaForDnaSeq", 
+function (dnaSeqRef) {
+if (this.dnaSeqs == null) {
+return null;
+}var dnads = dnaSeqRef.getDatasetSequence ();
+for (var ds = 0; ds < this.dnaSeqs.length; ds++) {
+if (this.dnaSeqs[ds] === dnaSeqRef || this.dnaSeqs[ds] === dnads) {
+return this.dnaToProt[ds].to;
+}}
+return null;
+}, "jalview.datamodel.SequenceI");
+Clazz.defineMethod (c$, "getDnaForAaSeq", 
+function (aaSeqRef) {
+if (this.dnaToProt == null) {
+return null;
+}var aads = aaSeqRef.getDatasetSequence ();
+for (var as = 0; as < this.dnaToProt.length; as++) {
+if (this.dnaToProt[as].to === aaSeqRef || this.dnaToProt[as].to === aads) {
+return this.dnaSeqs[as];
+}}
+return null;
+}, "jalview.datamodel.SequenceI");
+Clazz.defineMethod (c$, "involvesSequence", 
+function (seq) {
+return this.getAaForDnaSeq (seq) != null || this.getDnaForAaSeq (seq) != null;
+}, "jalview.datamodel.SequenceI");
+Clazz.defineMethod (c$, "markMappedRegion", 
+function (seq, index, results) {
+if (this.dnaToProt == null) {
+return;
+}var codon;
+var ds = seq.getDatasetSequence ();
+for (var mi = 0; mi < this.dnaToProt.length; mi++) {
+if (this.dnaSeqs[mi] === seq || this.dnaSeqs[mi] === ds) {
+codon = this.dnaToProt[mi].map.locateInTo (index, index);
+if (codon != null) {
+for (var i = 0; i < codon.length; i += 2) {
+results.addResult (this.dnaToProt[mi].to, codon[i], codon[i + 1]);
+}
+}} else if (this.dnaToProt[mi].to === seq || this.dnaToProt[mi].to === ds) {
+{
+codon = this.dnaToProt[mi].map.locateInFrom (index, index);
+if (codon != null) {
+for (var i = 0; i < codon.length; i += 2) {
+results.addResult (this.dnaSeqs[mi], codon[i], codon[i + 1]);
+}
+}}}}
+}, "jalview.datamodel.SequenceI,~N,jalview.datamodel.SearchResults");
+Clazz.defineMethod (c$, "getDnaPosition", 
+function (seq, aaPos) {
+var ml = null;
+for (var i = 0; i < this.dnaToProt.length; i++) {
+if (this.dnaSeqs[i] === seq) {
+ml = this.getdnaToProt ()[i];
+break;
+}}
+return ml == null ? null : ml.locateInFrom (aaPos, aaPos);
+}, "jalview.datamodel.SequenceI,~N");
+Clazz.defineMethod (c$, "findAlignedSequence", 
+function (seq, al) {
+if (this.dnaToProt != null) {
+for (var i = 0; i < this.dnaToProt.length; i++) {
+if (this.dnaSeqs[i] === seq) {
+for (var sourceAligned, $sourceAligned = al.getSequences ().iterator (); $sourceAligned.hasNext () && ((sourceAligned = $sourceAligned.next ()) || true);) {
+if (this.dnaToProt[i].to === sourceAligned.getDatasetSequence ()) {
+return sourceAligned;
+}}
+}}
+}if (this.dnaToProt != null) {
+for (var i = 0; i < this.dnaToProt.length; i++) {
+if (this.dnaToProt[i].to === seq) {
+for (var sourceAligned, $sourceAligned = al.getSequences ().iterator (); $sourceAligned.hasNext () && ((sourceAligned = $sourceAligned.next ()) || true);) {
+if (this.dnaSeqs[i] === sourceAligned.getDatasetSequence ()) {
+return sourceAligned;
+}}
+}}
+}return null;
+}, "jalview.datamodel.SequenceI,jalview.datamodel.AlignmentI");
+Clazz.defineMethod (c$, "getMappedRegion", 
+function (mappedFrom, mappedTo, pos) {
+var targetDs = mappedFrom.getDatasetSequence () == null ? mappedFrom : mappedFrom.getDatasetSequence ();
+var sourceDs = mappedTo.getDatasetSequence () == null ? mappedTo : mappedTo.getDatasetSequence ();
+if (targetDs == null || sourceDs == null || this.dnaToProt == null) {
+return null;
+}for (var mi = 0; mi < this.dnaToProt.length; mi++) {
+if (this.dnaSeqs[mi] === targetDs && this.dnaToProt[mi].to === sourceDs) {
+var codon = this.dnaToProt[mi].map.locateInFrom (pos, pos);
+if (codon != null) {
+return codon;
+}}}
+return null;
+}, "jalview.datamodel.SequenceI,jalview.datamodel.SequenceI,~N");
+Clazz.defineMethod (c$, "getMappedCodon", 
+function (protein, aaPos) {
+if (this.dnaToProt == null) {
+return null;
+}var ml = null;
+var dnaSeq = null;
+for (var i = 0; i < this.dnaToProt.length; i++) {
+if (this.dnaToProt[i].to === protein) {
+ml = this.getdnaToProt ()[i];
+dnaSeq = this.dnaSeqs[i].getSequence ();
+break;
+}}
+if (ml == null) {
+return null;
+}var codonPos = ml.locateInFrom (aaPos, aaPos);
+if (codonPos == null) {
+return null;
+}codonPos = jalview.util.MappingUtils.flattenRanges (codonPos);
+return  Clazz.newCharArray (-1, [dnaSeq[codonPos[0] - 1], dnaSeq[codonPos[1] - 1], dnaSeq[codonPos[2] - 1]]);
+}, "jalview.datamodel.SequenceI,~N");
+Clazz.defineMethod (c$, "getMappingsForSequence", 
+function (seq) {
+var result =  new java.util.ArrayList ();
+if (this.dnaSeqs == null) {
+return result;
+}var related =  new java.util.ArrayList ();
+var seqDs = seq.getDatasetSequence ();
+seqDs = seqDs != null ? seqDs : seq;
+for (var ds = 0; ds < this.dnaSeqs.length; ds++) {
+var mapping = this.dnaToProt[ds];
+if (this.dnaSeqs[ds] === seqDs || mapping.to === seqDs) {
+if (!related.contains (mapping.to)) {
+result.add (mapping);
+related.add (mapping.to);
+}}}
+return result;
+}, "jalview.datamodel.SequenceI");
+});