Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / jalview / datamodel / AlignmentView.js
1 Clazz.declarePackage ("jalview.datamodel");
2 Clazz.load (null, "jalview.datamodel.AlignmentView", ["jalview.datamodel.Alignment", "$.CigarArray", "$.ColumnSelection", "$.SeqCigar", "$.SequenceGroup", "jalview.util.MessageManager", "$.ShiftList", "java.lang.Error", "java.util.ArrayList", "$.Vector"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 this.sequences = null;
5 this.contigs = null;
6 this.width = 0;
7 this.firstCol = 0;
8 this.scGroups = null;
9 this.$isNa = false;
10 if (!Clazz.isClassDefined ("jalview.datamodel.AlignmentView.ScGroup")) {
11 jalview.datamodel.AlignmentView.$AlignmentView$ScGroup$ ();
12 }
13 this.selected = null;
14 Clazz.instantialize (this, arguments);
15 }, jalview.datamodel, "AlignmentView");
16 Clazz.defineMethod (c$, "isNa", 
17 function () {
18 return this.$isNa;
19 });
20 Clazz.makeConstructor (c$, 
21 function (alignment, columnSelection, selection, hasHiddenColumns, selectedRegionOnly, recordGroups) {
22 this.construct ( new jalview.datamodel.CigarArray (alignment, (hasHiddenColumns ? columnSelection : null), (selectedRegionOnly ? selection : null)), (selectedRegionOnly && selection != null) ? selection.getStartRes () : 0);
23 this.$isNa = alignment.isNucleotide ();
24 var selseqs;
25 if (selection != null && selection.getSize () > 0) {
26 var sel = selection.getSequences (null);
27 this.selected =  new java.util.Vector ();
28 selseqs = selection.getSequencesInOrder (alignment, selectedRegionOnly);
29 } else {
30 selseqs = alignment.getSequencesArray ();
31 }var seqsets =  new java.util.ArrayList ();
32 var grps =  new java.util.ArrayList ();
33 var gg = alignment.getGroups ();
34 grps.addAll (gg);
35 var sgrps = null;
36 var addedgps = null;
37 if (grps != null) {
38 if (selection != null && selectedRegionOnly) {
39 var ssel = selection.getStartRes ();
40 var esel = selection.getEndRes ();
41 var isg =  new java.util.ArrayList ();
42 for (var sg, $sg = grps.iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {
43 if (!(sg.getStartRes () > esel || sg.getEndRes () < ssel)) {
44 if (sg.getStartRes () < ssel) {
45 sg.setStartRes (ssel);
46 }if (sg.getEndRes () > esel) {
47 sg.setEndRes (esel);
48 }sg.setStartRes (sg.getStartRes () - ssel + 1);
49 sg.setEndRes (sg.getEndRes () - ssel + 1);
50 isg.add (sg);
51 }}
52 grps = isg;
53 }sgrps =  new Array (grps.size ());
54 addedgps =  Clazz.newBooleanArray (grps.size (), false);
55 for (var g = 0; g < sgrps.length; g++) {
56 var sg = grps.get (g);
57 sgrps[g] = Clazz.innerTypeInstance (jalview.datamodel.AlignmentView.ScGroup, this, null);
58 sgrps[g].sg =  new jalview.datamodel.SequenceGroup (sg);
59 addedgps[g] = false;
60 seqsets.add (sg.getSequences ());
61 }
62 }var csi = 0;
63 for (var i = 0; i < selseqs.length; i++) {
64 if (selseqs[i] != null) {
65 if (selection != null && selection.getSize () > 0 && !selectedRegionOnly) {
66 this.sequences[csi].setGroupMembership (this.selected);
67 this.selected.addElement (this.sequences[csi]);
68 }if (seqsets != null) {
69 for (var sg = 0; sg < sgrps.length; sg++) {
70 if ((seqsets.get (sg)).contains (selseqs[i])) {
71 this.sequences[csi].setGroupMembership (sgrps[sg]);
72 sgrps[sg].sg.deleteSequence (selseqs[i], false);
73 sgrps[sg].seqs.addElement (this.sequences[csi]);
74 if (!addedgps[sg]) {
75 if (this.scGroups == null) {
76 this.scGroups =  new java.util.ArrayList ();
77 }addedgps[sg] = true;
78 this.scGroups.add (sgrps[sg]);
79 }}}
80 }csi++;
81 }}
82 for (var sg = 0; sg < sgrps.length; sg++) {
83 var sqs = sgrps[sg].sg.getSequencesAsArray (null);
84 for (var si = 0; si < sqs.length; si++) {
85 sgrps[sg].sg.deleteSequence (sqs[si], false);
86 }
87 sgrps[sg] = null;
88 }
89 }, "jalview.datamodel.AlignmentI,jalview.datamodel.ColumnSelection,jalview.datamodel.SequenceGroup,~B,~B,~B");
90 Clazz.makeConstructor (c$, 
91 function (seqcigararray) {
92 if (!seqcigararray.isSeqCigarArray ()) {
93 throw  new Error (jalview.util.MessageManager.getString ("error.implementation_error_can_only_make_alignmnet_from_cigararray"));
94 }this.contigs = seqcigararray.getDeletedRegions ();
95 this.sequences = seqcigararray.getSeqCigarArray ();
96 this.width = seqcigararray.getWidth ();
97 }, "jalview.datamodel.CigarArray");
98 Clazz.makeConstructor (c$, 
99 function (sdata, firstcol) {
100 this.construct (sdata);
101 this.firstCol = firstcol;
102 }, "jalview.datamodel.CigarArray,~N");
103 Clazz.defineMethod (c$, "setSequences", 
104 function (sequences) {
105 this.sequences = sequences;
106 }, "~A");
107 Clazz.defineMethod (c$, "setContigs", 
108 function (contigs) {
109 this.contigs = contigs;
110 }, "~A");
111 Clazz.defineMethod (c$, "getSequences", 
112 function () {
113 return this.sequences;
114 });
115 Clazz.defineMethod (c$, "getContigs", 
116 function () {
117 return this.contigs;
118 });
119 Clazz.defineMethod (c$, "getAlignmentAndColumnSelection", 
120 function (gapCharacter) {
121 var colsel =  new jalview.datamodel.ColumnSelection ();
122 return  Clazz.newArray (-1, [jalview.datamodel.SeqCigar.createAlignmentSequences (this.sequences, gapCharacter, colsel, this.contigs), colsel]);
123 }, "~S");
124 Clazz.defineMethod (c$, "getVisibleAlignment", 
125 function (c) {
126 var aln = this.getVisibleSeqs (c);
127 var vcal =  new jalview.datamodel.Alignment (aln);
128 this.addPrunedGroupsInOrder (vcal, -1, -1, true);
129 return vcal;
130 }, "~S");
131 Clazz.defineMethod (c$, "addPrunedGroupsInOrder", 
132  function (vcal, gstart, gend, viscontigs) {
133 var r = false;
134 if (gstart > -1 && gstart <= gend) {
135 r = true;
136 }var aln = vcal.getSequencesArray ();
137 {
138 {
139 var nvg = (this.scGroups != null) ? this.scGroups.size () : 0;
140 if (nvg > 0) {
141 var nsg =  new Array (nvg);
142 for (var g = 0; g < nvg; g++) {
143 var sg = this.scGroups.get (g).sg;
144 if (r) {
145 if (sg.getStartRes () > gend || sg.getEndRes () < gstart) {
146 nsg[g] = null;
147 continue;
148 }}nsg[g] =  new jalview.datamodel.SequenceGroup (sg);
149 if (r && !viscontigs) {
150 if (nsg[g].getStartRes () < gstart) {
151 nsg[g].setStartRes (0);
152 } else {
153 nsg[g].setStartRes (nsg[g].getStartRes () - gstart);
154 nsg[g].setEndRes (nsg[g].getEndRes () - gstart);
155 }if (nsg[g].getEndRes () > (gend - gstart)) {
156 nsg[g].setEndRes (gend - gstart);
157 }}}
158 if (viscontigs) {
159 if (this.contigs != null) {
160 var p = 0;
161 var prune =  new jalview.util.ShiftList ();
162 if (r) {
163 prune.addShift (gstart, -gstart);
164 }for (var h = 0; h < this.contigs.length; h += 3) {
165 {
166 prune.addShift (p + this.contigs[h + 1], this.contigs[h + 2] - this.contigs[h + 1]);
167 }p = this.contigs[h + 1] + this.contigs[h + 2];
168 }
169 for (var g = 0; g < nsg.length; g++) {
170 if (nsg[g] != null) {
171 var s = nsg[g].getStartRes ();
172 var t = nsg[g].getEndRes ();
173 var w = 1 + t - s;
174 if (r) {
175 if (s < gstart) {
176 s = gstart;
177 }if (t > gend) {
178 t = gend;
179 }}s = prune.shift (s);
180 t = prune.shift (t);
181 nsg[g].setStartRes (s);
182 nsg[g].setEndRes (t);
183 }}
184 }}for (var nsq = 0; nsq < aln.length; nsq++) {
185 for (var g = 0; g < nvg; g++) {
186 if (nsg[g] != null && this.sequences[nsq].isMemberOf (this.scGroups.get (g))) {
187 nsg[g].addSequence (aln[nsq], false);
188 }}
189 }
190 for (var g = 0; g < nvg; g++) {
191 if (nsg[g] != null && nsg[g].getSize () > 0) {
192 vcal.addGroup (nsg[g]);
193 }nsg[g] = null;
194 }
195 }}}}, "jalview.datamodel.AlignmentI,~N,~N,~B");
196 Clazz.defineMethod (c$, "getVisibleSeqs", 
197  function (c) {
198 var aln =  new Array (this.sequences.length);
199 for (var i = 0, j = this.sequences.length; i < j; i++) {
200 aln[i] = this.sequences[i].getSeq ('-');
201 }
202 var seqs = this.getSequenceStrings ('-');
203 for (var i = 0, j = aln.length; i < j; i++) {
204 aln[i].setSequence (seqs[i]);
205 }
206 return aln;
207 }, "~S");
208 Clazz.defineMethod (c$, "getVisibleContigAlignments", 
209 function (c) {
210 var nvc = 0;
211 var vcontigs = this.getVisibleContigs ();
212 var contigviews = this.getVisibleContigs (c);
213 var vcals =  new Array (contigviews.length);
214 for (nvc = 0; nvc < contigviews.length; nvc++) {
215 vcals[nvc] =  new jalview.datamodel.Alignment (contigviews[nvc]);
216 if (this.scGroups != null && this.scGroups.size () > 0) {
217 this.addPrunedGroupsInOrder (vcals[nvc], vcontigs[nvc * 2], vcontigs[nvc * 2 + 1], true);
218 }}
219 return vcals;
220 }, "~S");
221 Clazz.defineMethod (c$, "getSequenceStrings", 
222 function (c) {
223 var seqs =  new Array (this.sequences.length);
224 for (var n = 0; n < this.sequences.length; n++) {
225 var fullseq = this.sequences[n].getSequenceString (c);
226 if (this.contigs != null) {
227 seqs[n] = "";
228 var p = 0;
229 for (var h = 0; h < this.contigs.length; h += 3) {
230 seqs[n] += fullseq.substring (p, this.contigs[h + 1]);
231 p = this.contigs[h + 1] + this.contigs[h + 2];
232 }
233 seqs[n] += fullseq.substring (p);
234 } else {
235 seqs[n] = fullseq;
236 }}
237 return seqs;
238 }, "~S");
239 Clazz.defineMethod (c$, "getWidth", 
240 function () {
241 return this.width;
242 });
243 Clazz.defineMethod (c$, "setWidth", 
244 function (width) {
245 this.width = width;
246 }, "~N");
247 Clazz.defineMethod (c$, "getVisibleContigs", 
248 function (gapCharacter) {
249 var smsa;
250 var njobs = 1;
251 if (this.sequences == null || this.width <= 0) {
252 return null;
253 }if (this.contigs != null && this.contigs.length > 0) {
254 var start = 0;
255 njobs = 0;
256 var fwidth = this.width;
257 for (var contig = 0; contig < this.contigs.length; contig += 3) {
258 if ((this.contigs[contig + 1] - start) > 0) {
259 njobs++;
260 }fwidth += this.contigs[contig + 2];
261 start = this.contigs[contig + 1] + this.contigs[contig + 2];
262 }
263 if (start < fwidth) {
264 njobs++;
265 }smsa =  new Array (njobs);
266 start = 0;
267 var j = 0;
268 for (var contig = 0; contig < this.contigs.length; contig += 3) {
269 if (this.contigs[contig + 1] - start > 0) {
270 var mseq =  new Array (this.sequences.length);
271 for (var s = 0; s < mseq.length; s++) {
272 mseq[s] = this.sequences[s].getSeq (gapCharacter).getSubSequence (start, this.contigs[contig + 1]);
273 }
274 smsa[j] = mseq;
275 j++;
276 }start = this.contigs[contig + 1] + this.contigs[contig + 2];
277 }
278 if (start < fwidth) {
279 var mseq =  new Array (this.sequences.length);
280 for (var s = 0; s < mseq.length; s++) {
281 mseq[s] = this.sequences[s].getSeq (gapCharacter).getSubSequence (start, fwidth + 1);
282 }
283 smsa[j] = mseq;
284 j++;
285 }} else {
286 smsa =  new Array (1);
287 smsa[0] =  new Array (this.sequences.length);
288 for (var s = 0; s < this.sequences.length; s++) {
289 smsa[0][s] = this.sequences[s].getSeq (gapCharacter);
290 }
291 }return smsa;
292 }, "~S");
293 Clazz.defineMethod (c$, "getUpdatedView", 
294 function (nvismsa, orders, gapCharacter) {
295 if (this.sequences == null || this.width <= 0) {
296 throw  new Error (jalview.util.MessageManager.getString ("error.empty_view_cannot_be_updated"));
297 }if (nvismsa == null) {
298 throw  new Error ("nvismsa==null. use getAlignmentAndColumnSelection() instead.");
299 }if (this.contigs != null && this.contigs.length > 0) {
300 var alignment =  new Array (this.sequences.length);
301 var columnselection =  new jalview.datamodel.ColumnSelection ();
302 if (this.contigs != null && this.contigs.length > 0) {
303 var start = 0;
304 var nwidth = 0;
305 var owidth = this.width;
306 var j = 0;
307 for (var contig = 0; contig < this.contigs.length; contig += 3) {
308 owidth += this.contigs[contig + 2];
309 if (this.contigs[contig + 1] - start > 0) {
310 var swidth = 0;
311 if (nvismsa[j] != null) {
312 var mseq = nvismsa[j];
313 var order = (orders == null) ? null : orders[j];
314 j++;
315 if (mseq.length != this.sequences.length) {
316 throw  new Error (jalview.util.MessageManager.formatMessage ("error.mismatch_between_number_of_sequences_in_block",  Clazz.newArray (-1, [Integer.$valueOf (j).toString (), Integer.$valueOf (mseq.length).toString (), Integer.$valueOf (this.sequences.length).toString ()])));
317 }swidth = mseq[0].getLength ();
318 for (var s = 0; s < mseq.length; s++) {
319 if (alignment[s] == null) {
320 alignment[s] = mseq[s];
321 } else {
322 alignment[s].setSequence (alignment[s].getSequenceAsString () + mseq[s].getSequenceAsString ());
323 if (mseq[s].getStart () <= mseq[s].getEnd ()) {
324 alignment[s].setEnd (mseq[s].getEnd ());
325 }if (order != null) {
326 order.updateSequence (mseq[s], alignment[s]);
327 }}}
328 } else {
329 if (true) {
330 for (var s = 0; s < this.sequences.length; s++) {
331 var oseq = this.sequences[s].getSeq (gapCharacter).getSubSequence (start, this.contigs[contig + 1]);
332 if (swidth < oseq.getLength ()) {
333 swidth = oseq.getLength ();
334 }if (alignment[s] == null) {
335 alignment[s] = oseq;
336 } else {
337 alignment[s].setSequence (alignment[s].getSequenceAsString () + oseq.getSequenceAsString ());
338 if (oseq.getEnd () >= oseq.getStart ()) {
339 alignment[s].setEnd (oseq.getEnd ());
340 }}}
341 }j++;
342 }nwidth += swidth;
343 }start = this.contigs[contig + 1] + this.contigs[contig + 2];
344 for (var s = 0; s < this.sequences.length; s++) {
345 var hseq = this.sequences[s].getSeq (gapCharacter).getSubSequence (this.contigs[contig + 1], start);
346 if (alignment[s] == null) {
347 alignment[s] = hseq;
348 } else {
349 alignment[s].setSequence (alignment[s].getSequenceAsString () + hseq.getSequenceAsString ());
350 if (hseq.getEnd () >= hseq.getStart ()) {
351 alignment[s].setEnd (hseq.getEnd ());
352 }}}
353 columnselection.hideColumns (nwidth, nwidth + this.contigs[contig + 2] - 1);
354 nwidth += this.contigs[contig + 2];
355 }
356 if (j < nvismsa.length) {
357 var swidth = 0;
358 if (nvismsa[j] != null) {
359 var mseq = nvismsa[j];
360 var order = (orders != null) ? orders[j] : null;
361 swidth = mseq[0].getLength ();
362 for (var s = 0; s < mseq.length; s++) {
363 if (alignment[s] == null) {
364 alignment[s] = mseq[s];
365 } else {
366 alignment[s].setSequence (alignment[s].getSequenceAsString () + mseq[s].getSequenceAsString ());
367 if (mseq[s].getEnd () >= mseq[s].getStart ()) {
368 alignment[s].setEnd (mseq[s].getEnd ());
369 }if (order != null) {
370 order.updateSequence (mseq[s], alignment[s]);
371 }}}
372 } else {
373 if (start < owidth) {
374 if (true) {
375 for (var s = 0; s < this.sequences.length; s++) {
376 var oseq = this.sequences[s].getSeq (gapCharacter).getSubSequence (start, owidth + 1);
377 if (swidth < oseq.getLength ()) {
378 swidth = oseq.getLength ();
379 }if (alignment[s] == null) {
380 alignment[s] = oseq;
381 } else {
382 alignment[s].setSequence (alignment[s].getSequenceAsString () + oseq.getSequenceAsString ());
383 if (oseq.getEnd () >= oseq.getStart ()) {
384 alignment[s].setEnd (oseq.getEnd ());
385 }}}
386 nwidth += swidth;
387 } else {
388 throw  new Error (jalview.util.MessageManager.getString ("error.padding_not_yet_implemented"));
389 }}}}}return  Clazz.newArray (-1, [alignment, columnselection]);
390 } else {
391 if (nvismsa.length != 1) {
392 throw  new Error (jalview.util.MessageManager.formatMessage ("error.mismatch_between_visible_blocks_to_update_and_number_of_contigs_in_view",  Clazz.newArray (-1, [Integer.$valueOf (nvismsa.length).toString ()])));
393 }if (nvismsa[0] != null) {
394 return  Clazz.newArray (-1, [nvismsa[0],  new jalview.datamodel.ColumnSelection ()]);
395 } else {
396 return this.getAlignmentAndColumnSelection (gapCharacter);
397 }}}, "~A,~A,~S");
398 Clazz.defineMethod (c$, "getVisibleContigs", 
399 function () {
400 if (this.contigs != null && this.contigs.length > 0) {
401 var start = 0;
402 var nvis = 0;
403 var fwidth = this.width;
404 for (var contig = 0; contig < this.contigs.length; contig += 3) {
405 if ((this.contigs[contig + 1] - start) > 0) {
406 nvis++;
407 }fwidth += this.contigs[contig + 2];
408 start = this.contigs[contig + 1] + this.contigs[contig + 2];
409 }
410 if (start < fwidth) {
411 nvis++;
412 }var viscontigs =  Clazz.newIntArray (nvis * 2, 0);
413 nvis = 0;
414 start = 0;
415 for (var contig = 0; contig < this.contigs.length; contig += 3) {
416 if ((this.contigs[contig + 1] - start) > 0) {
417 viscontigs[nvis] = start;
418 viscontigs[nvis + 1] = this.contigs[contig + 1] - 1;
419 nvis += 2;
420 }start = this.contigs[contig + 1] + this.contigs[contig + 2];
421 }
422 if (start < fwidth) {
423 viscontigs[nvis] = start;
424 viscontigs[nvis + 1] = fwidth;
425 nvis += 2;
426 }return viscontigs;
427 } else {
428 return  Clazz.newIntArray (-1, [0, this.width]);
429 }});
430 Clazz.defineMethod (c$, "getAlignmentOrigin", 
431 function () {
432 return this.firstCol;
433 });
434 Clazz.defineMethod (c$, "getVisibleContigMapFor", 
435 function (gapMap) {
436 var delMap = null;
437 var viscontigs = this.getVisibleContigs ();
438 var spos = 0;
439 var i = 0;
440 if (viscontigs != null) {
441 delMap =  Clazz.newIntArray (gapMap.length, 0);
442 for (var contig = 0; contig < viscontigs.length; contig += 2) {
443 while (spos < gapMap.length && gapMap[spos] < viscontigs[contig]) {
444 spos++;
445 }
446 while (spos < gapMap.length && gapMap[spos] <= viscontigs[contig + 1]) {
447 delMap[i++] = spos++;
448 }
449 }
450 var tmap =  Clazz.newIntArray (i, 0);
451 System.arraycopy (delMap, 0, tmap, 0, i);
452 delMap = tmap;
453 }return delMap;
454 }, "~A");
455 Clazz.defineMethod (c$, "getEditedSequences", 
456 function (gc, $delete) {
457 var msf = this.getSequences ();
458 var aln =  new Array (msf.length);
459 for (var i = 0, j = msf.length; i < j; i++) {
460 aln[i] = msf[i].getSeq (gc);
461 }
462 if ($delete) {
463 var sqs = this.getSequenceStrings (gc);
464 for (var i = 0; i < sqs.length; i++) {
465 aln[i].setSequence (sqs[i]);
466 sqs[i] = null;
467 }
468 }return aln;
469 }, "~S,~B");
470 c$.summariseAlignmentView = Clazz.defineMethod (c$, "summariseAlignmentView", 
471 function (view, os) {
472 os.print ("View has " + view.sequences.length + " of which ");
473 if (view.selected == null) {
474 os.print ("None");
475 } else {
476 os.print (" " + view.selected.size ());
477 }os.println (" are selected.");
478 os.print ("View is " + view.getWidth () + " columns wide");
479 var viswid = 0;
480 var contigs = view.getContigs ();
481 if (contigs != null) {
482 viswid = view.width;
483 for (var i = 0; i < contigs.length; i += 3) {
484 viswid += contigs[i + 2];
485 }
486 os.println ("with " + viswid + " visible columns spread over " + Clazz.doubleToInt (contigs.length / 3) + " regions.");
487 } else {
488 viswid = view.width;
489 os.println (".");
490 }if (view.scGroups != null) {
491 os.println ("There are " + view.scGroups.size () + " groups defined on the view.");
492 for (var g = 0; g < view.scGroups.size (); g++) {
493 var sgr = view.scGroups.get (g);
494 os.println ("Group " + g + ": Name = " + sgr.sg.getName () + " Contains " + sgr.seqs.size () + " Seqs.");
495 os.println ("This group runs from " + sgr.sg.getStartRes () + " to " + sgr.sg.getEndRes ());
496 for (var s = 0; s < sgr.seqs.size (); s++) {
497 if (!(sgr.seqs.elementAt (s)).isMemberOf (sgr)) {
498 os.println ("** WARNING: sequence " + (sgr.seqs.elementAt (s)).toString () + " is not marked as member of group.");
499 }}
500 }
501 var visal = view.getVisibleAlignment ('-');
502 if (visal != null) {
503 os.println ("Vis. alignment is " + visal.getWidth () + " wide and has " + visal.getHeight () + " seqs.");
504 if (visal.getGroups () != null && visal.getGroups ().size () > 0) {
505 var i = 1;
506 for (var sg, $sg = visal.getGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) {
507 os.println ("Group " + (i++) + " begins at column " + sg.getStartRes () + " and ends at " + sg.getEndRes ());
508 }
509 }}}}, "jalview.datamodel.AlignmentView,java.io.PrintStream");
510 c$.testSelectionViews = Clazz.defineMethod (c$, "testSelectionViews", 
511 function (alignment, csel, selection) {
512 System.out.println ("Testing standard view creation:\n");
513 var view = null;
514 try {
515 System.out.println ("View with no hidden columns, no limit to selection, no groups to be collected:");
516 view =  new jalview.datamodel.AlignmentView (alignment, csel, selection, false, false, false);
517 jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out);
518 } catch (e) {
519 if (Clazz.exceptionOf (e, Exception)) {
520 e.printStackTrace ();
521 System.err.println ("Failed to generate alignment with selection but no groups marked.");
522 } else {
523 throw e;
524 }
525 }
526 try {
527 System.out.println ("View with no hidden columns, no limit to selection, and all groups to be collected:");
528 view =  new jalview.datamodel.AlignmentView (alignment, csel, selection, false, false, true);
529 jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out);
530 } catch (e) {
531 if (Clazz.exceptionOf (e, Exception)) {
532 e.printStackTrace ();
533 System.err.println ("Failed to generate alignment with selection marked but no groups marked.");
534 } else {
535 throw e;
536 }
537 }
538 try {
539 System.out.println ("View with no hidden columns, limited to selection and no groups to be collected:");
540 view =  new jalview.datamodel.AlignmentView (alignment, csel, selection, false, true, false);
541 jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out);
542 } catch (e) {
543 if (Clazz.exceptionOf (e, Exception)) {
544 e.printStackTrace ();
545 System.err.println ("Failed to generate alignment with selection restricted but no groups marked.");
546 } else {
547 throw e;
548 }
549 }
550 try {
551 System.out.println ("View with no hidden columns, limited to selection, and all groups to be collected:");
552 view =  new jalview.datamodel.AlignmentView (alignment, csel, selection, false, true, true);
553 jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out);
554 } catch (e) {
555 if (Clazz.exceptionOf (e, Exception)) {
556 e.printStackTrace ();
557 System.err.println ("Failed to generate alignment with selection restricted and groups marked.");
558 } else {
559 throw e;
560 }
561 }
562 try {
563 System.out.println ("View *with* hidden columns, no limit to selection, no groups to be collected:");
564 view =  new jalview.datamodel.AlignmentView (alignment, csel, selection, true, false, false);
565 jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out);
566 } catch (e) {
567 if (Clazz.exceptionOf (e, Exception)) {
568 e.printStackTrace ();
569 System.err.println ("Failed to generate alignment with selection but no groups marked.");
570 } else {
571 throw e;
572 }
573 }
574 try {
575 System.out.println ("View *with* hidden columns, no limit to selection, and all groups to be collected:");
576 view =  new jalview.datamodel.AlignmentView (alignment, csel, selection, true, false, true);
577 jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out);
578 } catch (e) {
579 if (Clazz.exceptionOf (e, Exception)) {
580 e.printStackTrace ();
581 System.err.println ("Failed to generate alignment with selection marked but no groups marked.");
582 } else {
583 throw e;
584 }
585 }
586 try {
587 System.out.println ("View *with* hidden columns, limited to selection and no groups to be collected:");
588 view =  new jalview.datamodel.AlignmentView (alignment, csel, selection, true, true, false);
589 jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out);
590 } catch (e) {
591 if (Clazz.exceptionOf (e, Exception)) {
592 e.printStackTrace ();
593 System.err.println ("Failed to generate alignment with selection restricted but no groups marked.");
594 } else {
595 throw e;
596 }
597 }
598 try {
599 System.out.println ("View *with* hidden columns, limited to selection, and all groups to be collected:");
600 view =  new jalview.datamodel.AlignmentView (alignment, csel, selection, true, true, true);
601 jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out);
602 } catch (e) {
603 if (Clazz.exceptionOf (e, Exception)) {
604 e.printStackTrace ();
605 System.err.println ("Failed to generate alignment with selection restricted and groups marked.");
606 } else {
607 throw e;
608 }
609 }
610 }, "jalview.datamodel.AlignmentI,jalview.datamodel.ColumnSelection,jalview.datamodel.SequenceGroup");
611 c$.$AlignmentView$ScGroup$ = function () {
612 Clazz.pu$h(self.c$);
613 c$ = Clazz.decorateAsClass (function () {
614 Clazz.prepareCallback (this, arguments);
615 this.seqs = null;
616 this.sg = null;
617 Clazz.instantialize (this, arguments);
618 }, jalview.datamodel.AlignmentView, "ScGroup");
619 Clazz.makeConstructor (c$, 
620 function () {
621 this.seqs =  new java.util.Vector ();
622 });
623 c$ = Clazz.p0p ();
624 };
625 });