1 Clazz.declarePackage ("jalview.viewmodel");
2 Clazz.load (["jalview.api.AlignViewportI", "jalview.structure.CommandListener", "$.VamsasSource", "jalview.datamodel.ColumnSelection", "jalview.viewmodel.styles.ViewStyle", "jalview.workers.AlignCalcManager", "java.beans.PropertyChangeSupport", "java.util.ArrayDeque", "$.HashMap"], "jalview.viewmodel.AlignmentViewport", ["jalview.analysis.Conservation", "jalview.datamodel.AlignmentAnnotation", "$.AlignmentView", "$.CigarArray", "$.Sequence", "$.SequenceGroup", "jalview.schemes.Blosum62ColourScheme", "$.PIDColourScheme", "$.ResidueProperties", "jalview.util.Comparison", "$.MappingUtils", "jalview.workers.ComplementConsensusThread", "$.ConsensusThread", "$.ConservationThread", "$.StrucConsensusThread", "java.awt.Color", "java.util.ArrayList", "$.BitSet", "$.Hashtable"], function () {
3 c$ = Clazz.decorateAsClass (function () {
5 this.codingComplement = null;
6 this.featuresDisplayed = null;
7 this.historyList = null;
10 this.sequenceSetID = null;
11 this.$isDataset = false;
12 this.hiddenRepSequences = null;
14 this.autoCalculateConsensus = true;
15 this.autoCalculateStrucConsensus = true;
16 this.ignoreGapsInConsensusCalculation = false;
17 this.globalColourScheme = null;
18 this.consensus = null;
19 this.complementConsensus = null;
20 this.strucConsensus = null;
21 this.conservation = null;
23 this.groupConsensus = null;
24 this.groupConservation = null;
25 this.hconsensus = null;
26 this.hcomplementConsensus = null;
27 this.hStrucConsensus = null;
28 this.hconservation = null;
29 this.ConsPercGaps = 25;
30 this.calculator = null;
31 this.showGroupConservation = false;
32 this.showGroupConsensus = false;
33 this.showSequenceLogo = false;
34 this.normaliseSequenceLogo = false;
35 this.showConsensusHistogram = true;
37 this.sortByTree = false;
38 this.selectionGroup = null;
42 this.changeSupport = null;
43 this.showConservation = true;
44 this.showQuality = true;
45 this.showConsensus = true;
46 this.sequenceColours = null;
47 this.sortAnnotationsBy = null;
48 this.showAutocalculatedAbove = false;
49 this.followHighlight = true;
54 Clazz.instantialize (this, arguments);
55 }, jalview.viewmodel, "AlignmentViewport", null, [jalview.api.AlignViewportI, jalview.structure.CommandListener, jalview.structure.VamsasSource]);
56 Clazz.prepareFields (c$, function () {
57 this.viewStyle = new jalview.viewmodel.styles.ViewStyle ();
58 this.historyList = new java.util.ArrayDeque ();
59 this.redoList = new java.util.ArrayDeque ();
60 this.colSel = new jalview.datamodel.ColumnSelection ();
61 this.calculator = new jalview.workers.AlignCalcManager ();
62 this.changeSupport = new java.beans.PropertyChangeSupport (this);
63 this.sequenceColours = new java.util.HashMap ();
65 Clazz.defineMethod (c$, "setFontName",
67 this.viewStyle.setFontName (name);
69 Clazz.defineMethod (c$, "setFontStyle",
71 this.viewStyle.setFontStyle (style);
73 Clazz.defineMethod (c$, "setFontSize",
75 this.viewStyle.setFontSize (size);
77 Clazz.defineMethod (c$, "getFontStyle",
79 return this.viewStyle.getFontStyle ();
81 Clazz.defineMethod (c$, "getFontName",
83 return this.viewStyle.getFontName ();
85 Clazz.defineMethod (c$, "getFontSize",
87 return this.viewStyle.getFontSize ();
89 Clazz.defineMethod (c$, "setUpperCasebold",
90 function (upperCasebold) {
91 this.viewStyle.setUpperCasebold (upperCasebold);
93 Clazz.defineMethod (c$, "isUpperCasebold",
95 return this.viewStyle.isUpperCasebold ();
97 Clazz.defineMethod (c$, "isSeqNameItalics",
99 return this.viewStyle.isSeqNameItalics ();
101 Clazz.defineMethod (c$, "setColourByReferenceSeq",
102 function (colourByReferenceSeq) {
103 this.viewStyle.setColourByReferenceSeq (colourByReferenceSeq);
105 Clazz.defineMethod (c$, "setColourAppliesToAllGroups",
107 this.viewStyle.setColourAppliesToAllGroups (b);
109 Clazz.defineMethod (c$, "getColourAppliesToAllGroups",
111 return this.viewStyle.getColourAppliesToAllGroups ();
113 Clazz.defineMethod (c$, "getAbovePIDThreshold",
115 return this.viewStyle.getAbovePIDThreshold ();
117 Clazz.defineMethod (c$, "setIncrement",
119 this.viewStyle.setIncrement (inc);
121 Clazz.defineMethod (c$, "getIncrement",
123 return this.viewStyle.getIncrement ();
125 Clazz.defineMethod (c$, "setConservationSelected",
127 this.viewStyle.setConservationSelected (b);
129 Clazz.defineMethod (c$, "setShowHiddenMarkers",
131 this.viewStyle.setShowHiddenMarkers (show);
133 Clazz.defineMethod (c$, "getShowHiddenMarkers",
135 return this.viewStyle.getShowHiddenMarkers ();
137 Clazz.defineMethod (c$, "setScaleRightWrapped",
139 this.viewStyle.setScaleRightWrapped (b);
141 Clazz.defineMethod (c$, "setScaleLeftWrapped",
143 this.viewStyle.setScaleLeftWrapped (b);
145 Clazz.defineMethod (c$, "setScaleAboveWrapped",
147 this.viewStyle.setScaleAboveWrapped (b);
149 Clazz.defineMethod (c$, "getScaleLeftWrapped",
151 return this.viewStyle.getScaleLeftWrapped ();
153 Clazz.defineMethod (c$, "getScaleAboveWrapped",
155 return this.viewStyle.getScaleAboveWrapped ();
157 Clazz.defineMethod (c$, "getScaleRightWrapped",
159 return this.viewStyle.getScaleRightWrapped ();
161 Clazz.defineMethod (c$, "setAbovePIDThreshold",
163 this.viewStyle.setAbovePIDThreshold (b);
165 Clazz.defineMethod (c$, "setThreshold",
167 this.viewStyle.setThreshold (thresh);
169 Clazz.defineMethod (c$, "getThreshold",
171 return this.viewStyle.getThreshold ();
173 Clazz.defineMethod (c$, "getShowJVSuffix",
175 return this.viewStyle.getShowJVSuffix ();
177 Clazz.defineMethod (c$, "setShowJVSuffix",
179 this.viewStyle.setShowJVSuffix (b);
181 Clazz.defineMethod (c$, "setWrapAlignment",
183 this.viewStyle.setWrapAlignment (state);
185 Clazz.defineMethod (c$, "setShowText",
187 this.viewStyle.setShowText (state);
189 Clazz.defineMethod (c$, "setRenderGaps",
191 this.viewStyle.setRenderGaps (state);
193 Clazz.defineMethod (c$, "getColourText",
195 return this.viewStyle.getColourText ();
197 Clazz.defineMethod (c$, "setColourText",
199 this.viewStyle.setColourText (state);
201 Clazz.defineMethod (c$, "getWrapAlignment",
203 return this.viewStyle.getWrapAlignment ();
205 Clazz.defineMethod (c$, "getShowText",
207 return this.viewStyle.getShowText ();
209 Clazz.defineMethod (c$, "getWrappedWidth",
211 return this.viewStyle.getWrappedWidth ();
213 Clazz.defineMethod (c$, "setWrappedWidth",
215 this.viewStyle.setWrappedWidth (w);
217 Clazz.defineMethod (c$, "getCharHeight",
219 return this.viewStyle.getCharHeight ();
221 Clazz.defineMethod (c$, "setCharHeight",
223 this.viewStyle.setCharHeight (h);
225 Clazz.defineMethod (c$, "getCharWidth",
227 return this.viewStyle.getCharWidth ();
229 Clazz.defineMethod (c$, "setCharWidth",
231 this.viewStyle.setCharWidth (w);
233 Clazz.defineMethod (c$, "getShowBoxes",
235 return this.viewStyle.getShowBoxes ();
237 Clazz.defineMethod (c$, "getShowUnconserved",
239 return this.viewStyle.getShowUnconserved ();
241 Clazz.defineMethod (c$, "setShowUnconserved",
242 function (showunconserved) {
243 this.viewStyle.setShowUnconserved (showunconserved);
245 Clazz.defineMethod (c$, "setSeqNameItalics",
246 function (default1) {
247 this.viewStyle.setSeqNameItalics (default1);
249 Clazz.defineMethod (c$, "getAlignment",
251 return this.alignment;
253 Clazz.overrideMethod (c$, "getGapCharacter",
255 return this.alignment.getGapCharacter ();
257 Clazz.defineMethod (c$, "setDataset",
261 Clazz.defineMethod (c$, "isDataset",
263 return this.$isDataset;
265 Clazz.overrideMethod (c$, "setGlobalColourScheme",
267 this.globalColourScheme = cs;
270 cs.setConservationApplied (recalc = this.getConservationSelected ());
271 if (this.getAbovePIDThreshold () || Clazz.instanceOf (cs, jalview.schemes.PIDColourScheme) || Clazz.instanceOf (cs, jalview.schemes.Blosum62ColourScheme)) {
273 cs.setThreshold (this.viewStyle.getThreshold (), this.ignoreGapsInConsensusCalculation);
275 cs.setThreshold (0, this.ignoreGapsInConsensusCalculation);
277 cs.setConsensus (this.hconsensus);
278 cs.setConservation (this.hconservation);
279 }cs.alignmentChanged (this.alignment, this.hiddenRepSequences);
280 }if (this.getColourAppliesToAllGroups ()) {
281 for (var sg, $sg = this.getAlignment ().getGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {
285 }sg.cs = cs.applyTo (sg, this.getHiddenRepSequences ());
286 sg.setConsPercGaps (this.ConsPercGaps);
287 if (this.getAbovePIDThreshold () || Clazz.instanceOf (cs, jalview.schemes.PIDColourScheme) || Clazz.instanceOf (cs, jalview.schemes.Blosum62ColourScheme)) {
288 sg.cs.setThreshold (this.viewStyle.getThreshold (), this.isIgnoreGapsConsensus ());
291 sg.cs.setThreshold (0, this.isIgnoreGapsConsensus ());
292 }if (this.getConservationSelected ()) {
293 sg.cs.setConservationApplied (true);
296 sg.cs.setConservation (null);
298 sg.recalcConservation ();
300 sg.cs.alignmentChanged (sg, this.hiddenRepSequences);
302 }}, "jalview.schemes.ColourSchemeI");
303 Clazz.overrideMethod (c$, "getGlobalColourScheme",
305 return this.globalColourScheme;
307 Clazz.overrideMethod (c$, "setConservation",
309 this.hconservation = cons;
310 }, "jalview.analysis.Conservation");
311 Clazz.overrideMethod (c$, "getConsPercGaps",
313 return this.ConsPercGaps;
315 Clazz.overrideMethod (c$, "setSequenceConsensusHash",
316 function (hconsensus) {
317 this.hconsensus = hconsensus;
319 Clazz.overrideMethod (c$, "setComplementConsensusHash",
320 function (hconsensus) {
321 this.hcomplementConsensus = hconsensus;
323 Clazz.overrideMethod (c$, "getSequenceConsensusHash",
325 return this.hconsensus;
327 Clazz.overrideMethod (c$, "getComplementConsensusHash",
329 return this.hcomplementConsensus;
331 Clazz.overrideMethod (c$, "getRnaStructureConsensusHash",
333 return this.hStrucConsensus;
335 Clazz.overrideMethod (c$, "setRnaStructureConsensusHash",
336 function (hStrucConsensus) {
337 this.hStrucConsensus = hStrucConsensus;
339 Clazz.overrideMethod (c$, "getAlignmentQualityAnnot",
343 Clazz.overrideMethod (c$, "getAlignmentConservationAnnotation",
345 return this.conservation;
347 Clazz.overrideMethod (c$, "getAlignmentConsensusAnnotation",
349 return this.consensus;
351 Clazz.overrideMethod (c$, "getComplementConsensusAnnotation",
353 return this.complementConsensus;
355 Clazz.overrideMethod (c$, "getAlignmentStrucConsensusAnnotation",
357 return this.strucConsensus;
359 Clazz.defineMethod (c$, "updateConservation",
361 if (this.alignment.isNucleotide () || this.conservation == null || !this.autoCalculateConsensus) {
363 }if (this.calculator.getRegisteredWorkersOfClass (jalview.workers.ConservationThread) == null) {
364 this.calculator.registerWorker ( new jalview.workers.ConservationThread (this, ap));
365 }}, "jalview.api.AlignmentViewPanel");
366 Clazz.defineMethod (c$, "updateConsensus",
368 if (this.consensus == null || !this.autoCalculateConsensus) {
370 }if (this.calculator.getRegisteredWorkersOfClass (jalview.workers.ConsensusThread) == null) {
371 this.calculator.registerWorker ( new jalview.workers.ConsensusThread (this, ap));
372 }var al = this.getAlignment ();
373 if (!al.isNucleotide () && al.getCodonFrames () != null && !al.getCodonFrames ().isEmpty ()) {
374 if (this.calculator.getRegisteredWorkersOfClass (jalview.workers.ComplementConsensusThread) == null) {
375 this.calculator.registerWorker ( new jalview.workers.ComplementConsensusThread (this, ap));
376 }}}, "jalview.api.AlignmentViewPanel");
377 Clazz.defineMethod (c$, "updateStrucConsensus",
379 if (this.autoCalculateStrucConsensus && this.strucConsensus == null && this.alignment.isNucleotide () && this.alignment.hasRNAStructure ()) {
380 this.initRNAStructure ();
381 }if (this.strucConsensus == null || !this.autoCalculateStrucConsensus) {
383 }if (this.calculator.getRegisteredWorkersOfClass (jalview.workers.StrucConsensusThread) == null) {
384 this.calculator.registerWorker ( new jalview.workers.StrucConsensusThread (this, ap));
385 }}, "jalview.api.AlignmentViewPanel");
386 Clazz.defineMethod (c$, "isCalcInProgress",
388 return this.calculator.isWorking ();
390 Clazz.overrideMethod (c$, "isCalculationInProgress",
391 function (alignmentAnnotation) {
392 if (!alignmentAnnotation.autoCalculated) {
394 }if (this.calculator.workingInvolvedWith (alignmentAnnotation)) {
397 }, "jalview.datamodel.AlignmentAnnotation");
398 Clazz.overrideMethod (c$, "isClosed",
400 return this.alignment == null;
402 Clazz.overrideMethod (c$, "getCalcManager",
404 return this.calculator;
406 Clazz.overrideMethod (c$, "isShowSequenceLogo",
408 return this.showSequenceLogo;
410 Clazz.defineMethod (c$, "setShowSequenceLogo",
411 function (showSequenceLogo) {
412 if (showSequenceLogo != this.showSequenceLogo) {
413 this.showSequenceLogo = showSequenceLogo;
414 this.calculator.updateAnnotationFor (jalview.workers.ConsensusThread);
415 this.calculator.updateAnnotationFor (jalview.workers.ComplementConsensusThread);
416 this.calculator.updateAnnotationFor (jalview.workers.StrucConsensusThread);
417 }this.showSequenceLogo = showSequenceLogo;
419 Clazz.defineMethod (c$, "setShowConsensusHistogram",
420 function (showConsensusHistogram) {
421 this.showConsensusHistogram = showConsensusHistogram;
423 Clazz.defineMethod (c$, "isShowGroupConservation",
425 return this.showGroupConservation;
427 Clazz.defineMethod (c$, "setShowGroupConservation",
428 function (showGroupConservation) {
429 this.showGroupConservation = showGroupConservation;
431 Clazz.defineMethod (c$, "isShowGroupConsensus",
433 return this.showGroupConsensus;
435 Clazz.defineMethod (c$, "setShowGroupConsensus",
436 function (showGroupConsensus) {
437 this.showGroupConsensus = showGroupConsensus;
439 Clazz.overrideMethod (c$, "isShowConsensusHistogram",
441 return this.showConsensusHistogram;
443 Clazz.overrideMethod (c$, "getSelectionGroup",
445 return this.selectionGroup;
447 Clazz.overrideMethod (c$, "setSelectionGroup",
449 this.selectionGroup = sg;
450 }, "jalview.datamodel.SequenceGroup");
451 Clazz.defineMethod (c$, "setHiddenColumns",
453 this.colSel = colsel;
454 }, "jalview.datamodel.ColumnSelection");
455 Clazz.overrideMethod (c$, "getColumnSelection",
459 Clazz.overrideMethod (c$, "setColumnSelection",
461 this.colSel = colSel;
462 if (colSel != null) {
463 this.updateHiddenColumns ();
464 }}, "jalview.datamodel.ColumnSelection");
465 Clazz.overrideMethod (c$, "getHiddenRepSequences",
467 return this.hiddenRepSequences;
469 Clazz.overrideMethod (c$, "setHiddenRepSequences",
470 function (hiddenRepSequences) {
471 this.hiddenRepSequences = hiddenRepSequences;
473 Clazz.overrideMethod (c$, "hasHiddenColumns",
475 return this.colSel != null && this.colSel.hasHiddenColumns ();
477 Clazz.defineMethod (c$, "updateHiddenColumns",
480 Clazz.overrideMethod (c$, "hasHiddenRows",
482 return this.alignment.getHiddenSequences ().getSize () > 0;
484 Clazz.defineMethod (c$, "setSequenceSetId",
486 if (this.sequenceSetID != null) {
487 System.err.println ("Warning - overwriting a sequenceSetId for a viewport!");
488 }this.sequenceSetID = String.instantialize (newid);
490 Clazz.overrideMethod (c$, "getSequenceSetId",
492 if (this.sequenceSetID == null) {
493 this.sequenceSetID = this.alignment.hashCode () + "";
494 }return this.sequenceSetID;
496 Clazz.overrideMethod (c$, "getViewId",
498 if (this.viewId == null) {
499 this.viewId = this.getSequenceSetId () + "." + this.hashCode () + "";
502 Clazz.defineMethod (c$, "setIgnoreGapsConsensus",
504 this.ignoreGapsInConsensusCalculation = b;
506 this.updateConsensus (ap);
507 if (this.globalColourScheme != null) {
508 this.globalColourScheme.setThreshold (this.globalColourScheme.getThreshold (), this.ignoreGapsInConsensusCalculation);
509 }}}, "~B,jalview.api.AlignmentViewPanel");
510 Clazz.defineMethod (c$, "isSelectionGroupChanged",
512 var hc = (this.selectionGroup == null || this.selectionGroup.getSize () == 0) ? -1 : this.selectionGroup.hashCode ();
513 if (hc != -1 && hc != this.sgrouphash) {
515 this.sgrouphash = hc;
519 Clazz.defineMethod (c$, "isColSelChanged",
521 var hc = (this.colSel == null || this.colSel.size () == 0) ? -1 : this.colSel.hashCode ();
522 if (hc != -1 && hc != this.colselhash) {
524 this.colselhash = hc;
528 Clazz.overrideMethod (c$, "isIgnoreGapsConsensus",
530 return this.ignoreGapsInConsensusCalculation;
532 Clazz.defineMethod (c$, "addPropertyChangeListener",
533 function (listener) {
534 this.changeSupport.addPropertyChangeListener (listener);
535 }, "java.beans.PropertyChangeListener");
536 Clazz.defineMethod (c$, "removePropertyChangeListener",
537 function (listener) {
538 this.changeSupport.removePropertyChangeListener (listener);
539 }, "java.beans.PropertyChangeListener");
540 Clazz.defineMethod (c$, "firePropertyChange",
541 function (prop, oldvalue, newvalue) {
542 this.changeSupport.firePropertyChange (prop, oldvalue, newvalue);
544 Clazz.defineMethod (c$, "hideSelectedColumns",
546 if (this.colSel.size () < 1) {
548 }this.colSel.hideSelectedColumns ();
549 this.setSelectionGroup (null);
551 Clazz.defineMethod (c$, "hideColumns",
552 function (start, end) {
554 this.colSel.hideColumns (start);
556 this.colSel.hideColumns (start, end);
558 Clazz.defineMethod (c$, "showColumn",
560 this.colSel.revealHiddenColumns (col);
562 Clazz.defineMethod (c$, "showAllHiddenColumns",
564 this.colSel.revealAllHiddenColumns ();
566 Clazz.defineMethod (c$, "showAllHiddenSeqs",
568 if (this.alignment.getHiddenSequences ().getSize () > 0) {
569 if (this.selectionGroup == null) {
570 this.selectionGroup = new jalview.datamodel.SequenceGroup ();
571 this.selectionGroup.setEndRes (this.alignment.getWidth () - 1);
572 }var tmp = this.alignment.getHiddenSequences ().showAll (this.hiddenRepSequences);
573 for (var seq, $seq = tmp.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) {
574 this.selectionGroup.addSequence (seq, false);
575 this.setSequenceAnnotationsVisible (seq, true);
577 this.hiddenRepSequences = null;
578 this.firePropertyChange ("alignment", null, this.alignment.getSequences ());
579 this.sendSelection ();
581 Clazz.defineMethod (c$, "showSequence",
583 var tmp = this.alignment.getHiddenSequences ().showSequence (index, this.hiddenRepSequences);
584 if (tmp.size () > 0) {
585 if (this.selectionGroup == null) {
586 this.selectionGroup = new jalview.datamodel.SequenceGroup ();
587 this.selectionGroup.setEndRes (this.alignment.getWidth () - 1);
588 }for (var seq, $seq = tmp.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) {
589 this.selectionGroup.addSequence (seq, false);
590 this.setSequenceAnnotationsVisible (seq, true);
592 this.firePropertyChange ("alignment", null, this.alignment.getSequences ());
593 this.sendSelection ();
595 Clazz.defineMethod (c$, "hideAllSelectedSeqs",
597 if (this.selectionGroup == null || this.selectionGroup.getSize () < 1) {
599 }var seqs = this.selectionGroup.getSequencesInOrder (this.alignment);
600 this.hideSequence (seqs);
601 this.setSelectionGroup (null);
603 Clazz.defineMethod (c$, "hideSequence",
606 for (var i = 0; i < seq.length; i++) {
607 this.alignment.getHiddenSequences ().hideSequence (seq[i]);
608 this.setSequenceAnnotationsVisible (seq[i], false);
610 this.firePropertyChange ("alignment", null, this.alignment.getSequences ());
612 Clazz.defineMethod (c$, "setSequenceAnnotationsVisible",
613 function (sequenceI, visible) {
614 for (var ann, $ann = 0, $$ann = this.alignment.getAlignmentAnnotation (); $ann < $$ann.length && ((ann = $$ann[$ann]) || true); $ann++) {
615 if (ann.sequenceRef === sequenceI) {
616 ann.visible = visible;
618 }, "jalview.datamodel.SequenceI,~B");
619 Clazz.defineMethod (c$, "hideRepSequences",
620 function (repSequence, sg) {
621 var sSize = sg.getSize ();
624 }if (this.hiddenRepSequences == null) {
625 this.hiddenRepSequences = new java.util.Hashtable ();
626 }this.hiddenRepSequences.put (repSequence, sg);
627 var seqs = new Array (sSize - 1);
629 for (var i = 0; i < sSize; i++) {
630 if (sg.getSequenceAt (i) !== repSequence) {
631 if (index == sSize - 1) {
633 }seqs[index++] = sg.getSequenceAt (i);
635 sg.setSeqrep (repSequence);
636 sg.setHidereps (true);
637 this.hideSequence (seqs);
638 }, "jalview.datamodel.SequenceI,jalview.datamodel.SequenceGroup");
639 Clazz.defineMethod (c$, "isHiddenRepSequence",
641 return this.alignment.getSeqrep () === seq || (this.hiddenRepSequences != null && this.hiddenRepSequences.containsKey (seq));
642 }, "jalview.datamodel.SequenceI");
643 Clazz.defineMethod (c$, "getRepresentedSequences",
645 return (this.hiddenRepSequences == null ? null : this.hiddenRepSequences.get (seq));
646 }, "jalview.datamodel.SequenceI");
647 Clazz.overrideMethod (c$, "adjustForHiddenSeqs",
648 function (alignmentIndex) {
649 return this.alignment.getHiddenSequences ().adjustForHiddenSeqs (alignmentIndex);
651 Clazz.overrideMethod (c$, "invertColumnSelection",
653 this.colSel.invertColumnSelection (0, this.alignment.getWidth ());
655 Clazz.overrideMethod (c$, "getSelectionAsNewSequence",
658 if (this.selectionGroup == null || this.selectionGroup.getSize () == 0) {
659 sequences = this.alignment.getSequencesArray ();
660 var annots = this.alignment.getAlignmentAnnotation ();
661 for (var i = 0; i < sequences.length; i++) {
662 sequences[i] = new jalview.datamodel.Sequence (sequences[i], annots);
665 sequences = this.selectionGroup.getSelectionAsNewSequences (this.alignment);
668 Clazz.overrideMethod (c$, "getSequenceSelection",
670 var sequences = null;
671 if (this.selectionGroup != null) {
672 sequences = this.selectionGroup.getSequencesInOrder (this.alignment);
673 }if (sequences == null) {
674 sequences = this.alignment.getSequencesArray ();
677 Clazz.overrideMethod (c$, "getViewAsCigars",
678 function (selectedRegionOnly) {
679 return new jalview.datamodel.CigarArray (this.alignment, this.colSel, (selectedRegionOnly ? this.selectionGroup : null));
681 Clazz.defineMethod (c$, "getAlignmentView",
682 function (selectedOnly) {
683 return this.getAlignmentView (selectedOnly, false);
685 Clazz.defineMethod (c$, "getAlignmentView",
686 function (selectedOnly, markGroups) {
687 return new jalview.datamodel.AlignmentView (this.alignment, this.colSel, this.selectionGroup, this.colSel != null && this.colSel.hasHiddenColumns (), selectedOnly, markGroups);
689 Clazz.overrideMethod (c$, "getViewAsString",
690 function (selectedRegionOnly) {
691 var selection = null;
697 if (selectedRegionOnly && this.selectionGroup != null) {
698 iSize = this.selectionGroup.getSize ();
699 seqs = this.selectionGroup.getSequencesInOrder (this.alignment);
700 start = this.selectionGroup.getStartRes ();
701 end = this.selectionGroup.getEndRes () + 1;
703 iSize = this.alignment.getHeight ();
704 seqs = this.alignment.getSequencesArray ();
705 end = this.alignment.getWidth ();
706 }selection = new Array (iSize);
707 if (this.colSel != null && this.colSel.hasHiddenColumns ()) {
708 selection = this.colSel.getVisibleSequenceStrings (start, end, seqs);
710 for (i = 0; i < iSize; i++) {
711 selection[i] = seqs[i].getSequenceAsString (start, end);
715 Clazz.overrideMethod (c$, "getVisibleRegionBoundaries",
716 function (min, max) {
717 var regions = new java.util.ArrayList ();
721 if (this.colSel != null && this.colSel.hasHiddenColumns ()) {
723 start = this.colSel.adjustForHiddenColumns (start);
724 }end = this.colSel.getHiddenBoundaryRight (start);
729 }}regions.add ( Clazz.newIntArray (-1, [start, end]));
730 if (this.colSel != null && this.colSel.hasHiddenColumns ()) {
731 start = this.colSel.adjustForHiddenColumns (end);
732 start = this.colSel.getHiddenBoundaryLeft (start) + 1;
733 }} while (end < max);
734 var startEnd = Clazz.newIntArray (regions.size (), 2, 0);
737 Clazz.overrideMethod (c$, "getVisibleAlignmentAnnotation",
738 function (selectedOnly) {
739 var ala = new java.util.ArrayList ();
741 if ((aa = this.alignment.getAlignmentAnnotation ()) != null) {
742 for (var annot, $annot = 0, $$annot = aa; $annot < $$annot.length && ((annot = $$annot[$annot]) || true); $annot++) {
743 var clone = new jalview.datamodel.AlignmentAnnotation (annot);
744 if (selectedOnly && this.selectionGroup != null) {
745 this.colSel.makeVisibleAnnotation (this.selectionGroup.getStartRes (), this.selectionGroup.getEndRes (), clone);
747 this.colSel.makeVisibleAnnotation (clone);
752 Clazz.overrideMethod (c$, "isPadGaps",
756 Clazz.overrideMethod (c$, "setPadGaps",
758 this.padGaps = padGaps;
760 Clazz.overrideMethod (c$, "alignmentChanged",
762 if (this.isPadGaps ()) {
763 this.alignment.padGaps ();
764 }if (this.autoCalculateConsensus) {
765 this.updateConsensus (ap);
766 }if (this.hconsensus != null && this.autoCalculateConsensus) {
767 this.updateConservation (ap);
768 }if (this.autoCalculateStrucConsensus) {
769 this.updateStrucConsensus (ap);
770 }var alWidth = this.alignment.getWidth ();
771 var groups = this.alignment.getGroups ();
772 if (groups != null) {
773 for (var sg, $sg = groups.iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {
774 if (sg.getEndRes () > alWidth) {
775 sg.setEndRes (alWidth - 1);
777 }if (this.selectionGroup != null && this.selectionGroup.getEndRes () > alWidth) {
778 this.selectionGroup.setEndRes (alWidth - 1);
779 }this.resetAllColourSchemes ();
780 this.calculator.restartWorkers ();
781 }, "jalview.api.AlignmentViewPanel");
782 Clazz.defineMethod (c$, "resetAllColourSchemes",
784 var cs = this.globalColourScheme;
786 cs.alignmentChanged (this.alignment, this.hiddenRepSequences);
787 cs.setConsensus (this.hconsensus);
788 if (cs.conservationApplied ()) {
789 cs.setConservation (jalview.analysis.Conservation.calculateConservation ("All", jalview.schemes.ResidueProperties.propHash, 3, this.alignment.getSequences (), 0, this.alignment.getWidth (), false, this.getConsPercGaps (), false));
790 }}for (var sg, $sg = this.alignment.getGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {
792 sg.cs.alignmentChanged (sg, this.hiddenRepSequences);
793 }sg.recalcConservation ();
796 Clazz.defineMethod (c$, "initAutoAnnotation",
798 if (this.hconsensus == null && !this.$isDataset) {
799 if (!this.alignment.isNucleotide ()) {
800 this.initConservation ();
803 this.initRNAStructure ();
804 }this.consensus = new jalview.datamodel.AlignmentAnnotation ("Consensus", "PID", new Array (1), 0, 100, 1);
805 this.initConsensus (this.consensus);
806 this.initComplementConsensus ();
808 Clazz.defineMethod (c$, "initComplementConsensus",
810 if (!this.alignment.isNucleotide ()) {
811 var codonMappings = this.alignment.getCodonFrames ();
812 if (codonMappings != null && !codonMappings.isEmpty ()) {
813 this.complementConsensus = new jalview.datamodel.AlignmentAnnotation ("cDNA Consensus", "PID for cDNA", new Array (1), 0, 100, 1);
814 this.initConsensus (this.complementConsensus);
816 Clazz.defineMethod (c$, "initConsensus",
819 aa.autoCalculated = true;
820 if (this.showConsensus) {
821 this.alignment.addAnnotation (aa);
822 }}, "jalview.datamodel.AlignmentAnnotation");
823 Clazz.defineMethod (c$, "initConservation",
825 if (this.showConservation) {
826 if (this.conservation == null) {
827 this.conservation = new jalview.datamodel.AlignmentAnnotation ("Conservation", "Conservation of total alignment less than " + this.getConsPercGaps () + "% gaps", new Array (1), 0, 11, 1);
828 this.conservation.hasText = true;
829 this.conservation.autoCalculated = true;
830 this.alignment.addAnnotation (this.conservation);
832 Clazz.defineMethod (c$, "initQuality",
834 if (this.showQuality) {
835 if (this.quality == null) {
836 this.quality = new jalview.datamodel.AlignmentAnnotation ("Quality", "Alignment Quality based on Blosum62 scores", new Array (1), 0, 11, 1);
837 this.quality.hasText = true;
838 this.quality.autoCalculated = true;
839 this.alignment.addAnnotation (this.quality);
841 Clazz.defineMethod (c$, "initRNAStructure",
843 if (this.alignment.hasRNAStructure () && this.strucConsensus == null) {
844 this.strucConsensus = new jalview.datamodel.AlignmentAnnotation ("StrucConsensus", "PID", new Array (1), 0, 100, 1);
845 this.strucConsensus.hasText = true;
846 this.strucConsensus.autoCalculated = true;
847 if (this.showConsensus) {
848 this.alignment.addAnnotation (this.strucConsensus);
850 Clazz.overrideMethod (c$, "calcPanelHeight",
852 var anns = this.getAlignment ().getAlignmentAnnotation ();
854 var charHeight = this.getCharHeight ();
856 var graphgrp = new java.util.BitSet ();
857 for (var aa, $aa = 0, $$aa = anns; $aa < $$aa.length && ((aa = $$aa[$aa]) || true); $aa++) {
859 System.err.println ("Null annotation row: ignoring.");
863 }if (aa.graphGroup > -1) {
864 if (graphgrp.get (aa.graphGroup)) {
867 graphgrp.set (aa.graphGroup);
870 aa.height += charHeight;
874 aa.height += aa.graphHeight;
875 }if (aa.height == 0) {
877 }height += aa.height;
883 Clazz.overrideMethod (c$, "updateGroupAnnotationSettings",
884 function (applyGlobalSettings, preserveNewGroupSettings) {
885 var updateCalcs = false;
886 var conv = this.isShowGroupConservation ();
887 var cons = this.isShowGroupConsensus ();
888 var showprf = this.isShowSequenceLogo ();
889 var showConsHist = this.isShowConsensusHistogram ();
890 var normLogo = this.isNormaliseSequenceLogo ();
892 var aan = this.alignment.getAlignmentAnnotation ();
893 var oldrfs = new java.util.ArrayList ();
895 for (var an = 0; an < aan.length; an++) {
896 if (aan[an].autoCalculated && aan[an].groupRef != null) {
897 oldrfs.add (aan[an].groupRef);
898 this.alignment.deleteAnnotation (aan[an], false);
900 }if (this.alignment.getGroups () != null) {
901 for (var sg, $sg = this.alignment.getGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {
903 if (applyGlobalSettings || (!preserveNewGroupSettings && !oldrfs.contains (sg))) {
904 sg.setshowSequenceLogo (showprf);
905 sg.setShowConsensusHistogram (showConsHist);
906 sg.setNormaliseSequenceLogo (normLogo);
909 this.alignment.addAnnotation (sg.getConservationRow (), 0);
912 this.alignment.addAnnotation (sg.getConsensus (), 0);
914 sg.recalcConservation ();
918 Clazz.defineMethod (c$, "isDisplayReferenceSeq",
920 return this.alignment.hasSeqrep () && this.viewStyle.isDisplayReferenceSeq ();
922 Clazz.defineMethod (c$, "setDisplayReferenceSeq",
923 function (displayReferenceSeq) {
924 this.viewStyle.setDisplayReferenceSeq (displayReferenceSeq);
926 Clazz.defineMethod (c$, "isColourByReferenceSeq",
928 return this.alignment.hasSeqrep () && this.viewStyle.isColourByReferenceSeq ();
930 Clazz.overrideMethod (c$, "getSequenceColour",
932 var sqc = this.sequenceColours.get (seq);
933 return (sqc == null ? java.awt.Color.white : sqc);
934 }, "jalview.datamodel.SequenceI");
935 Clazz.overrideMethod (c$, "setSequenceColour",
936 function (seq, col) {
938 this.sequenceColours.remove (seq);
940 this.sequenceColours.put (seq, col);
941 }}, "jalview.datamodel.SequenceI,java.awt.Color");
942 Clazz.overrideMethod (c$, "updateSequenceIdColours",
944 for (var sg, $sg = this.alignment.getGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {
945 if (sg.idColour != null) {
946 for (var s, $s = sg.getSequences (this.getHiddenRepSequences ()).iterator (); $s.hasNext () && ((s = $s.next ()) || true);) {
947 this.sequenceColours.put (s, sg.idColour);
951 Clazz.overrideMethod (c$, "clearSequenceColours",
953 this.sequenceColours.clear ();
955 Clazz.defineMethod (c$, "getCodingComplement",
957 return this.codingComplement;
959 Clazz.defineMethod (c$, "setCodingComplement",
962 System.err.println ("Ignoring recursive setCodingComplement request");
964 this.codingComplement = av;
965 if (av.getCodingComplement () !== this) {
966 av.setCodingComplement (this);
967 }}}, "jalview.api.AlignViewportI");
968 Clazz.overrideMethod (c$, "isNucleotide",
970 return this.getAlignment () == null ? false : this.getAlignment ().isNucleotide ();
972 Clazz.overrideMethod (c$, "getFeaturesDisplayed",
974 return this.featuresDisplayed;
976 Clazz.overrideMethod (c$, "setFeaturesDisplayed",
977 function (featuresDisplayedI) {
978 this.featuresDisplayed = featuresDisplayedI;
979 }, "jalview.api.FeaturesDisplayedI");
980 Clazz.overrideMethod (c$, "areFeaturesDisplayed",
982 return this.featuresDisplayed != null && this.featuresDisplayed.getRegisterdFeaturesCount () > 0;
984 Clazz.defineMethod (c$, "setShowSequenceFeatures",
986 this.viewStyle.setShowSequenceFeatures (b);
988 Clazz.defineMethod (c$, "isShowSequenceFeatures",
990 return this.viewStyle.isShowSequenceFeatures ();
992 Clazz.defineMethod (c$, "setShowSequenceFeaturesHeight",
993 function (selected) {
994 this.viewStyle.setShowSequenceFeaturesHeight (selected);
996 Clazz.defineMethod (c$, "isShowSequenceFeaturesHeight",
998 return this.viewStyle.isShowSequenceFeaturesHeight ();
1000 Clazz.defineMethod (c$, "setShowAnnotation",
1002 this.viewStyle.setShowAnnotation (b);
1004 Clazz.defineMethod (c$, "isShowAnnotation",
1006 return this.viewStyle.isShowAnnotation ();
1008 Clazz.defineMethod (c$, "isRightAlignIds",
1010 return this.viewStyle.isRightAlignIds ();
1012 Clazz.defineMethod (c$, "setRightAlignIds",
1013 function (rightAlignIds) {
1014 this.viewStyle.setRightAlignIds (rightAlignIds);
1016 Clazz.defineMethod (c$, "getConservationSelected",
1018 return this.viewStyle.getConservationSelected ();
1020 Clazz.defineMethod (c$, "setShowBoxes",
1022 this.viewStyle.setShowBoxes (state);
1024 Clazz.defineMethod (c$, "getTextColour",
1026 return this.viewStyle.getTextColour ();
1028 Clazz.defineMethod (c$, "getTextColour2",
1030 return this.viewStyle.getTextColour2 ();
1032 Clazz.defineMethod (c$, "getThresholdTextColour",
1034 return this.viewStyle.getThresholdTextColour ();
1036 Clazz.defineMethod (c$, "isConservationColourSelected",
1038 return this.viewStyle.isConservationColourSelected ();
1040 Clazz.defineMethod (c$, "isRenderGaps",
1042 return this.viewStyle.isRenderGaps ();
1044 Clazz.defineMethod (c$, "isShowColourText",
1046 return this.viewStyle.isShowColourText ();
1048 Clazz.defineMethod (c$, "setConservationColourSelected",
1049 function (conservationColourSelected) {
1050 this.viewStyle.setConservationColourSelected (conservationColourSelected);
1052 Clazz.defineMethod (c$, "setShowColourText",
1053 function (showColourText) {
1054 this.viewStyle.setShowColourText (showColourText);
1056 Clazz.defineMethod (c$, "setTextColour",
1057 function (textColour) {
1058 this.viewStyle.setTextColour (textColour);
1059 }, "java.awt.Color");
1060 Clazz.defineMethod (c$, "setThresholdTextColour",
1061 function (thresholdTextColour) {
1062 this.viewStyle.setThresholdTextColour (thresholdTextColour);
1064 Clazz.defineMethod (c$, "setTextColour2",
1065 function (textColour2) {
1066 this.viewStyle.setTextColour2 (textColour2);
1067 }, "java.awt.Color");
1068 Clazz.overrideMethod (c$, "getViewStyle",
1070 return new jalview.viewmodel.styles.ViewStyle (this.viewStyle);
1072 Clazz.overrideMethod (c$, "setViewStyle",
1073 function (settingsForView) {
1074 this.viewStyle = new jalview.viewmodel.styles.ViewStyle (settingsForView);
1075 }, "jalview.api.ViewStyleI");
1076 Clazz.defineMethod (c$, "sameStyle",
1078 return this.viewStyle.sameStyle (them);
1079 }, "jalview.api.ViewStyleI");
1080 Clazz.defineMethod (c$, "getIdWidth",
1082 return this.viewStyle.getIdWidth ();
1084 Clazz.defineMethod (c$, "setIdWidth",
1086 this.viewStyle.setIdWidth (i);
1088 Clazz.defineMethod (c$, "isCentreColumnLabels",
1090 return this.viewStyle.isCentreColumnLabels ();
1092 Clazz.defineMethod (c$, "setCentreColumnLabels",
1093 function (centreColumnLabels) {
1094 this.viewStyle.setCentreColumnLabels (centreColumnLabels);
1096 Clazz.defineMethod (c$, "setShowDBRefs",
1097 function (showdbrefs) {
1098 this.viewStyle.setShowDBRefs (showdbrefs);
1100 Clazz.defineMethod (c$, "isShowDBRefs",
1102 return this.viewStyle.isShowDBRefs ();
1104 Clazz.defineMethod (c$, "isShowNPFeats",
1106 return this.viewStyle.isShowNPFeats ();
1108 Clazz.defineMethod (c$, "setShowNPFeats",
1109 function (shownpfeats) {
1110 this.viewStyle.setShowNPFeats (shownpfeats);
1112 Clazz.defineMethod (c$, "addToHistoryList",
1113 function (command) {
1114 if (this.historyList != null) {
1115 this.historyList.push (command);
1116 this.broadcastCommand (command, false);
1117 }}, "jalview.commands.CommandI");
1118 Clazz.defineMethod (c$, "broadcastCommand",
1119 function (command, undo) {
1120 this.getStructureSelectionManager ().commandPerformed (command, undo, this.getVamsasSource ());
1121 }, "jalview.commands.CommandI,~B");
1122 Clazz.defineMethod (c$, "addToRedoList",
1123 function (command) {
1124 if (this.redoList != null) {
1125 this.redoList.push (command);
1126 }this.broadcastCommand (command, true);
1127 }, "jalview.commands.CommandI");
1128 Clazz.defineMethod (c$, "clearRedoList",
1130 if (this.redoList != null) {
1131 this.redoList.clear ();
1133 Clazz.defineMethod (c$, "setHistoryList",
1135 this.historyList = list;
1136 }, "java.util.Deque");
1137 Clazz.defineMethod (c$, "getHistoryList",
1139 return this.historyList;
1141 Clazz.defineMethod (c$, "setRedoList",
1143 this.redoList = list;
1144 }, "java.util.Deque");
1145 Clazz.defineMethod (c$, "getRedoList",
1147 return this.redoList;
1149 Clazz.overrideMethod (c$, "getVamsasSource",
1153 Clazz.defineMethod (c$, "getSortAnnotationsBy",
1155 return this.sortAnnotationsBy;
1157 Clazz.defineMethod (c$, "setSortAnnotationsBy",
1158 function (sortAnnotationsBy) {
1159 this.sortAnnotationsBy = sortAnnotationsBy;
1160 }, "jalview.analysis.AnnotationSorter.SequenceAnnotationOrder");
1161 Clazz.defineMethod (c$, "isShowAutocalculatedAbove",
1163 return this.showAutocalculatedAbove;
1165 Clazz.defineMethod (c$, "setShowAutocalculatedAbove",
1166 function (showAutocalculatedAbove) {
1167 this.showAutocalculatedAbove = showAutocalculatedAbove;
1169 Clazz.defineMethod (c$, "isScaleProteinAsCdna",
1171 return this.viewStyle.isScaleProteinAsCdna ();
1173 Clazz.defineMethod (c$, "setScaleProteinAsCdna",
1175 this.viewStyle.setScaleProteinAsCdna (b);
1177 Clazz.defineMethod (c$, "isFollowHighlight",
1179 return this.followHighlight;
1181 Clazz.overrideMethod (c$, "setFollowHighlight",
1183 this.followHighlight = b;
1185 Clazz.defineMethod (c$, "getStartRes",
1187 return this.startRes;
1189 Clazz.overrideMethod (c$, "getEndRes",
1193 Clazz.defineMethod (c$, "getStartSeq",
1195 return this.startSeq;
1197 Clazz.defineMethod (c$, "setStartRes",
1199 this.startRes = res;
1201 Clazz.defineMethod (c$, "setStartSeq",
1203 this.startSeq = seq;
1205 Clazz.defineMethod (c$, "setEndRes",
1207 if (res > this.alignment.getWidth () - 1) {
1208 res = this.alignment.getWidth () - 1;
1213 Clazz.defineMethod (c$, "setEndSeq",
1215 if (seq > this.alignment.getHeight ()) {
1216 seq = this.alignment.getHeight ();
1221 Clazz.defineMethod (c$, "getEndSeq",
1225 Clazz.defineMethod (c$, "findComplementScrollTarget",
1227 var complement = this.getCodingComplement ();
1228 if (complement == null || !complement.isFollowHighlight ()) {
1230 }var iAmProtein = !this.getAlignment ().isNucleotide ();
1231 var proteinAlignment = iAmProtein ? this.getAlignment () : complement.getAlignment ();
1232 if (proteinAlignment == null) {
1234 }var mappings = proteinAlignment.getCodonFrames ();
1236 var sequence = null;
1237 var middleColumn = this.getStartRes () + Clazz.doubleToInt ((this.getEndRes () - this.getStartRes ()) / 2);
1238 var hiddenSequences = this.getAlignment ().getHiddenSequences ();
1239 for (var seqNo = this.getStartSeq (); seqNo < this.getEndSeq (); seqNo++, seqOffset++) {
1240 sequence = this.getAlignment ().getSequenceAt (seqNo);
1241 if (hiddenSequences != null && hiddenSequences.isHidden (sequence)) {
1243 }if (jalview.util.Comparison.isGap (sequence.getCharAt (middleColumn))) {
1245 }var seqMappings = jalview.util.MappingUtils.findMappingsForSequence (sequence, mappings);
1246 if (!seqMappings.isEmpty ()) {
1249 if (sequence == null) {
1251 }jalview.util.MappingUtils.addSearchResults (sr, sequence, sequence.findPosition (middleColumn), mappings);
1253 }, "jalview.datamodel.SearchResults");