1 Clazz.declarePackage ("jalview.datamodel");
2 Clazz.load (["jalview.datamodel.AlignmentI", "$.HiddenSequences", "java.util.ArrayList", "$.Collections", "$.LinkedHashSet"], "jalview.datamodel.Alignment", ["jalview.analysis.AlignmentUtils", "jalview.datamodel.AlignmentAnnotation", "$.CigarArray", "$.SeqCigar", "$.Sequence", "jalview.util.Comparison", "$.MessageManager", "java.lang.Error", "java.util.HashSet", "$.Hashtable", "$.Vector"], function () {
3 c$ = Clazz.decorateAsClass (function () {
7 this.gapCharacter = '-';
9 this.$hasRNAStructure = false;
10 this.annotations = null;
11 this.hiddenSequences = null;
12 this.alignmentProperties = null;
13 this.codonFrameList = null;
14 this.alignmentRefs = 0;
16 Clazz.instantialize (this, arguments);
17 }, jalview.datamodel, "Alignment", null, jalview.datamodel.AlignmentI);
18 Clazz.prepareFields (c$, function () {
19 this.groups = java.util.Collections.synchronizedList ( new java.util.ArrayList ());
20 this.hiddenSequences = new jalview.datamodel.HiddenSequences (this);
21 this.codonFrameList = new java.util.LinkedHashSet ();
23 Clazz.defineMethod (c$, "initAlignment",
24 ($fz = function (seqs) {
26 if (jalview.util.Comparison.isNucleotide (seqs)) {
30 }this.sequences = java.util.Collections.synchronizedList ( new java.util.ArrayList ());
31 for (i = 0; i < seqs.length; i++) {
32 this.sequences.add (seqs[i]);
34 }, $fz.isPrivate = true, $fz), "~A");
35 Clazz.makeConstructor (c$,
37 var seqs = al.getSequencesArray ();
38 for (var i = 0; i < seqs.length; i++) {
39 seqs[i] = new jalview.datamodel.Sequence (seqs[i]);
41 this.codonFrameList = (al).codonFrameList;
42 this.initAlignment (seqs);
43 }, "jalview.datamodel.AlignmentI");
44 Clazz.makeConstructor (c$,
46 this.initAlignment (seqs);
48 c$.createAlignment = Clazz.defineMethod (c$, "createAlignment",
49 function (compactAlignment) {
50 throw new Error (jalview.util.MessageManager.getString ("error.alignment_cigararray_not_implemented"));
51 }, "jalview.datamodel.CigarArray");
52 Clazz.defineMethod (c$, "getSequences",
54 return this.sequences;
56 Clazz.defineMethod (c$, "getSequences",
57 function (hiddenReps) {
58 return this.sequences;
60 Clazz.defineMethod (c$, "getSequencesArray",
62 if (this.sequences == null) {
65 return this.sequences.toArray ( new Array (this.sequences.size ()));
67 Clazz.overrideMethod (c$, "getSequencesByName",
69 return jalview.analysis.AlignmentUtils.getSequencesByName (this);
71 Clazz.overrideMethod (c$, "getSequenceAt",
74 if (i > -1 && i < this.sequences.size ()) {
75 return this.sequences.get (i);
78 Clazz.overrideMethod (c$, "addSequence",
80 if (this.dataset != null) {
81 if (snew.getDatasetSequence () != null) {
82 this.getDataset ().addSequence (snew.getDatasetSequence ());
84 var adding = snew.deriveSequence ();
85 this.getDataset ().addSequence (adding.getDatasetSequence ());
87 }}if (this.sequences == null) {
88 this.initAlignment ( Clazz.newArray (-1, [snew]));
91 this.sequences.add (snew);
92 }}if (this.hiddenSequences != null) {
93 this.hiddenSequences.adjustHeightSequenceAdded ();
94 }}, "jalview.datamodel.SequenceI");
95 Clazz.overrideMethod (c$, "setSequenceAt",
98 this.deleteSequence (i);
99 this.sequences.set (i, snew);
100 }}, "~N,jalview.datamodel.SequenceI");
101 Clazz.defineMethod (c$, "getGroups",
105 Clazz.overrideMethod (c$, "finalize",
107 if (this.getDataset () != null) {
108 this.getDataset ().removeAlignmentRef ();
109 }this.dataset = null;
110 this.sequences = null;
112 this.annotations = null;
113 this.hiddenSequences = null;
115 Clazz.defineMethod (c$, "removeAlignmentRef",
117 if (--this.alignmentRefs == 0) {
119 }}, $fz.isPrivate = true, $fz));
120 Clazz.defineMethod (c$, "deleteSequence",
122 this.deleteSequence (this.findIndex (s));
123 }, "jalview.datamodel.SequenceI");
124 Clazz.defineMethod (c$, "deleteSequence",
126 if (i > -1 && i < this.getHeight ()) {
128 this.sequences.remove (i);
129 this.hiddenSequences.adjustHeightSequenceDeleted (i);
131 Clazz.overrideMethod (c$, "findGroup",
134 for (var i = 0; i < this.groups.size (); i++) {
135 var sg = this.groups.get (i);
136 if (sg.getSequences (null).contains (s)) {
140 }, "jalview.datamodel.SequenceI");
141 Clazz.overrideMethod (c$, "findAllGroups",
143 var temp = new java.util.ArrayList ();
145 var gSize = this.groups.size ();
146 for (var i = 0; i < gSize; i++) {
147 var sg = this.groups.get (i);
148 if (sg == null || sg.getSequences () == null) {
149 this.deleteGroup (sg);
152 }if (sg.getSequences ().contains (s)) {
155 }var ret = new Array (temp.size ());
156 return temp.toArray (ret);
157 }, "jalview.datamodel.SequenceI");
158 Clazz.overrideMethod (c$, "addGroup",
161 if (!this.groups.contains (sg)) {
162 if (this.hiddenSequences.getSize () > 0) {
164 var iSize = sg.getSize ();
165 for (i = 0; i < iSize; i++) {
166 if (!this.sequences.contains (sg.getSequenceAt (i))) {
167 sg.deleteSequence (sg.getSequenceAt (i), false);
171 if (sg.getSize () < 1) {
173 }}sg.setContext (this);
174 this.groups.add (sg);
175 }}}, "jalview.datamodel.SequenceGroup");
176 Clazz.defineMethod (c$, "removeAnnotationForGroup",
177 ($fz = function (gp) {
178 if (this.annotations == null || this.annotations.length == 0) {
181 var todelete = new Array (this.annotations.length);
182 var tokeep = new Array (this.annotations.length);
187 for (i = 0, p = 0, k = 0; i < this.annotations.length; i++) {
188 if (this.annotations[i].groupRef != null) {
189 todelete[p++] = this.annotations[i];
191 tokeep[k++] = this.annotations[i];
194 for (i = 0, p = 0, k = 0; i < this.annotations.length; i++) {
195 if (this.annotations[i].groupRef === gp) {
196 todelete[p++] = this.annotations[i];
198 tokeep[k++] = this.annotations[i];
201 for (i = 0; i < p; i++) {
202 this.unhookAnnotation (todelete[i]);
206 for (i = 0; i < k; i++) {
209 this.annotations = t;
210 }}, $fz.isPrivate = true, $fz), "jalview.datamodel.SequenceGroup");
211 Clazz.overrideMethod (c$, "deleteAllGroups",
214 if (this.annotations != null) {
215 this.removeAnnotationForGroup (null);
216 }for (var sg, $sg = this.groups.iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {
217 sg.setContext (null);
219 this.groups.clear ();
221 Clazz.overrideMethod (c$, "deleteGroup",
224 if (this.groups.contains (g)) {
225 this.removeAnnotationForGroup (g);
226 this.groups.remove (g);
228 }}}, "jalview.datamodel.SequenceGroup");
229 Clazz.defineMethod (c$, "findName",
231 return this.findName (name, false);
233 Clazz.defineMethod (c$, "findName",
234 function (token, b) {
235 return this.findName (null, token, b);
237 Clazz.defineMethod (c$, "findName",
238 function (startAfter, token, b) {
242 if (startAfter != null) {
244 while (i < this.sequences.size ()) {
245 if (this.getSequenceAt (i++) === startAfter) {
251 }}while (i < this.sequences.size ()) {
252 sq = this.getSequenceAt (i);
253 sqname = sq.getName ();
254 if (sqname.equals (token) || (b && (sqname.equalsIgnoreCase (token)))) {
255 return this.getSequenceAt (i);
259 }, "jalview.datamodel.SequenceI,~S,~B");
260 Clazz.overrideMethod (c$, "findSequenceMatch",
262 var matches = new java.util.Vector ();
264 while (i < this.sequences.size ()) {
265 if (this.getSequenceAt (i).getName ().equals (name)) {
266 matches.addElement (this.getSequenceAt (i));
269 var result = new Array (matches.size ());
270 for (i = 0; i < result.length; i++) {
271 result[i] = matches.elementAt (i);
275 Clazz.defineMethod (c$, "findIndex",
278 while (i < this.sequences.size ()) {
279 if (s === this.getSequenceAt (i)) {
284 }, "jalview.datamodel.SequenceI");
285 Clazz.defineMethod (c$, "findIndex",
288 while (i < this.sequences.size ()) {
289 if (results.involvesSequence (this.getSequenceAt (i))) {
294 }, "jalview.datamodel.SearchResults");
295 Clazz.overrideMethod (c$, "getHeight",
297 return this.sequences.size ();
299 Clazz.overrideMethod (c$, "getWidth",
302 for (var i = 0; i < this.sequences.size (); i++) {
303 if (this.getSequenceAt (i).getLength () > maxLength) {
304 maxLength = this.getSequenceAt (i).getLength ();
308 Clazz.overrideMethod (c$, "setGapCharacter",
310 this.gapCharacter = gc;
312 for (var seq, $seq = this.sequences.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) {
313 seq.setSequence (seq.getSequenceAsString ().$replace ('.', gc).$replace ('-', gc).$replace (' ', gc));
316 Clazz.defineMethod (c$, "getGapCharacter",
318 return this.gapCharacter;
320 Clazz.defineMethod (c$, "isAligned",
322 return this.isAligned (false);
324 Clazz.defineMethod (c$, "isAligned",
325 function (includeHidden) {
326 var width = this.getWidth ();
327 if (this.hiddenSequences == null || this.hiddenSequences.getSize () == 0) {
328 includeHidden = true;
329 }for (var i = 0; i < this.sequences.size (); i++) {
330 if (includeHidden || !this.hiddenSequences.isHidden (this.getSequenceAt (i))) {
331 if (this.getSequenceAt (i).getLength () != width) {
336 Clazz.overrideMethod (c$, "deleteAllAnnotations",
337 function (includingAutoCalculated) {
339 for (var alan, $alan = 0, $$alan = this.getAlignmentAnnotation (); $alan < $$alan.length && ((alan = $$alan[$alan]) || true); $alan++) {
340 if (!alan.autoCalculated || includingAutoCalculated) {
341 this.deleteAnnotation (alan);
346 Clazz.defineMethod (c$, "deleteAnnotation",
348 return this.deleteAnnotation (aa, true);
349 }, "jalview.datamodel.AlignmentAnnotation");
350 Clazz.defineMethod (c$, "deleteAnnotation",
351 function (aa, unhook) {
353 if (this.annotations != null) {
354 aSize = this.annotations.length;
357 }var temp = new Array (aSize - 1);
360 for (var i = 0; i < aSize; i++) {
361 if (this.annotations[i] === aa) {
364 }if (tIndex < temp.length) {
365 temp[tIndex++] = this.annotations[i];
368 this.annotations = temp;
370 this.unhookAnnotation (aa);
372 }, "jalview.datamodel.AlignmentAnnotation,~B");
373 Clazz.defineMethod (c$, "unhookAnnotation",
374 ($fz = function (aa) {
375 if (aa.sequenceRef != null) {
376 aa.sequenceRef.removeAlignmentAnnotation (aa);
377 }if (aa.groupRef != null) {
379 }}, $fz.isPrivate = true, $fz), "jalview.datamodel.AlignmentAnnotation");
380 Clazz.defineMethod (c$, "addAnnotation",
382 this.addAnnotation (aa, -1);
383 }, "jalview.datamodel.AlignmentAnnotation");
384 Clazz.defineMethod (c$, "addAnnotation",
386 if (aa.getRNAStruc () != null) {
387 this.$hasRNAStructure = true;
389 if (this.annotations != null) {
390 aSize = this.annotations.length + 1;
391 }var temp = new Array (aSize);
393 if (pos == -1 || pos >= aSize) {
394 temp[aSize - 1] = aa;
399 for (i = 0; i < (aSize - 1); i++, p++) {
402 }if (p < temp.length) {
403 temp[p] = this.annotations[i];
405 }this.annotations = temp;
406 }, "jalview.datamodel.AlignmentAnnotation,~N");
407 Clazz.overrideMethod (c$, "setAnnotationIndex",
408 function (aa, index) {
409 if (aa == null || this.annotations == null || this.annotations.length - 1 < index) {
411 }var aSize = this.annotations.length;
412 var temp = new Array (aSize);
414 for (var i = 0; i < aSize; i++) {
418 temp[i] = this.annotations[i];
420 temp[i] = this.annotations[i - 1];
422 this.annotations = temp;
423 }, "jalview.datamodel.AlignmentAnnotation,~N");
424 Clazz.defineMethod (c$, "getAlignmentAnnotation",
426 return this.annotations;
428 Clazz.overrideMethod (c$, "setNucleotide",
435 Clazz.defineMethod (c$, "isNucleotide",
437 if (this.type == 1) {
442 Clazz.overrideMethod (c$, "hasRNAStructure",
444 return this.$hasRNAStructure;
446 Clazz.overrideMethod (c$, "setDataset",
448 if (this.dataset == null && data == null) {
449 var seqs = new Array (this.getHeight ());
451 for (var i = 0; i < this.getHeight (); i++) {
452 currentSeq = this.getSequenceAt (i);
453 if (currentSeq.getDatasetSequence () != null) {
454 seqs[i] = currentSeq.getDatasetSequence ();
456 seqs[i] = currentSeq.createDatasetSequence ();
458 this.dataset = new jalview.datamodel.Alignment (seqs);
459 } else if (this.dataset == null && data != null) {
461 for (var i = 0; i < this.getHeight (); i++) {
462 var currentSeq = this.getSequenceAt (i);
463 var dsq = currentSeq.getDatasetSequence ();
465 dsq = currentSeq.createDatasetSequence ();
466 this.dataset.addSequence (dsq);
468 while (dsq.getDatasetSequence () != null) {
469 dsq = dsq.getDatasetSequence ();
471 if (this.dataset.findIndex (dsq) == -1) {
472 this.dataset.addSequence (dsq);
474 }this.dataset.addAlignmentRef ();
475 }, "jalview.datamodel.Alignment");
476 Clazz.defineMethod (c$, "addAlignmentRef",
478 this.alignmentRefs++;
479 }, $fz.isPrivate = true, $fz));
480 Clazz.overrideMethod (c$, "getDataset",
484 Clazz.overrideMethod (c$, "padGaps",
486 var modified = false;
489 for (var i = 0; i < this.sequences.size (); i++) {
490 current = this.getSequenceAt (i);
491 for (var j = current.getLength (); j > maxLength; j--) {
492 if (j > maxLength && !jalview.util.Comparison.isGap (current.getCharAt (j))) {
499 for (var i = 0; i < this.sequences.size (); i++) {
500 current = this.getSequenceAt (i);
501 cLength = current.getLength ();
502 if (cLength < maxLength) {
503 current.insertCharAt (cLength, maxLength - cLength, this.gapCharacter);
505 } else if (current.getLength () > maxLength) {
506 current.deleteChars (maxLength, current.getLength ());
510 Clazz.overrideMethod (c$, "justify",
512 var modified = false;
514 var ends = Clazz.newIntArray (this.sequences.size () * 2, 0);
516 for (var i = 0; i < this.sequences.size (); i++) {
517 current = this.getSequenceAt (i);
518 ends[i * 2] = current.findIndex (current.getStart ());
519 ends[i * 2 + 1] = current.findIndex (current.getStart () + current.getLength ());
521 for (var j = 0, rs = 0, ssiz = current.getLength (); j < ssiz; j++) {
522 if (!jalview.util.Comparison.isGap (current.getCharAt (j))) {
528 if (j - ends[i * 2] > maxLength) {
529 maxLength = j - ends[i * 2];
536 for (var i = 0; i < this.sequences.size (); i++) {
537 current = this.getSequenceAt (i);
538 cLength = 1 + ends[i * 2 + 1] - ends[i * 2];
539 diff = maxLength - cLength;
540 extent = current.getLength ();
542 if (extent > ends[i * 2 + 1]) {
543 current.deleteChars (ends[i * 2 + 1] + 1, extent);
545 }if (ends[i * 2] > diff) {
546 current.deleteChars (0, ends[i * 2] - diff);
549 if (ends[i * 2] < diff) {
550 current.insertCharAt (0, diff - ends[i * 2], this.gapCharacter);
553 if (ends[i * 2] > 0) {
554 current.deleteChars (0, ends[i * 2]);
556 ends[i * 2 + 1] -= ends[i * 2];
557 extent -= ends[i * 2];
558 }if (extent > maxLength) {
559 current.deleteChars (maxLength + 1, extent);
562 if (extent < maxLength) {
563 current.insertCharAt (extent, maxLength - extent, this.gapCharacter);
568 Clazz.defineMethod (c$, "getHiddenSequences",
570 return this.hiddenSequences;
572 Clazz.overrideMethod (c$, "getCompactAlignment",
575 var alseqs = new Array (this.sequences.size ());
577 for (var seq, $seq = this.sequences.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) {
578 alseqs[i++] = new jalview.datamodel.SeqCigar (seq);
580 var cal = new jalview.datamodel.CigarArray (alseqs);
581 cal.addOperation ('M', this.getWidth ());
584 Clazz.overrideMethod (c$, "setProperty",
585 function (key, value) {
586 if (this.alignmentProperties == null) {
587 this.alignmentProperties = new java.util.Hashtable ();
588 }this.alignmentProperties.put (key, value);
590 Clazz.defineMethod (c$, "getProperty",
592 if (this.alignmentProperties != null) {
593 return this.alignmentProperties.get (key);
597 Clazz.defineMethod (c$, "getProperties",
599 return this.alignmentProperties;
601 Clazz.overrideMethod (c$, "addCodonFrame",
603 if (codons != null) {
604 this.codonFrameList.add (codons);
605 }}, "jalview.datamodel.AlignedCodonFrame");
606 Clazz.overrideMethod (c$, "getCodonFrame",
610 }var cframes = new java.util.ArrayList ();
611 for (var acf, $acf = this.codonFrameList.iterator (); $acf.hasNext () && ((acf = $acf.next ()) || true);) {
612 if (acf.involvesSequence (seq)) {
616 }, "jalview.datamodel.SequenceI");
617 Clazz.overrideMethod (c$, "setCodonFrames",
619 this.codonFrameList = acfs;
621 Clazz.defineMethod (c$, "getCodonFrames",
623 return this.codonFrameList;
625 Clazz.overrideMethod (c$, "removeCodonFrame",
627 if (codons == null || this.codonFrameList == null) {
629 }return this.codonFrameList.remove (codons);
630 }, "jalview.datamodel.AlignedCodonFrame");
631 Clazz.overrideMethod (c$, "append",
632 function (toappend) {
633 if (toappend === this) {
634 System.err.println ("Self append may cause a deadlock.");
635 }var samegap = toappend.getGapCharacter () == this.getGapCharacter ();
636 var oldc = toappend.getGapCharacter ();
637 var hashidden = toappend.getHiddenSequences () != null && toappend.getHiddenSequences ().hiddenSequences != null;
638 var sqs = (hashidden) ? toappend.getHiddenSequences ().getFullAlignment ().getSequences () : toappend.getSequences ();
641 for (var addedsq, $addedsq = sqs.iterator (); $addedsq.hasNext () && ((addedsq = $addedsq.next ()) || true);) {
643 var oldseq = addedsq.getSequence ();
644 for (var c = 0; c < oldseq.length; c++) {
645 if (oldseq[c] == oldc) {
646 oldseq[c] = this.gapCharacter;
648 }this.addSequence (addedsq);
650 }}var alan = toappend.getAlignmentAnnotation ();
651 for (var a = 0; alan != null && a < alan.length; a++) {
652 this.addAnnotation (alan[a]);
654 this.codonFrameList.addAll (toappend.getCodonFrames ());
655 var sg = toappend.getGroups ();
657 for (var _sg, $_sg = sg.iterator (); $_sg.hasNext () && ((_sg = $_sg.next ()) || true);) {
660 }if (toappend.getHiddenSequences () != null) {
661 var hs = toappend.getHiddenSequences ();
662 if (this.hiddenSequences == null) {
663 this.hiddenSequences = new jalview.datamodel.HiddenSequences (this);
664 }if (hs.hiddenSequences != null) {
665 for (var s = 0; s < hs.hiddenSequences.length; s++) {
666 if (hs.hiddenSequences[s] != null) {
667 this.hiddenSequences.hideSequence (hs.hiddenSequences[s]);
669 }}if (toappend.getProperties () != null) {
670 var key = toappend.getProperties ().keys ();
671 while (key.hasMoreElements ()) {
672 var k = key.nextElement ();
673 var ourval = this.getProperty (k);
674 var toapprop = toappend.getProperty (k);
675 if (ourval != null) {
676 if (ourval.getClass ().equals (toapprop.getClass ()) && !ourval.equals (toapprop)) {
677 if (Clazz.instanceOf (ourval, String)) {
678 this.setProperty (k, (ourval) + "; " + (toapprop));
680 if (Clazz.instanceOf (ourval, java.util.Vector)) {
681 var theirv = (toapprop).elements ();
682 while (theirv.hasMoreElements ()) {
683 (ourval).addElement (theirv);
686 this.setProperty (k, toapprop);
688 }}, "jalview.datamodel.AlignmentI");
689 Clazz.overrideMethod (c$, "findOrCreateAnnotation",
690 function (name, calcId, autoCalc, seqRef, groupRef) {
691 if (this.annotations != null) {
692 for (var annot, $annot = 0, $$annot = this.getAlignmentAnnotation (); $annot < $$annot.length && ((annot = $$annot[$annot]) || true); $annot++) {
693 if (annot.autoCalculated == autoCalc && (name.equals (annot.label)) && (calcId == null || annot.getCalcId ().equals (calcId)) && annot.sequenceRef === seqRef && annot.groupRef === groupRef) {
696 }var annot = new jalview.datamodel.AlignmentAnnotation (name, name, new Array (1), 0, 0, 1);
697 annot.hasText = false;
698 annot.setCalcId ( String.instantialize (calcId));
699 annot.autoCalculated = autoCalc;
700 if (seqRef != null) {
701 annot.setSequenceRef (seqRef);
702 }annot.groupRef = groupRef;
703 this.addAnnotation (annot);
705 }, "~S,~S,~B,jalview.datamodel.SequenceI,jalview.datamodel.SequenceGroup");
706 Clazz.overrideMethod (c$, "findAnnotation",
708 var aa = new java.util.ArrayList ();
709 for (var a, $a = 0, $$a = this.getAlignmentAnnotation (); $a < $$a.length && ((a = $$a[$a]) || true); $a++) {
710 if (a.getCalcId () === calcId || (a.getCalcId () != null && calcId != null && a.getCalcId ().equals (calcId))) {
715 Clazz.overrideMethod (c$, "findAnnotations",
716 function (seq, calcId, label) {
717 var aa = new java.util.ArrayList ();
718 for (var ann, $ann = 0, $$ann = this.getAlignmentAnnotation (); $ann < $$ann.length && ((ann = $$ann[$ann]) || true); $ann++) {
719 if (ann.getCalcId () != null && ann.getCalcId ().equals (calcId) && ann.sequenceRef != null && ann.sequenceRef === seq && ann.label != null && ann.label.equals (label)) {
723 }, "jalview.datamodel.SequenceI,~S,~S");
724 Clazz.overrideMethod (c$, "moveSelectedSequencesByOne",
725 function (sg, map, up) {
728 for (var i = 1, iSize = this.sequences.size (); i < iSize; i++) {
729 var seq = this.sequences.get (i);
730 if (!sg.getSequences (map).contains (seq)) {
732 }var temp = this.sequences.get (i - 1);
733 if (sg.getSequences (null).contains (temp)) {
735 }this.sequences.set (i, temp);
736 this.sequences.set (i - 1, seq);
739 for (var i = this.sequences.size () - 2; i > -1; i--) {
740 var seq = this.sequences.get (i);
741 if (!sg.getSequences (map).contains (seq)) {
743 }var temp = this.sequences.get (i + 1);
744 if (sg.getSequences (map).contains (temp)) {
746 }this.sequences.set (i, temp);
747 this.sequences.set (i + 1, seq);
749 }}}, "jalview.datamodel.SequenceGroup,java.util.Map,~B");
750 Clazz.overrideMethod (c$, "validateAnnotation",
751 function (alignmentAnnotation) {
752 alignmentAnnotation.validateRangeAndDisplay ();
753 if (this.isNucleotide () && alignmentAnnotation.isValidStruc ()) {
754 this.$hasRNAStructure = true;
755 }}, "jalview.datamodel.AlignmentAnnotation");
756 Clazz.overrideMethod (c$, "getSeqrep",
760 Clazz.overrideMethod (c$, "setSeqrep",
762 this.seqrep = seqrep;
763 }, "jalview.datamodel.SequenceI");
764 Clazz.overrideMethod (c$, "hasSeqrep",
766 return this.seqrep != null;
768 Clazz.overrideMethod (c$, "getEndRes",
770 return this.getWidth () - 1;
772 Clazz.overrideMethod (c$, "getStartRes",
776 Clazz.overrideMethod (c$, "getContext",
780 Clazz.defineMethod (c$, "alignAs",
782 return this.alignAs (al, false, true);
783 }, "jalview.datamodel.AlignmentI");
784 Clazz.defineMethod (c$, "alignAs",
785 function (al, preserveMappedGaps, preserveUnmappedGaps) {
787 var thisIsNucleotide = this.isNucleotide ();
788 var thatIsProtein = !al.isNucleotide ();
789 if (!thatIsProtein && !thisIsNucleotide) {
790 return jalview.analysis.AlignmentUtils.alignProteinAsDna (this, al);
791 }var thisGapChar = this.getGapCharacter ();
792 var gap = thisIsNucleotide && thatIsProtein ? String.valueOf ( Clazz.newCharArray (-1, [thisGapChar, thisGapChar, thisGapChar])) : String.valueOf (thisGapChar);
793 for (var alignTo, $alignTo = this.getSequences ().iterator (); $alignTo.hasNext () && ((alignTo = $alignTo.next ()) || true);) {
794 count += jalview.analysis.AlignmentUtils.alignSequenceAs (alignTo, al, gap, preserveMappedGaps, preserveUnmappedGaps) ? 1 : 0;
797 }, "jalview.datamodel.AlignmentI,~B,~B");
798 Clazz.overrideMethod (c$, "getSequenceNames",
800 var names = new java.util.HashSet ();
801 for (var seq, $seq = this.getSequences ().iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) {
802 names.add (seq.getName ());
806 Clazz.overrideMethod (c$, "toString",
808 var seq = this.getSequencesArray ();
810 return "" + JSON.stringify(seq);
812 Clazz.defineStatics (c$,