JAL-1807 includes ?j2sdebug flag and DebugJS._(msg)
[jalviewjs.git] / bin / jalview / datamodel / Sequence.js
1 Clazz.declarePackage ("jalview.datamodel");
2 Clazz.load (["jalview.datamodel.ASequence", "$.SequenceI", "jalview.jsdev.RegExp"], "jalview.datamodel.Sequence", ["jalview.analysis.AlignSeq", "jalview.datamodel.AlignmentAnnotation", "$.DBRefEntry", "$.DBRefSource", "$.PDBEntry", "$.SequenceFeature", "jalview.schemes.ResidueProperties", "jalview.util.Comparison", "$.StringUtils", "java.lang.StringBuffer", "java.util.ArrayList", "$.Vector"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.datasetSequence = null;
5 this.name = null;
6 this.sequence = null;
7 this.description = null;
8 this.start = 0;
9 this.end = 0;
10 this.pdbIds = null;
11 this.vamsasId = null;
12 this.dbrefs = null;
13 this.rna = null;
14 this.annotation = null;
15 this.index = -1;
16 this.sequenceFeatures = null;
17 this.limitrx = null;
18 this.endrx = null;
19 Clazz.instantialize (this, arguments);
20 }, jalview.datamodel, "Sequence", jalview.datamodel.ASequence, jalview.datamodel.SequenceI);
21 Clazz.prepareFields (c$, function () {
22 this.limitrx = jalview.jsdev.RegExp.newRegex (["[/][0-9]{1,}[-][0-9]{1,}$"]);
23 this.endrx = jalview.jsdev.RegExp.newRegex (["[0-9]{1,}$"]);
24 });
25 Clazz.makeConstructor (c$, 
26 function (name, sequence, start, end) {
27 Clazz.superConstructor (this, jalview.datamodel.Sequence, []);
28 this.initSeqAndName (name, sequence.toCharArray (), start, end);
29 }, "~S,~S,~N,~N");
30 Clazz.makeConstructor (c$, 
31 function (name, sequence, start, end) {
32 Clazz.superConstructor (this, jalview.datamodel.Sequence, []);
33 this.initSeqAndName (name, sequence, start, end);
34 }, "~S,~A,~N,~N");
35 Clazz.defineMethod (c$, "initSeqAndName", 
36 function (name2, sequence2, start2, end2) {
37 this.name = name2;
38 this.sequence = sequence2;
39 this.start = start2;
40 this.end = end2;
41 this.parseId ();
42 this.checkValidRange ();
43 }, "~S,~A,~N,~N");
44 Clazz.defineMethod (c$, "parseId", 
45 function () {
46 if (this.name == null) {
47 System.err.println ("POSSIBLE IMPLEMENTATION ERROR: null sequence name passed to constructor.");
48 this.name = "";
49 }if (this.limitrx.search (this.name)) {
50 this.name = this.limitrx.left ();
51 this.endrx.search (this.limitrx.stringMatched ());
52 this.setStart (Integer.parseInt (this.limitrx.stringMatched ().substring (1, this.endrx.matchedFrom () - 1)));
53 this.setEnd (Integer.parseInt (this.endrx.stringMatched ()));
54 }});
55 Clazz.defineMethod (c$, "checkValidRange", 
56 function () {
57 {
58 var endRes = 0;
59 for (var j = 0; j < this.sequence.length; j++) {
60 if (!jalview.util.Comparison.isGap (this.sequence[j])) {
61 endRes++;
62 }}
63 if (endRes > 0) {
64 endRes += this.start - 1;
65 }if (this.end < endRes) {
66 this.end = endRes;
67 }}});
68 Clazz.makeConstructor (c$, 
69 function (name, sequence) {
70 this.construct (name, sequence, 1, -1);
71 }, "~S,~S");
72 Clazz.makeConstructor (c$, 
73 function (seq) {
74 this.construct (seq, seq.getAnnotation ());
75 }, "jalview.datamodel.SequenceI");
76 Clazz.makeConstructor (c$, 
77 function (seq, alAnnotation) {
78 Clazz.superConstructor (this, jalview.datamodel.Sequence, []);
79 this.initSeqFrom (seq, alAnnotation);
80 }, "jalview.datamodel.SequenceI,~A");
81 Clazz.defineMethod (c$, "initSeqFrom", 
82 function (seq, alAnnotation) {
83 this.initSeqAndName (seq.getName (), seq.getSequence (), seq.getStart (), seq.getEnd ());
84 this.description = seq.getDescription ();
85 if (seq.getSequenceFeatures () != null) {
86 var sf = seq.getSequenceFeatures ();
87 for (var i = 0; i < sf.length; i++) {
88 this.addSequenceFeature ( new jalview.datamodel.SequenceFeature (sf[i]));
89 }
90 }this.setDatasetSequence (seq.getDatasetSequence ());
91 if (this.datasetSequence == null && seq.getDBRef () != null) {
92 var dbr = seq.getDBRef ();
93 for (var i = 0; i < dbr.length; i++) {
94 this.addDBRef ( new jalview.datamodel.DBRefEntry (dbr[i]));
95 }
96 }if (seq.getAnnotation () != null) {
97 var sqann = seq.getAnnotation ();
98 for (var i = 0; i < sqann.length; i++) {
99 if (sqann[i] == null) {
100 continue;
101 }var found = (alAnnotation == null);
102 if (!found) {
103 for (var apos = 0; !found && apos < alAnnotation.length; apos++) {
104 found = (alAnnotation[apos] === sqann[i]);
105 }
106 }if (found) {
107 var newann =  new jalview.datamodel.AlignmentAnnotation (sqann[i]);
108 this.addAlignmentAnnotation (newann);
109 }}
110 }if (seq.getPDBId () != null) {
111 var ids = seq.getPDBId ();
112 var e = ids.elements ();
113 while (e.hasMoreElements ()) {
114 this.addPDBId ( new jalview.datamodel.PDBEntry (e.nextElement ()));
115 }
116 }}, "jalview.datamodel.SequenceI,~A");
117 Clazz.defineMethod (c$, "setSequenceFeatures", 
118 function (features) {
119 this.sequenceFeatures = features;
120 }, "~A");
121 Clazz.overrideMethod (c$, "addSequenceFeature", 
122 function (sf) {
123 if (this.sequenceFeatures == null) {
124 this.sequenceFeatures =  new Array (0);
125 }for (var i = 0; i < this.sequenceFeatures.length; i++) {
126 if (this.sequenceFeatures[i].equals (sf)) {
127 return;
128 }}
129 var temp =  new Array (this.sequenceFeatures.length + 1);
130 System.arraycopy (this.sequenceFeatures, 0, temp, 0, this.sequenceFeatures.length);
131 temp[this.sequenceFeatures.length] = sf;
132 this.sequenceFeatures = temp;
133 }, "jalview.datamodel.SequenceFeature");
134 Clazz.overrideMethod (c$, "deleteFeature", 
135 function (sf) {
136 if (this.sequenceFeatures == null) {
137 return;
138 }var index = 0;
139 for (index = 0; index < this.sequenceFeatures.length; index++) {
140 if (this.sequenceFeatures[index].equals (sf)) {
141 break;
142 }}
143 if (index == this.sequenceFeatures.length) {
144 return;
145 }var sfLength = this.sequenceFeatures.length;
146 if (sfLength < 2) {
147 this.sequenceFeatures = null;
148 } else {
149 var temp =  new Array (sfLength - 1);
150 System.arraycopy (this.sequenceFeatures, 0, temp, 0, index);
151 if (index < sfLength) {
152 System.arraycopy (this.sequenceFeatures, index + 1, temp, index, this.sequenceFeatures.length - index - 1);
153 }this.sequenceFeatures = temp;
154 }}, "jalview.datamodel.SequenceFeature");
155 Clazz.defineMethod (c$, "getSequenceFeatures", 
156 function () {
157 var features = this.sequenceFeatures;
158 var seq = this;
159 var count = 0;
160 while (features == null && seq.getDatasetSequence () != null && count++ < 10) {
161 seq = seq.getDatasetSequence ();
162 features = (seq).sequenceFeatures;
163 }
164 return features;
165 });
166 Clazz.overrideMethod (c$, "addPDBId", 
167 function (entry) {
168 if (this.pdbIds == null) {
169 this.pdbIds =  new java.util.Vector ();
170 }if (this.pdbIds.contains (entry)) {
171 jalview.datamodel.Sequence.updatePDBEntry (this.pdbIds.get (this.pdbIds.indexOf (entry)), entry);
172 } else {
173 this.pdbIds.addElement (entry);
174 }}, "jalview.datamodel.PDBEntry");
175 c$.updatePDBEntry = Clazz.defineMethod (c$, "updatePDBEntry", 
176 ($fz = function (oldEntry, newEntry) {
177 if (newEntry.getFile () != null) {
178 oldEntry.setFile (newEntry.getFile ());
179 }}, $fz.isPrivate = true, $fz), "jalview.datamodel.PDBEntry,jalview.datamodel.PDBEntry");
180 Clazz.defineMethod (c$, "setPDBId", 
181 function (id) {
182 this.pdbIds = id;
183 }, "java.util.Vector");
184 Clazz.defineMethod (c$, "getPDBId", 
185 function () {
186 return this.pdbIds;
187 });
188 Clazz.overrideMethod (c$, "getDisplayId", 
189 function (jvsuffix) {
190 var result =  new StringBuffer (this.name);
191 if (jvsuffix) {
192 result.append ("/" + this.start + "-" + this.end);
193 }return result.toString ();
194 }, "~B");
195 Clazz.overrideMethod (c$, "setName", 
196 function (name) {
197 this.name = name;
198 this.parseId ();
199 }, "~S");
200 Clazz.defineMethod (c$, "getName", 
201 function () {
202 return this.name;
203 });
204 Clazz.overrideMethod (c$, "setStart", 
205 function (start) {
206 this.start = start;
207 }, "~N");
208 Clazz.defineMethod (c$, "getStart", 
209 function () {
210 return this.start;
211 });
212 Clazz.overrideMethod (c$, "setEnd", 
213 function (end) {
214 this.end = end;
215 }, "~N");
216 Clazz.defineMethod (c$, "getEnd", 
217 function () {
218 return this.end;
219 });
220 Clazz.overrideMethod (c$, "getLength", 
221 function () {
222 return this.sequence.length;
223 });
224 Clazz.defineMethod (c$, "setSequence", 
225 function (seq) {
226 this.sequence = seq.toCharArray ();
227 this.checkValidRange ();
228 }, "~S");
229 Clazz.defineMethod (c$, "getSequenceAsString", 
230 function () {
231 return  String.instantialize (this.sequence);
232 });
233 Clazz.defineMethod (c$, "getSequenceAsString", 
234 function (start, end) {
235 return  String.instantialize (this.getSequence (start, end));
236 }, "~N,~N");
237 Clazz.defineMethod (c$, "getSequence", 
238 function () {
239 return this.sequence;
240 });
241 Clazz.defineMethod (c$, "getSequence", 
242 function (start, end) {
243 if (start < 0) {
244 start = 0;
245 }if (start >= this.sequence.length) {
246 return  Clazz.newCharArray (0, '\0');
247 }if (end >= this.sequence.length) {
248 end = this.sequence.length;
249 }var reply =  Clazz.newCharArray (end - start, '\0');
250 System.arraycopy (this.sequence, start, reply, 0, end - start);
251 return reply;
252 }, "~N,~N");
253 Clazz.overrideMethod (c$, "getSubSequence", 
254 function (start, end) {
255 if (start < 0) {
256 start = 0;
257 }var seq = this.getSequence (start, end);
258 if (seq.length == 0) {
259 return null;
260 }var nstart = this.findPosition (start);
261 var nend = this.findPosition (end) - 1;
262 var nseq =  new jalview.datamodel.Sequence (this.getName (), seq, nstart, nend);
263 nseq.setDescription (this.description);
264 if (this.datasetSequence != null) {
265 nseq.setDatasetSequence (this.datasetSequence);
266 } else {
267 nseq.setDatasetSequence (this);
268 }return nseq;
269 }, "~N,~N");
270 Clazz.overrideMethod (c$, "getCharAt", 
271 function (i) {
272 if (i < this.sequence.length) {
273 return this.sequence[i];
274 } else {
275 return ' ';
276 }}, "~N");
277 Clazz.defineMethod (c$, "setDescription", 
278 function (desc) {
279 this.description = desc;
280 }, "~S");
281 Clazz.defineMethod (c$, "getDescription", 
282 function () {
283 return this.description;
284 });
285 Clazz.overrideMethod (c$, "findIndex", 
286 function (pos) {
287 var j = this.start;
288 var i = 0;
289 while ((i < this.sequence.length) && (j <= this.end) && (j <= pos)) {
290 if (!jalview.util.Comparison.isGap (this.sequence[i])) {
291 j++;
292 }i++;
293 }
294 if ((j == this.end) && (j < pos)) {
295 return this.end + 1;
296 } else {
297 return i;
298 }}, "~N");
299 Clazz.overrideMethod (c$, "findPosition", 
300 function (i) {
301 var j = 0;
302 var pos = this.start;
303 var seqlen = this.sequence.length;
304 while ((j < i) && (j < seqlen)) {
305 if (!jalview.util.Comparison.isGap (this.sequence[j])) {
306 pos++;
307 }j++;
308 }
309 return pos;
310 }, "~N");
311 Clazz.overrideMethod (c$, "gapMap", 
312 function () {
313 var seq = jalview.analysis.AlignSeq.extractGaps (jalview.util.Comparison.GapChars,  String.instantialize (this.sequence));
314 var map =  Clazz.newIntArray (seq.length, 0);
315 var j = 0;
316 var p = 0;
317 while (j < this.sequence.length) {
318 if (!jalview.util.Comparison.isGap (this.sequence[j])) {
319 map[p++] = j;
320 }j++;
321 }
322 return map;
323 });
324 Clazz.overrideMethod (c$, "findPositionMap", 
325 function () {
326 var map =  Clazz.newIntArray (this.sequence.length, 0);
327 var j = 0;
328 var pos = this.start;
329 var seqlen = this.sequence.length;
330 while ((j < seqlen)) {
331 map[j] = pos;
332 if (!jalview.util.Comparison.isGap (this.sequence[j])) {
333 pos++;
334 }j++;
335 }
336 return map;
337 });
338 Clazz.overrideMethod (c$, "getInsertions", 
339 function () {
340 var map =  new java.util.ArrayList ();
341 var lastj = -1;
342 var j = 0;
343 var pos = this.start;
344 var seqlen = this.sequence.length;
345 while ((j < seqlen)) {
346 if (jalview.util.Comparison.isGap (this.sequence[j])) {
347 if (lastj == -1) {
348 lastj = j;
349 }} else {
350 if (lastj != -1) {
351 map.add ( Clazz.newIntArray (-1, [lastj, j - 1]));
352 lastj = -1;
353 }}j++;
354 }
355 if (lastj != -1) {
356 map.add ( Clazz.newIntArray (-1, [lastj, j - 1]));
357 lastj = -1;
358 }return map;
359 });
360 Clazz.overrideMethod (c$, "deleteChars", 
361 function (i, j) {
362 var newstart = this.start;
363 var newend = this.end;
364 if (i >= this.sequence.length || i < 0) {
365 return;
366 }var tmp = jalview.util.StringUtils.deleteChars (this.sequence, i, j);
367 var createNewDs = false;
368 var eindex = -1;
369 var sindex = -1;
370 var ecalc = false;
371 var scalc = false;
372 for (var s = i; s < j; s++) {
373 if (jalview.schemes.ResidueProperties.aaIndex[this.sequence[s].charCodeAt (0)] != 23) {
374 if (createNewDs) {
375 newend--;
376 } else {
377 if (!scalc) {
378 sindex = this.findIndex (this.start) - 1;
379 scalc = true;
380 }if (sindex == s) {
381 newstart = this.findPosition (j);
382 break;
383 } else {
384 if (!ecalc) {
385 eindex = this.findIndex (this.end) - 1;
386 ecalc = true;
387 }if (eindex < j) {
388 newend = this.findPosition (i - 1);
389 break;
390 } else {
391 createNewDs = true;
392 newend--;
393 }}}}}
394 if (createNewDs && this.datasetSequence != null) {
395 var ds =  new jalview.datamodel.Sequence (this.datasetSequence);
396 ds.deleteChars (i, j);
397 this.datasetSequence = ds;
398 }this.start = newstart;
399 this.end = newend;
400 this.sequence = tmp;
401 }, "~N,~N");
402 Clazz.defineMethod (c$, "insertCharAt", 
403 function (i, length, c) {
404 var tmp =  Clazz.newCharArray (this.sequence.length + length, '\0');
405 if (i >= this.sequence.length) {
406 System.arraycopy (this.sequence, 0, tmp, 0, this.sequence.length);
407 i = this.sequence.length;
408 } else {
409 System.arraycopy (this.sequence, 0, tmp, 0, i);
410 }var index = i;
411 while (length > 0) {
412 tmp[index++] = c;
413 length--;
414 }
415 if (i < this.sequence.length) {
416 System.arraycopy (this.sequence, i, tmp, index, this.sequence.length - i);
417 }this.sequence = tmp;
418 }, "~N,~N,~S");
419 Clazz.defineMethod (c$, "insertCharAt", 
420 function (i, c) {
421 this.insertCharAt (i, 1, c);
422 }, "~N,~S");
423 Clazz.overrideMethod (c$, "getVamsasId", 
424 function () {
425 return this.vamsasId;
426 });
427 Clazz.overrideMethod (c$, "setVamsasId", 
428 function (id) {
429 this.vamsasId = id;
430 }, "~S");
431 Clazz.defineMethod (c$, "setDBRef", 
432 function (dbref) {
433 this.dbrefs = dbref;
434 }, "~A");
435 Clazz.defineMethod (c$, "getDBRef", 
436 function () {
437 if (this.dbrefs == null && this.datasetSequence != null && this !== this.datasetSequence) {
438 return this.datasetSequence.getDBRef ();
439 }return this.dbrefs;
440 });
441 Clazz.overrideMethod (c$, "addDBRef", 
442 function (entry) {
443 if (this.dbrefs == null) {
444 this.dbrefs =  new Array (0);
445 }var i;
446 var iSize = this.dbrefs.length;
447 for (i = 0; i < iSize; i++) {
448 if (this.dbrefs[i].equalRef (entry)) {
449 if (entry.getMap () != null) {
450 if (this.dbrefs[i].getMap () == null) {
451 this.dbrefs[i] = entry;
452 }}return;
453 }}
454 var temp =  new Array (iSize + 1);
455 System.arraycopy (this.dbrefs, 0, temp, 0, iSize);
456 temp[temp.length - 1] = entry;
457 this.dbrefs = temp;
458 }, "jalview.datamodel.DBRefEntry");
459 Clazz.defineMethod (c$, "setDatasetSequence", 
460 function (seq) {
461 this.datasetSequence = seq;
462 }, "jalview.datamodel.SequenceI");
463 Clazz.defineMethod (c$, "getDatasetSequence", 
464 function () {
465 return this.datasetSequence;
466 });
467 Clazz.defineMethod (c$, "getAnnotation", 
468 function () {
469 return this.annotation == null ? null : this.annotation.toArray ( new Array (this.annotation.size ()));
470 });
471 Clazz.overrideMethod (c$, "hasAnnotation", 
472 function (ann) {
473 return this.annotation == null ? false : this.annotation.contains (ann);
474 }, "jalview.datamodel.AlignmentAnnotation");
475 Clazz.defineMethod (c$, "addAlignmentAnnotation", 
476 function (annotation) {
477 if (this.annotation == null) {
478 this.annotation =  new java.util.Vector ();
479 }if (!this.annotation.contains (annotation)) {
480 this.annotation.addElement (annotation);
481 }annotation.setSequenceRef (this);
482 }, "jalview.datamodel.AlignmentAnnotation");
483 Clazz.overrideMethod (c$, "removeAlignmentAnnotation", 
484 function (annotation) {
485 if (this.annotation != null) {
486 this.annotation.removeElement (annotation);
487 if (this.annotation.size () == 0) {
488 this.annotation = null;
489 }}}, "jalview.datamodel.AlignmentAnnotation");
490 Clazz.defineMethod (c$, "isValidDatasetSequence", 
491 ($fz = function () {
492 if (this.datasetSequence != null) {
493 return false;
494 }for (var i = 0; i < this.sequence.length; i++) {
495 if (jalview.util.Comparison.isGap (this.sequence[i])) {
496 return false;
497 }}
498 return true;
499 }, $fz.isPrivate = true, $fz));
500 Clazz.overrideMethod (c$, "deriveSequence", 
501 function () {
502 var seq =  new jalview.datamodel.Sequence (this);
503 if (this.datasetSequence != null) {
504 seq.setDatasetSequence (this.datasetSequence);
505 } else {
506 if (this.isValidDatasetSequence ()) {
507 seq.setDatasetSequence (this);
508 } else {
509 var ds = seq;
510 ds.setSequence (jalview.analysis.AlignSeq.extractGaps (jalview.util.Comparison.GapChars,  String.instantialize (this.sequence)));
511 this.setDatasetSequence (ds);
512 ds.setSequenceFeatures (this.getSequenceFeatures ());
513 seq = this;
514 }}return seq;
515 });
516 Clazz.overrideMethod (c$, "createDatasetSequence", 
517 function () {
518 if (this.datasetSequence == null) {
519 this.datasetSequence =  new jalview.datamodel.Sequence (this.getName (), jalview.analysis.AlignSeq.extractGaps (jalview.util.Comparison.GapChars, this.getSequenceAsString ()), this.getStart (), this.getEnd ());
520 this.datasetSequence.setSequenceFeatures (this.getSequenceFeatures ());
521 this.datasetSequence.setDescription (this.getDescription ());
522 this.setSequenceFeatures (null);
523 this.datasetSequence.setDBRef (this.getDBRef ());
524 this.setDBRef (null);
525 this.datasetSequence.setPDBId (this.getPDBId ());
526 this.setPDBId (null);
527 this.datasetSequence.updatePDBIds ();
528 if (this.annotation != null) {
529 for (var aa, $aa = this.annotation.iterator (); $aa.hasNext () && ((aa = $aa.next ()) || true);) {
530 var _aa =  new jalview.datamodel.AlignmentAnnotation (aa);
531 _aa.sequenceRef = this.datasetSequence;
532 _aa.adjustForAlignment ();
533 this.datasetSequence.addAlignmentAnnotation (_aa);
534 }
535 }}return this.datasetSequence;
536 });
537 Clazz.overrideMethod (c$, "setAlignmentAnnotation", 
538 function (annotations) {
539 if (this.annotation != null) {
540 this.annotation.removeAllElements ();
541 }if (annotations != null) {
542 for (var i = 0; i < annotations.length; i++) {
543 if (annotations[i] != null) {
544 this.addAlignmentAnnotation (annotations[i]);
545 }}
546 }}, "~A");
547 Clazz.defineMethod (c$, "getAnnotation", 
548 function (label) {
549 if (this.annotation == null || this.annotation.size () == 0) {
550 return null;
551 }var subset =  new java.util.Vector ();
552 var e = this.annotation.elements ();
553 while (e.hasMoreElements ()) {
554 var ann = e.nextElement ();
555 if (ann.label != null && ann.label.equals (label)) {
556 subset.addElement (ann);
557 }}
558 if (subset.size () == 0) {
559 return null;
560 }var anns =  new Array (subset.size ());
561 var i = 0;
562 e = subset.elements ();
563 while (e.hasMoreElements ()) {
564 anns[i++] = e.nextElement ();
565 }
566 subset.removeAllElements ();
567 return anns;
568 }, "~S");
569 Clazz.defineMethod (c$, "updatePDBIds", 
570 function () {
571 if (this.datasetSequence != null) {
572 return this.datasetSequence.updatePDBIds ();
573 }if (this.dbrefs == null || this.dbrefs.length == 0) {
574 return false;
575 }var newpdb =  new java.util.Vector ();
576 for (var i = 0; i < this.dbrefs.length; i++) {
577 if (jalview.datamodel.DBRefSource.PDB.equals (this.dbrefs[i].getSource ())) {
578 var pdbe =  new jalview.datamodel.PDBEntry ();
579 pdbe.setId (this.dbrefs[i].getAccessionId ());
580 if (this.pdbIds == null || this.pdbIds.size () == 0) {
581 newpdb.addElement (pdbe);
582 } else {
583 var en = this.pdbIds.elements ();
584 var matched = false;
585 while (!matched && en.hasMoreElements ()) {
586 var anentry = en.nextElement ();
587 if (anentry.getId ().equals (pdbe.getId ())) {
588 matched = true;
589 }}
590 if (!matched) {
591 newpdb.addElement (pdbe);
592 }}}}
593 if (newpdb.size () > 0) {
594 var en = newpdb.elements ();
595 while (en.hasMoreElements ()) {
596 this.addPDBId (en.nextElement ());
597 }
598 return true;
599 }return false;
600 });
601 Clazz.defineMethod (c$, "transferAnnotation", 
602 function (entry, mp) {
603 if (this.datasetSequence != null) {
604 this.datasetSequence.transferAnnotation (entry, mp);
605 return;
606 }if (entry.getDatasetSequence () != null) {
607 this.transferAnnotation (entry.getDatasetSequence (), mp);
608 return;
609 }if (entry.getSequenceFeatures () != null) {
610 var sfs = entry.getSequenceFeatures ();
611 for (var si = 0; si < sfs.length; si++) {
612 var sf = (mp != null) ? mp.locateFeature (sfs[si]) :  Clazz.newArray (-1, [ new jalview.datamodel.SequenceFeature (sfs[si])]);
613 if (sf != null && sf.length > 0) {
614 for (var sfi = 0; sfi < sf.length; sfi++) {
615 this.addSequenceFeature (sf[sfi]);
616 }
617 }}
618 }if (entry.getPDBId () != null) {
619 var e = entry.getPDBId ().elements ();
620 while (e.hasMoreElements ()) {
621 var pdb = e.nextElement ();
622 this.addPDBId (pdb);
623 }
624 }var entryRefs = entry.getDBRef ();
625 if (entryRefs != null) {
626 for (var r = 0; r < entryRefs.length; r++) {
627 var newref =  new jalview.datamodel.DBRefEntry (entryRefs[r]);
628 if (newref.getMap () != null && mp != null) {
629 }this.addDBRef (newref);
630 }
631 }}, "jalview.datamodel.SequenceI,jalview.datamodel.Mapping");
632 Clazz.overrideMethod (c$, "getIndex", 
633 function () {
634 return this.index;
635 });
636 Clazz.overrideMethod (c$, "setIndex", 
637 function (value) {
638 this.index = value;
639 }, "~N");
640 Clazz.overrideMethod (c$, "setRNA", 
641 function (r) {
642 this.rna = r;
643 }, "jalview.jsdev.api.VarnaRNA");
644 Clazz.overrideMethod (c$, "getRNA", 
645 function () {
646 return this.rna;
647 });
648 Clazz.overrideMethod (c$, "getAlignmentAnnotations", 
649 function (calcId, label) {
650 var result =  new java.util.ArrayList ();
651 if (this.annotation != null) {
652 for (var ann, $ann = this.annotation.iterator (); $ann.hasNext () && ((ann = $ann.next ()) || true);) {
653 if (ann.calcId != null && ann.calcId.equals (calcId) && ann.label != null && ann.label.equals (label)) {
654 result.add (ann);
655 }}
656 }return result;
657 }, "~S,~S");
658 });