1 Clazz.declarePackage ("jalview.datamodel");
2 Clazz.load (null, "jalview.datamodel.HiddenSequences", ["jalview.datamodel.Alignment", "java.util.ArrayList"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.hiddenSequences = null;
6 Clazz.instantialize (this, arguments);
7 }, jalview.datamodel, "HiddenSequences");
8 Clazz.makeConstructor (c$,
11 }, "jalview.datamodel.AlignmentI");
12 Clazz.defineMethod (c$, "getSize",
14 if (this.hiddenSequences == null) {
17 for (var i = 0; i < this.hiddenSequences.length; i++) {
18 if (this.hiddenSequences[i] != null) {
23 Clazz.defineMethod (c$, "getWidth",
26 for (var i = 0; i < this.hiddenSequences.length; i++) {
27 if (this.hiddenSequences[i] != null && this.hiddenSequences[i].getLength () > width) {
28 width = this.hiddenSequences[i].getLength ();
32 Clazz.defineMethod (c$, "adjustHeightSequenceDeleted",
34 if (this.hiddenSequences == null) {
36 }var alHeight = this.alignment.getHeight ();
37 var tmp = new Array (alHeight + this.getSize ());
38 var deletionIndex = this.adjustForHiddenSeqs (seqIndex);
39 for (var i = 0; i < this.hiddenSequences.length; i++) {
40 if (this.hiddenSequences[i] == null) {
42 }if (i > deletionIndex) {
43 tmp[i - 1] = this.hiddenSequences[i];
45 tmp[i] = this.hiddenSequences[i];
47 this.hiddenSequences = tmp;
49 Clazz.defineMethod (c$, "adjustHeightSequenceAdded",
51 if (this.hiddenSequences == null) {
53 }var alHeight = this.alignment.getHeight ();
54 var tmp = new Array (alHeight + this.getSize ());
55 System.arraycopy (this.hiddenSequences, 0, tmp, 0, this.hiddenSequences.length);
56 this.hiddenSequences = tmp;
58 Clazz.defineMethod (c$, "hideSequence",
60 if (this.hiddenSequences == null) {
61 this.hiddenSequences = new Array (this.alignment.getHeight ());
62 }var alignmentIndex = this.alignment.findIndex (sequence);
63 alignmentIndex = this.adjustForHiddenSeqs (alignmentIndex);
64 if (this.hiddenSequences[alignmentIndex] != null) {
65 System.out.println ("ERROR!!!!!!!!!!!");
66 }this.hiddenSequences[alignmentIndex] = sequence;
67 this.alignment.deleteSequence (sequence);
68 }, "jalview.datamodel.SequenceI");
69 Clazz.defineMethod (c$, "showAll",
70 function (hiddenRepSequences) {
71 var revealedSeqs = new java.util.ArrayList ();
72 for (var i = 0; i < this.hiddenSequences.length; i++) {
73 if (this.hiddenSequences[i] != null) {
74 var tmp = this.showSequence (i, hiddenRepSequences);
75 for (var seq, $seq = tmp.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) {
76 revealedSeqs.add (seq);
81 Clazz.defineMethod (c$, "showSequence",
82 function (alignmentIndex, hiddenRepSequences) {
83 var revealedSeqs = new java.util.ArrayList ();
84 var repSequence = this.alignment.getSequenceAt (alignmentIndex);
85 if (repSequence != null && hiddenRepSequences != null && hiddenRepSequences.containsKey (repSequence)) {
86 hiddenRepSequences.remove (repSequence);
87 revealedSeqs.add (repSequence);
88 }var start = this.adjustForHiddenSeqs (alignmentIndex - 1);
89 var end = this.adjustForHiddenSeqs (alignmentIndex);
90 if (end >= this.hiddenSequences.length) {
91 end = this.hiddenSequences.length - 1;
94 for (var index = end; index > start; index--) {
95 var seq = this.hiddenSequences[index];
96 this.hiddenSequences[index] = null;
98 if (seq.getLength () > 0) {
99 revealedSeqs.add (seq);
100 asequences.add (alignmentIndex, seq);
102 System.out.println (seq.getName () + " has been deleted whilst hidden");
104 }return revealedSeqs;
105 }, "~N,java.util.Map");
106 Clazz.defineMethod (c$, "getHiddenSequence",
107 function (alignmentIndex) {
108 return this.hiddenSequences[alignmentIndex];
110 Clazz.defineMethod (c$, "findIndexWithoutHiddenSeqs",
111 function (alignmentIndex) {
114 if (this.hiddenSequences.length <= alignmentIndex) {
115 alignmentIndex = this.hiddenSequences.length - 1;
116 }while (index <= alignmentIndex) {
117 if (this.hiddenSequences[index] != null) {
121 ;return (alignmentIndex - hiddenSeqs);
123 Clazz.defineMethod (c$, "adjustForHiddenSeqs",
124 function (alignmentIndex) {
126 var hSize = this.hiddenSequences.length;
127 while (index <= alignmentIndex && index < hSize) {
128 if (this.hiddenSequences[index] != null) {
132 ;return alignmentIndex;
134 Clazz.defineMethod (c$, "getFullAlignment",
136 var isize = this.hiddenSequences.length;
137 var seq = new Array (isize);
139 for (var i = 0; i < this.hiddenSequences.length; i++) {
140 if (this.hiddenSequences[i] != null) {
141 seq[i] = this.hiddenSequences[i];
143 seq[i] = this.alignment.getSequenceAt (index);
146 var fAlignmt = new jalview.datamodel.Alignment (seq);
147 fAlignmt.annotations = this.alignment.getAlignmentAnnotation ();
148 fAlignmt.alignmentProperties = this.alignment.getProperties ();
149 fAlignmt.groups = this.alignment.getGroups ();
150 fAlignmt.$hasRNAStructure = this.alignment.hasRNAStructure ();
153 Clazz.defineMethod (c$, "isHidden",
155 if (this.hiddenSequences != null) {
156 for (var i = 0; i < this.hiddenSequences.length; i++) {
157 if (this.hiddenSequences[i] != null && this.hiddenSequences[i] === seq) {
161 }, "jalview.datamodel.SequenceI");