X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fjalview%2Fdatamodel%2FAlignmentView.js;h=8ba9db2b20f5ee8c09e4b8f7ffe6d6df1de3ae8f;hp=69038d428bd395bf74795219cc508d6c377df5a5;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=8ffd05b3abe52c0b6b79b011c0966361f82d5fe6 diff --git a/site/j2s/jalview/datamodel/AlignmentView.js b/site/j2s/jalview/datamodel/AlignmentView.js index 69038d4..8ba9db2 100644 --- a/site/j2s/jalview/datamodel/AlignmentView.js +++ b/site/j2s/jalview/datamodel/AlignmentView.js @@ -1,625 +1,625 @@ -Clazz.declarePackage ("jalview.datamodel"); -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 () { -c$ = Clazz.decorateAsClass (function () { -this.sequences = null; -this.contigs = null; -this.width = 0; -this.firstCol = 0; -this.scGroups = null; -this.$isNa = false; -if (!Clazz.isClassDefined ("jalview.datamodel.AlignmentView.ScGroup")) { -jalview.datamodel.AlignmentView.$AlignmentView$ScGroup$ (); -} -this.selected = null; -Clazz.instantialize (this, arguments); -}, jalview.datamodel, "AlignmentView"); -Clazz.defineMethod (c$, "isNa", -function () { -return this.$isNa; -}); -Clazz.makeConstructor (c$, -function (alignment, columnSelection, selection, hasHiddenColumns, selectedRegionOnly, recordGroups) { -this.construct ( new jalview.datamodel.CigarArray (alignment, (hasHiddenColumns ? columnSelection : null), (selectedRegionOnly ? selection : null)), (selectedRegionOnly && selection != null) ? selection.getStartRes () : 0); -this.$isNa = alignment.isNucleotide (); -var selseqs; -if (selection != null && selection.getSize () > 0) { -var sel = selection.getSequences (null); -this.selected = new java.util.Vector (); -selseqs = selection.getSequencesInOrder (alignment, selectedRegionOnly); -} else { -selseqs = alignment.getSequencesArray (); -}var seqsets = new java.util.ArrayList (); -var grps = new java.util.ArrayList (); -var gg = alignment.getGroups (); -grps.addAll (gg); -var sgrps = null; -var addedgps = null; -if (grps != null) { -if (selection != null && selectedRegionOnly) { -var ssel = selection.getStartRes (); -var esel = selection.getEndRes (); -var isg = new java.util.ArrayList (); -for (var sg, $sg = grps.iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) { -if (!(sg.getStartRes () > esel || sg.getEndRes () < ssel)) { -if (sg.getStartRes () < ssel) { -sg.setStartRes (ssel); -}if (sg.getEndRes () > esel) { -sg.setEndRes (esel); -}sg.setStartRes (sg.getStartRes () - ssel + 1); -sg.setEndRes (sg.getEndRes () - ssel + 1); -isg.add (sg); -}} -grps = isg; -}sgrps = new Array (grps.size ()); -addedgps = Clazz.newBooleanArray (grps.size (), false); -for (var g = 0; g < sgrps.length; g++) { -var sg = grps.get (g); -sgrps[g] = Clazz.innerTypeInstance (jalview.datamodel.AlignmentView.ScGroup, this, null); -sgrps[g].sg = new jalview.datamodel.SequenceGroup (sg); -addedgps[g] = false; -seqsets.add (sg.getSequences ()); -} -}var csi = 0; -for (var i = 0; i < selseqs.length; i++) { -if (selseqs[i] != null) { -if (selection != null && selection.getSize () > 0 && !selectedRegionOnly) { -this.sequences[csi].setGroupMembership (this.selected); -this.selected.addElement (this.sequences[csi]); -}if (seqsets != null) { -for (var sg = 0; sg < sgrps.length; sg++) { -if ((seqsets.get (sg)).contains (selseqs[i])) { -this.sequences[csi].setGroupMembership (sgrps[sg]); -sgrps[sg].sg.deleteSequence (selseqs[i], false); -sgrps[sg].seqs.addElement (this.sequences[csi]); -if (!addedgps[sg]) { -if (this.scGroups == null) { -this.scGroups = new java.util.ArrayList (); -}addedgps[sg] = true; -this.scGroups.add (sgrps[sg]); -}}} -}csi++; -}} -for (var sg = 0; sg < sgrps.length; sg++) { -var sqs = sgrps[sg].sg.getSequencesAsArray (null); -for (var si = 0; si < sqs.length; si++) { -sgrps[sg].sg.deleteSequence (sqs[si], false); -} -sgrps[sg] = null; -} -}, "jalview.datamodel.AlignmentI,jalview.datamodel.ColumnSelection,jalview.datamodel.SequenceGroup,~B,~B,~B"); -Clazz.makeConstructor (c$, -function (seqcigararray) { -if (!seqcigararray.isSeqCigarArray ()) { -throw new Error (jalview.util.MessageManager.getString ("error.implementation_error_can_only_make_alignmnet_from_cigararray")); -}this.contigs = seqcigararray.getDeletedRegions (); -this.sequences = seqcigararray.getSeqCigarArray (); -this.width = seqcigararray.getWidth (); -}, "jalview.datamodel.CigarArray"); -Clazz.makeConstructor (c$, -function (sdata, firstcol) { -this.construct (sdata); -this.firstCol = firstcol; -}, "jalview.datamodel.CigarArray,~N"); -Clazz.defineMethod (c$, "setSequences", -function (sequences) { -this.sequences = sequences; -}, "~A"); -Clazz.defineMethod (c$, "setContigs", -function (contigs) { -this.contigs = contigs; -}, "~A"); -Clazz.defineMethod (c$, "getSequences", -function () { -return this.sequences; -}); -Clazz.defineMethod (c$, "getContigs", -function () { -return this.contigs; -}); -Clazz.defineMethod (c$, "getAlignmentAndColumnSelection", -function (gapCharacter) { -var colsel = new jalview.datamodel.ColumnSelection (); -return Clazz.newArray (-1, [jalview.datamodel.SeqCigar.createAlignmentSequences (this.sequences, gapCharacter, colsel, this.contigs), colsel]); -}, "~S"); -Clazz.defineMethod (c$, "getVisibleAlignment", -function (c) { -var aln = this.getVisibleSeqs (c); -var vcal = new jalview.datamodel.Alignment (aln); -this.addPrunedGroupsInOrder (vcal, -1, -1, true); -return vcal; -}, "~S"); -Clazz.defineMethod (c$, "addPrunedGroupsInOrder", - function (vcal, gstart, gend, viscontigs) { -var r = false; -if (gstart > -1 && gstart <= gend) { -r = true; -}var aln = vcal.getSequencesArray (); -{ -{ -var nvg = (this.scGroups != null) ? this.scGroups.size () : 0; -if (nvg > 0) { -var nsg = new Array (nvg); -for (var g = 0; g < nvg; g++) { -var sg = this.scGroups.get (g).sg; -if (r) { -if (sg.getStartRes () > gend || sg.getEndRes () < gstart) { -nsg[g] = null; -continue; -}}nsg[g] = new jalview.datamodel.SequenceGroup (sg); -if (r && !viscontigs) { -if (nsg[g].getStartRes () < gstart) { -nsg[g].setStartRes (0); -} else { -nsg[g].setStartRes (nsg[g].getStartRes () - gstart); -nsg[g].setEndRes (nsg[g].getEndRes () - gstart); -}if (nsg[g].getEndRes () > (gend - gstart)) { -nsg[g].setEndRes (gend - gstart); -}}} -if (viscontigs) { -if (this.contigs != null) { -var p = 0; -var prune = new jalview.util.ShiftList (); -if (r) { -prune.addShift (gstart, -gstart); -}for (var h = 0; h < this.contigs.length; h += 3) { -{ -prune.addShift (p + this.contigs[h + 1], this.contigs[h + 2] - this.contigs[h + 1]); -}p = this.contigs[h + 1] + this.contigs[h + 2]; -} -for (var g = 0; g < nsg.length; g++) { -if (nsg[g] != null) { -var s = nsg[g].getStartRes (); -var t = nsg[g].getEndRes (); -var w = 1 + t - s; -if (r) { -if (s < gstart) { -s = gstart; -}if (t > gend) { -t = gend; -}}s = prune.shift (s); -t = prune.shift (t); -nsg[g].setStartRes (s); -nsg[g].setEndRes (t); -}} -}}for (var nsq = 0; nsq < aln.length; nsq++) { -for (var g = 0; g < nvg; g++) { -if (nsg[g] != null && this.sequences[nsq].isMemberOf (this.scGroups.get (g))) { -nsg[g].addSequence (aln[nsq], false); -}} -} -for (var g = 0; g < nvg; g++) { -if (nsg[g] != null && nsg[g].getSize () > 0) { -vcal.addGroup (nsg[g]); -}nsg[g] = null; -} -}}}}, "jalview.datamodel.AlignmentI,~N,~N,~B"); -Clazz.defineMethod (c$, "getVisibleSeqs", - function (c) { -var aln = new Array (this.sequences.length); -for (var i = 0, j = this.sequences.length; i < j; i++) { -aln[i] = this.sequences[i].getSeq ('-'); -} -var seqs = this.getSequenceStrings ('-'); -for (var i = 0, j = aln.length; i < j; i++) { -aln[i].setSequence (seqs[i]); -} -return aln; -}, "~S"); -Clazz.defineMethod (c$, "getVisibleContigAlignments", -function (c) { -var nvc = 0; -var vcontigs = this.getVisibleContigs (); -var contigviews = this.getVisibleContigs (c); -var vcals = new Array (contigviews.length); -for (nvc = 0; nvc < contigviews.length; nvc++) { -vcals[nvc] = new jalview.datamodel.Alignment (contigviews[nvc]); -if (this.scGroups != null && this.scGroups.size () > 0) { -this.addPrunedGroupsInOrder (vcals[nvc], vcontigs[nvc * 2], vcontigs[nvc * 2 + 1], true); -}} -return vcals; -}, "~S"); -Clazz.defineMethod (c$, "getSequenceStrings", -function (c) { -var seqs = new Array (this.sequences.length); -for (var n = 0; n < this.sequences.length; n++) { -var fullseq = this.sequences[n].getSequenceString (c); -if (this.contigs != null) { -seqs[n] = ""; -var p = 0; -for (var h = 0; h < this.contigs.length; h += 3) { -seqs[n] += fullseq.substring (p, this.contigs[h + 1]); -p = this.contigs[h + 1] + this.contigs[h + 2]; -} -seqs[n] += fullseq.substring (p); -} else { -seqs[n] = fullseq; -}} -return seqs; -}, "~S"); -Clazz.defineMethod (c$, "getWidth", -function () { -return this.width; -}); -Clazz.defineMethod (c$, "setWidth", -function (width) { -this.width = width; -}, "~N"); -Clazz.defineMethod (c$, "getVisibleContigs", -function (gapCharacter) { -var smsa; -var njobs = 1; -if (this.sequences == null || this.width <= 0) { -return null; -}if (this.contigs != null && this.contigs.length > 0) { -var start = 0; -njobs = 0; -var fwidth = this.width; -for (var contig = 0; contig < this.contigs.length; contig += 3) { -if ((this.contigs[contig + 1] - start) > 0) { -njobs++; -}fwidth += this.contigs[contig + 2]; -start = this.contigs[contig + 1] + this.contigs[contig + 2]; -} -if (start < fwidth) { -njobs++; -}smsa = new Array (njobs); -start = 0; -var j = 0; -for (var contig = 0; contig < this.contigs.length; contig += 3) { -if (this.contigs[contig + 1] - start > 0) { -var mseq = new Array (this.sequences.length); -for (var s = 0; s < mseq.length; s++) { -mseq[s] = this.sequences[s].getSeq (gapCharacter).getSubSequence (start, this.contigs[contig + 1]); -} -smsa[j] = mseq; -j++; -}start = this.contigs[contig + 1] + this.contigs[contig + 2]; -} -if (start < fwidth) { -var mseq = new Array (this.sequences.length); -for (var s = 0; s < mseq.length; s++) { -mseq[s] = this.sequences[s].getSeq (gapCharacter).getSubSequence (start, fwidth + 1); -} -smsa[j] = mseq; -j++; -}} else { -smsa = new Array (1); -smsa[0] = new Array (this.sequences.length); -for (var s = 0; s < this.sequences.length; s++) { -smsa[0][s] = this.sequences[s].getSeq (gapCharacter); -} -}return smsa; -}, "~S"); -Clazz.defineMethod (c$, "getUpdatedView", -function (nvismsa, orders, gapCharacter) { -if (this.sequences == null || this.width <= 0) { -throw new Error (jalview.util.MessageManager.getString ("error.empty_view_cannot_be_updated")); -}if (nvismsa == null) { -throw new Error ("nvismsa==null. use getAlignmentAndColumnSelection() instead."); -}if (this.contigs != null && this.contigs.length > 0) { -var alignment = new Array (this.sequences.length); -var columnselection = new jalview.datamodel.ColumnSelection (); -if (this.contigs != null && this.contigs.length > 0) { -var start = 0; -var nwidth = 0; -var owidth = this.width; -var j = 0; -for (var contig = 0; contig < this.contigs.length; contig += 3) { -owidth += this.contigs[contig + 2]; -if (this.contigs[contig + 1] - start > 0) { -var swidth = 0; -if (nvismsa[j] != null) { -var mseq = nvismsa[j]; -var order = (orders == null) ? null : orders[j]; -j++; -if (mseq.length != this.sequences.length) { -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 ()]))); -}swidth = mseq[0].getLength (); -for (var s = 0; s < mseq.length; s++) { -if (alignment[s] == null) { -alignment[s] = mseq[s]; -} else { -alignment[s].setSequence (alignment[s].getSequenceAsString () + mseq[s].getSequenceAsString ()); -if (mseq[s].getStart () <= mseq[s].getEnd ()) { -alignment[s].setEnd (mseq[s].getEnd ()); -}if (order != null) { -order.updateSequence (mseq[s], alignment[s]); -}}} -} else { -if (true) { -for (var s = 0; s < this.sequences.length; s++) { -var oseq = this.sequences[s].getSeq (gapCharacter).getSubSequence (start, this.contigs[contig + 1]); -if (swidth < oseq.getLength ()) { -swidth = oseq.getLength (); -}if (alignment[s] == null) { -alignment[s] = oseq; -} else { -alignment[s].setSequence (alignment[s].getSequenceAsString () + oseq.getSequenceAsString ()); -if (oseq.getEnd () >= oseq.getStart ()) { -alignment[s].setEnd (oseq.getEnd ()); -}}} -}j++; -}nwidth += swidth; -}start = this.contigs[contig + 1] + this.contigs[contig + 2]; -for (var s = 0; s < this.sequences.length; s++) { -var hseq = this.sequences[s].getSeq (gapCharacter).getSubSequence (this.contigs[contig + 1], start); -if (alignment[s] == null) { -alignment[s] = hseq; -} else { -alignment[s].setSequence (alignment[s].getSequenceAsString () + hseq.getSequenceAsString ()); -if (hseq.getEnd () >= hseq.getStart ()) { -alignment[s].setEnd (hseq.getEnd ()); -}}} -columnselection.hideColumns (nwidth, nwidth + this.contigs[contig + 2] - 1); -nwidth += this.contigs[contig + 2]; -} -if (j < nvismsa.length) { -var swidth = 0; -if (nvismsa[j] != null) { -var mseq = nvismsa[j]; -var order = (orders != null) ? orders[j] : null; -swidth = mseq[0].getLength (); -for (var s = 0; s < mseq.length; s++) { -if (alignment[s] == null) { -alignment[s] = mseq[s]; -} else { -alignment[s].setSequence (alignment[s].getSequenceAsString () + mseq[s].getSequenceAsString ()); -if (mseq[s].getEnd () >= mseq[s].getStart ()) { -alignment[s].setEnd (mseq[s].getEnd ()); -}if (order != null) { -order.updateSequence (mseq[s], alignment[s]); -}}} -} else { -if (start < owidth) { -if (true) { -for (var s = 0; s < this.sequences.length; s++) { -var oseq = this.sequences[s].getSeq (gapCharacter).getSubSequence (start, owidth + 1); -if (swidth < oseq.getLength ()) { -swidth = oseq.getLength (); -}if (alignment[s] == null) { -alignment[s] = oseq; -} else { -alignment[s].setSequence (alignment[s].getSequenceAsString () + oseq.getSequenceAsString ()); -if (oseq.getEnd () >= oseq.getStart ()) { -alignment[s].setEnd (oseq.getEnd ()); -}}} -nwidth += swidth; -} else { -throw new Error (jalview.util.MessageManager.getString ("error.padding_not_yet_implemented")); -}}}}}return Clazz.newArray (-1, [alignment, columnselection]); -} else { -if (nvismsa.length != 1) { -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 ()]))); -}if (nvismsa[0] != null) { -return Clazz.newArray (-1, [nvismsa[0], new jalview.datamodel.ColumnSelection ()]); -} else { -return this.getAlignmentAndColumnSelection (gapCharacter); -}}}, "~A,~A,~S"); -Clazz.defineMethod (c$, "getVisibleContigs", -function () { -if (this.contigs != null && this.contigs.length > 0) { -var start = 0; -var nvis = 0; -var fwidth = this.width; -for (var contig = 0; contig < this.contigs.length; contig += 3) { -if ((this.contigs[contig + 1] - start) > 0) { -nvis++; -}fwidth += this.contigs[contig + 2]; -start = this.contigs[contig + 1] + this.contigs[contig + 2]; -} -if (start < fwidth) { -nvis++; -}var viscontigs = Clazz.newIntArray (nvis * 2, 0); -nvis = 0; -start = 0; -for (var contig = 0; contig < this.contigs.length; contig += 3) { -if ((this.contigs[contig + 1] - start) > 0) { -viscontigs[nvis] = start; -viscontigs[nvis + 1] = this.contigs[contig + 1] - 1; -nvis += 2; -}start = this.contigs[contig + 1] + this.contigs[contig + 2]; -} -if (start < fwidth) { -viscontigs[nvis] = start; -viscontigs[nvis + 1] = fwidth; -nvis += 2; -}return viscontigs; -} else { -return Clazz.newIntArray (-1, [0, this.width]); -}}); -Clazz.defineMethod (c$, "getAlignmentOrigin", -function () { -return this.firstCol; -}); -Clazz.defineMethod (c$, "getVisibleContigMapFor", -function (gapMap) { -var delMap = null; -var viscontigs = this.getVisibleContigs (); -var spos = 0; -var i = 0; -if (viscontigs != null) { -delMap = Clazz.newIntArray (gapMap.length, 0); -for (var contig = 0; contig < viscontigs.length; contig += 2) { -while (spos < gapMap.length && gapMap[spos] < viscontigs[contig]) { -spos++; -} -while (spos < gapMap.length && gapMap[spos] <= viscontigs[contig + 1]) { -delMap[i++] = spos++; -} -} -var tmap = Clazz.newIntArray (i, 0); -System.arraycopy (delMap, 0, tmap, 0, i); -delMap = tmap; -}return delMap; -}, "~A"); -Clazz.defineMethod (c$, "getEditedSequences", -function (gc, $delete) { -var msf = this.getSequences (); -var aln = new Array (msf.length); -for (var i = 0, j = msf.length; i < j; i++) { -aln[i] = msf[i].getSeq (gc); -} -if ($delete) { -var sqs = this.getSequenceStrings (gc); -for (var i = 0; i < sqs.length; i++) { -aln[i].setSequence (sqs[i]); -sqs[i] = null; -} -}return aln; -}, "~S,~B"); -c$.summariseAlignmentView = Clazz.defineMethod (c$, "summariseAlignmentView", -function (view, os) { -os.print ("View has " + view.sequences.length + " of which "); -if (view.selected == null) { -os.print ("None"); -} else { -os.print (" " + view.selected.size ()); -}os.println (" are selected."); -os.print ("View is " + view.getWidth () + " columns wide"); -var viswid = 0; -var contigs = view.getContigs (); -if (contigs != null) { -viswid = view.width; -for (var i = 0; i < contigs.length; i += 3) { -viswid += contigs[i + 2]; -} -os.println ("with " + viswid + " visible columns spread over " + Clazz.doubleToInt (contigs.length / 3) + " regions."); -} else { -viswid = view.width; -os.println ("."); -}if (view.scGroups != null) { -os.println ("There are " + view.scGroups.size () + " groups defined on the view."); -for (var g = 0; g < view.scGroups.size (); g++) { -var sgr = view.scGroups.get (g); -os.println ("Group " + g + ": Name = " + sgr.sg.getName () + " Contains " + sgr.seqs.size () + " Seqs."); -os.println ("This group runs from " + sgr.sg.getStartRes () + " to " + sgr.sg.getEndRes ()); -for (var s = 0; s < sgr.seqs.size (); s++) { -if (!(sgr.seqs.elementAt (s)).isMemberOf (sgr)) { -os.println ("** WARNING: sequence " + (sgr.seqs.elementAt (s)).toString () + " is not marked as member of group."); -}} -} -var visal = view.getVisibleAlignment ('-'); -if (visal != null) { -os.println ("Vis. alignment is " + visal.getWidth () + " wide and has " + visal.getHeight () + " seqs."); -if (visal.getGroups () != null && visal.getGroups ().size () > 0) { -var i = 1; -for (var sg, $sg = visal.getGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) { -os.println ("Group " + (i++) + " begins at column " + sg.getStartRes () + " and ends at " + sg.getEndRes ()); -} -}}}}, "jalview.datamodel.AlignmentView,java.io.PrintStream"); -c$.testSelectionViews = Clazz.defineMethod (c$, "testSelectionViews", -function (alignment, csel, selection) { -System.out.println ("Testing standard view creation:\n"); -var view = null; -try { -System.out.println ("View with no hidden columns, no limit to selection, no groups to be collected:"); -view = new jalview.datamodel.AlignmentView (alignment, csel, selection, false, false, false); -jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); -} catch (e) { -if (Clazz.exceptionOf (e, Exception)) { -e.printStackTrace (); -System.err.println ("Failed to generate alignment with selection but no groups marked."); -} else { -throw e; -} -} -try { -System.out.println ("View with no hidden columns, no limit to selection, and all groups to be collected:"); -view = new jalview.datamodel.AlignmentView (alignment, csel, selection, false, false, true); -jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); -} catch (e) { -if (Clazz.exceptionOf (e, Exception)) { -e.printStackTrace (); -System.err.println ("Failed to generate alignment with selection marked but no groups marked."); -} else { -throw e; -} -} -try { -System.out.println ("View with no hidden columns, limited to selection and no groups to be collected:"); -view = new jalview.datamodel.AlignmentView (alignment, csel, selection, false, true, false); -jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); -} catch (e) { -if (Clazz.exceptionOf (e, Exception)) { -e.printStackTrace (); -System.err.println ("Failed to generate alignment with selection restricted but no groups marked."); -} else { -throw e; -} -} -try { -System.out.println ("View with no hidden columns, limited to selection, and all groups to be collected:"); -view = new jalview.datamodel.AlignmentView (alignment, csel, selection, false, true, true); -jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); -} catch (e) { -if (Clazz.exceptionOf (e, Exception)) { -e.printStackTrace (); -System.err.println ("Failed to generate alignment with selection restricted and groups marked."); -} else { -throw e; -} -} -try { -System.out.println ("View *with* hidden columns, no limit to selection, no groups to be collected:"); -view = new jalview.datamodel.AlignmentView (alignment, csel, selection, true, false, false); -jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); -} catch (e) { -if (Clazz.exceptionOf (e, Exception)) { -e.printStackTrace (); -System.err.println ("Failed to generate alignment with selection but no groups marked."); -} else { -throw e; -} -} -try { -System.out.println ("View *with* hidden columns, no limit to selection, and all groups to be collected:"); -view = new jalview.datamodel.AlignmentView (alignment, csel, selection, true, false, true); -jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); -} catch (e) { -if (Clazz.exceptionOf (e, Exception)) { -e.printStackTrace (); -System.err.println ("Failed to generate alignment with selection marked but no groups marked."); -} else { -throw e; -} -} -try { -System.out.println ("View *with* hidden columns, limited to selection and no groups to be collected:"); -view = new jalview.datamodel.AlignmentView (alignment, csel, selection, true, true, false); -jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); -} catch (e) { -if (Clazz.exceptionOf (e, Exception)) { -e.printStackTrace (); -System.err.println ("Failed to generate alignment with selection restricted but no groups marked."); -} else { -throw e; -} -} -try { -System.out.println ("View *with* hidden columns, limited to selection, and all groups to be collected:"); -view = new jalview.datamodel.AlignmentView (alignment, csel, selection, true, true, true); -jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); -} catch (e) { -if (Clazz.exceptionOf (e, Exception)) { -e.printStackTrace (); -System.err.println ("Failed to generate alignment with selection restricted and groups marked."); -} else { -throw e; -} -} -}, "jalview.datamodel.AlignmentI,jalview.datamodel.ColumnSelection,jalview.datamodel.SequenceGroup"); -c$.$AlignmentView$ScGroup$ = function () { -Clazz.pu$h(self.c$); -c$ = Clazz.decorateAsClass (function () { -Clazz.prepareCallback (this, arguments); -this.seqs = null; -this.sg = null; -Clazz.instantialize (this, arguments); -}, jalview.datamodel.AlignmentView, "ScGroup"); -Clazz.makeConstructor (c$, -function () { -this.seqs = new java.util.Vector (); -}); -c$ = Clazz.p0p (); -}; -}); +Clazz.declarePackage ("jalview.datamodel"); +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 () { +c$ = Clazz.decorateAsClass (function () { +this.sequences = null; +this.contigs = null; +this.width = 0; +this.firstCol = 0; +this.scGroups = null; +this.$isNa = false; +if (!Clazz.isClassDefined ("jalview.datamodel.AlignmentView.ScGroup")) { +jalview.datamodel.AlignmentView.$AlignmentView$ScGroup$ (); +} +this.selected = null; +Clazz.instantialize (this, arguments); +}, jalview.datamodel, "AlignmentView"); +Clazz.defineMethod (c$, "isNa", +function () { +return this.$isNa; +}); +Clazz.makeConstructor (c$, +function (alignment, columnSelection, selection, hasHiddenColumns, selectedRegionOnly, recordGroups) { +this.construct ( new jalview.datamodel.CigarArray (alignment, (hasHiddenColumns ? columnSelection : null), (selectedRegionOnly ? selection : null)), (selectedRegionOnly && selection != null) ? selection.getStartRes () : 0); +this.$isNa = alignment.isNucleotide (); +var selseqs; +if (selection != null && selection.getSize () > 0) { +var sel = selection.getSequences (null); +this.selected = new java.util.Vector (); +selseqs = selection.getSequencesInOrder (alignment, selectedRegionOnly); +} else { +selseqs = alignment.getSequencesArray (); +}var seqsets = new java.util.ArrayList (); +var grps = new java.util.ArrayList (); +var gg = alignment.getGroups (); +grps.addAll (gg); +var sgrps = null; +var addedgps = null; +if (grps != null) { +if (selection != null && selectedRegionOnly) { +var ssel = selection.getStartRes (); +var esel = selection.getEndRes (); +var isg = new java.util.ArrayList (); +for (var sg, $sg = grps.iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) { +if (!(sg.getStartRes () > esel || sg.getEndRes () < ssel)) { +if (sg.getStartRes () < ssel) { +sg.setStartRes (ssel); +}if (sg.getEndRes () > esel) { +sg.setEndRes (esel); +}sg.setStartRes (sg.getStartRes () - ssel + 1); +sg.setEndRes (sg.getEndRes () - ssel + 1); +isg.add (sg); +}} +grps = isg; +}sgrps = new Array (grps.size ()); +addedgps = Clazz.newBooleanArray (grps.size (), false); +for (var g = 0; g < sgrps.length; g++) { +var sg = grps.get (g); +sgrps[g] = Clazz.innerTypeInstance (jalview.datamodel.AlignmentView.ScGroup, this, null); +sgrps[g].sg = new jalview.datamodel.SequenceGroup (sg); +addedgps[g] = false; +seqsets.add (sg.getSequences ()); +} +}var csi = 0; +for (var i = 0; i < selseqs.length; i++) { +if (selseqs[i] != null) { +if (selection != null && selection.getSize () > 0 && !selectedRegionOnly) { +this.sequences[csi].setGroupMembership (this.selected); +this.selected.addElement (this.sequences[csi]); +}if (seqsets != null) { +for (var sg = 0; sg < sgrps.length; sg++) { +if ((seqsets.get (sg)).contains (selseqs[i])) { +this.sequences[csi].setGroupMembership (sgrps[sg]); +sgrps[sg].sg.deleteSequence (selseqs[i], false); +sgrps[sg].seqs.addElement (this.sequences[csi]); +if (!addedgps[sg]) { +if (this.scGroups == null) { +this.scGroups = new java.util.ArrayList (); +}addedgps[sg] = true; +this.scGroups.add (sgrps[sg]); +}}} +}csi++; +}} +for (var sg = 0; sg < sgrps.length; sg++) { +var sqs = sgrps[sg].sg.getSequencesAsArray (null); +for (var si = 0; si < sqs.length; si++) { +sgrps[sg].sg.deleteSequence (sqs[si], false); +} +sgrps[sg] = null; +} +}, "jalview.datamodel.AlignmentI,jalview.datamodel.ColumnSelection,jalview.datamodel.SequenceGroup,~B,~B,~B"); +Clazz.makeConstructor (c$, +function (seqcigararray) { +if (!seqcigararray.isSeqCigarArray ()) { +throw new Error (jalview.util.MessageManager.getString ("error.implementation_error_can_only_make_alignmnet_from_cigararray")); +}this.contigs = seqcigararray.getDeletedRegions (); +this.sequences = seqcigararray.getSeqCigarArray (); +this.width = seqcigararray.getWidth (); +}, "jalview.datamodel.CigarArray"); +Clazz.makeConstructor (c$, +function (sdata, firstcol) { +this.construct (sdata); +this.firstCol = firstcol; +}, "jalview.datamodel.CigarArray,~N"); +Clazz.defineMethod (c$, "setSequences", +function (sequences) { +this.sequences = sequences; +}, "~A"); +Clazz.defineMethod (c$, "setContigs", +function (contigs) { +this.contigs = contigs; +}, "~A"); +Clazz.defineMethod (c$, "getSequences", +function () { +return this.sequences; +}); +Clazz.defineMethod (c$, "getContigs", +function () { +return this.contigs; +}); +Clazz.defineMethod (c$, "getAlignmentAndColumnSelection", +function (gapCharacter) { +var colsel = new jalview.datamodel.ColumnSelection (); +return Clazz.newArray (-1, [jalview.datamodel.SeqCigar.createAlignmentSequences (this.sequences, gapCharacter, colsel, this.contigs), colsel]); +}, "~S"); +Clazz.defineMethod (c$, "getVisibleAlignment", +function (c) { +var aln = this.getVisibleSeqs (c); +var vcal = new jalview.datamodel.Alignment (aln); +this.addPrunedGroupsInOrder (vcal, -1, -1, true); +return vcal; +}, "~S"); +Clazz.defineMethod (c$, "addPrunedGroupsInOrder", + function (vcal, gstart, gend, viscontigs) { +var r = false; +if (gstart > -1 && gstart <= gend) { +r = true; +}var aln = vcal.getSequencesArray (); +{ +{ +var nvg = (this.scGroups != null) ? this.scGroups.size () : 0; +if (nvg > 0) { +var nsg = new Array (nvg); +for (var g = 0; g < nvg; g++) { +var sg = this.scGroups.get (g).sg; +if (r) { +if (sg.getStartRes () > gend || sg.getEndRes () < gstart) { +nsg[g] = null; +continue; +}}nsg[g] = new jalview.datamodel.SequenceGroup (sg); +if (r && !viscontigs) { +if (nsg[g].getStartRes () < gstart) { +nsg[g].setStartRes (0); +} else { +nsg[g].setStartRes (nsg[g].getStartRes () - gstart); +nsg[g].setEndRes (nsg[g].getEndRes () - gstart); +}if (nsg[g].getEndRes () > (gend - gstart)) { +nsg[g].setEndRes (gend - gstart); +}}} +if (viscontigs) { +if (this.contigs != null) { +var p = 0; +var prune = new jalview.util.ShiftList (); +if (r) { +prune.addShift (gstart, -gstart); +}for (var h = 0; h < this.contigs.length; h += 3) { +{ +prune.addShift (p + this.contigs[h + 1], this.contigs[h + 2] - this.contigs[h + 1]); +}p = this.contigs[h + 1] + this.contigs[h + 2]; +} +for (var g = 0; g < nsg.length; g++) { +if (nsg[g] != null) { +var s = nsg[g].getStartRes (); +var t = nsg[g].getEndRes (); +var w = 1 + t - s; +if (r) { +if (s < gstart) { +s = gstart; +}if (t > gend) { +t = gend; +}}s = prune.shift (s); +t = prune.shift (t); +nsg[g].setStartRes (s); +nsg[g].setEndRes (t); +}} +}}for (var nsq = 0; nsq < aln.length; nsq++) { +for (var g = 0; g < nvg; g++) { +if (nsg[g] != null && this.sequences[nsq].isMemberOf (this.scGroups.get (g))) { +nsg[g].addSequence (aln[nsq], false); +}} +} +for (var g = 0; g < nvg; g++) { +if (nsg[g] != null && nsg[g].getSize () > 0) { +vcal.addGroup (nsg[g]); +}nsg[g] = null; +} +}}}}, "jalview.datamodel.AlignmentI,~N,~N,~B"); +Clazz.defineMethod (c$, "getVisibleSeqs", + function (c) { +var aln = new Array (this.sequences.length); +for (var i = 0, j = this.sequences.length; i < j; i++) { +aln[i] = this.sequences[i].getSeq ('-'); +} +var seqs = this.getSequenceStrings ('-'); +for (var i = 0, j = aln.length; i < j; i++) { +aln[i].setSequence (seqs[i]); +} +return aln; +}, "~S"); +Clazz.defineMethod (c$, "getVisibleContigAlignments", +function (c) { +var nvc = 0; +var vcontigs = this.getVisibleContigs (); +var contigviews = this.getVisibleContigs (c); +var vcals = new Array (contigviews.length); +for (nvc = 0; nvc < contigviews.length; nvc++) { +vcals[nvc] = new jalview.datamodel.Alignment (contigviews[nvc]); +if (this.scGroups != null && this.scGroups.size () > 0) { +this.addPrunedGroupsInOrder (vcals[nvc], vcontigs[nvc * 2], vcontigs[nvc * 2 + 1], true); +}} +return vcals; +}, "~S"); +Clazz.defineMethod (c$, "getSequenceStrings", +function (c) { +var seqs = new Array (this.sequences.length); +for (var n = 0; n < this.sequences.length; n++) { +var fullseq = this.sequences[n].getSequenceString (c); +if (this.contigs != null) { +seqs[n] = ""; +var p = 0; +for (var h = 0; h < this.contigs.length; h += 3) { +seqs[n] += fullseq.substring (p, this.contigs[h + 1]); +p = this.contigs[h + 1] + this.contigs[h + 2]; +} +seqs[n] += fullseq.substring (p); +} else { +seqs[n] = fullseq; +}} +return seqs; +}, "~S"); +Clazz.defineMethod (c$, "getWidth", +function () { +return this.width; +}); +Clazz.defineMethod (c$, "setWidth", +function (width) { +this.width = width; +}, "~N"); +Clazz.defineMethod (c$, "getVisibleContigs", +function (gapCharacter) { +var smsa; +var njobs = 1; +if (this.sequences == null || this.width <= 0) { +return null; +}if (this.contigs != null && this.contigs.length > 0) { +var start = 0; +njobs = 0; +var fwidth = this.width; +for (var contig = 0; contig < this.contigs.length; contig += 3) { +if ((this.contigs[contig + 1] - start) > 0) { +njobs++; +}fwidth += this.contigs[contig + 2]; +start = this.contigs[contig + 1] + this.contigs[contig + 2]; +} +if (start < fwidth) { +njobs++; +}smsa = new Array (njobs); +start = 0; +var j = 0; +for (var contig = 0; contig < this.contigs.length; contig += 3) { +if (this.contigs[contig + 1] - start > 0) { +var mseq = new Array (this.sequences.length); +for (var s = 0; s < mseq.length; s++) { +mseq[s] = this.sequences[s].getSeq (gapCharacter).getSubSequence (start, this.contigs[contig + 1]); +} +smsa[j] = mseq; +j++; +}start = this.contigs[contig + 1] + this.contigs[contig + 2]; +} +if (start < fwidth) { +var mseq = new Array (this.sequences.length); +for (var s = 0; s < mseq.length; s++) { +mseq[s] = this.sequences[s].getSeq (gapCharacter).getSubSequence (start, fwidth + 1); +} +smsa[j] = mseq; +j++; +}} else { +smsa = new Array (1); +smsa[0] = new Array (this.sequences.length); +for (var s = 0; s < this.sequences.length; s++) { +smsa[0][s] = this.sequences[s].getSeq (gapCharacter); +} +}return smsa; +}, "~S"); +Clazz.defineMethod (c$, "getUpdatedView", +function (nvismsa, orders, gapCharacter) { +if (this.sequences == null || this.width <= 0) { +throw new Error (jalview.util.MessageManager.getString ("error.empty_view_cannot_be_updated")); +}if (nvismsa == null) { +throw new Error ("nvismsa==null. use getAlignmentAndColumnSelection() instead."); +}if (this.contigs != null && this.contigs.length > 0) { +var alignment = new Array (this.sequences.length); +var columnselection = new jalview.datamodel.ColumnSelection (); +if (this.contigs != null && this.contigs.length > 0) { +var start = 0; +var nwidth = 0; +var owidth = this.width; +var j = 0; +for (var contig = 0; contig < this.contigs.length; contig += 3) { +owidth += this.contigs[contig + 2]; +if (this.contigs[contig + 1] - start > 0) { +var swidth = 0; +if (nvismsa[j] != null) { +var mseq = nvismsa[j]; +var order = (orders == null) ? null : orders[j]; +j++; +if (mseq.length != this.sequences.length) { +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 ()]))); +}swidth = mseq[0].getLength (); +for (var s = 0; s < mseq.length; s++) { +if (alignment[s] == null) { +alignment[s] = mseq[s]; +} else { +alignment[s].setSequence (alignment[s].getSequenceAsString () + mseq[s].getSequenceAsString ()); +if (mseq[s].getStart () <= mseq[s].getEnd ()) { +alignment[s].setEnd (mseq[s].getEnd ()); +}if (order != null) { +order.updateSequence (mseq[s], alignment[s]); +}}} +} else { +if (true) { +for (var s = 0; s < this.sequences.length; s++) { +var oseq = this.sequences[s].getSeq (gapCharacter).getSubSequence (start, this.contigs[contig + 1]); +if (swidth < oseq.getLength ()) { +swidth = oseq.getLength (); +}if (alignment[s] == null) { +alignment[s] = oseq; +} else { +alignment[s].setSequence (alignment[s].getSequenceAsString () + oseq.getSequenceAsString ()); +if (oseq.getEnd () >= oseq.getStart ()) { +alignment[s].setEnd (oseq.getEnd ()); +}}} +}j++; +}nwidth += swidth; +}start = this.contigs[contig + 1] + this.contigs[contig + 2]; +for (var s = 0; s < this.sequences.length; s++) { +var hseq = this.sequences[s].getSeq (gapCharacter).getSubSequence (this.contigs[contig + 1], start); +if (alignment[s] == null) { +alignment[s] = hseq; +} else { +alignment[s].setSequence (alignment[s].getSequenceAsString () + hseq.getSequenceAsString ()); +if (hseq.getEnd () >= hseq.getStart ()) { +alignment[s].setEnd (hseq.getEnd ()); +}}} +columnselection.hideColumns (nwidth, nwidth + this.contigs[contig + 2] - 1); +nwidth += this.contigs[contig + 2]; +} +if (j < nvismsa.length) { +var swidth = 0; +if (nvismsa[j] != null) { +var mseq = nvismsa[j]; +var order = (orders != null) ? orders[j] : null; +swidth = mseq[0].getLength (); +for (var s = 0; s < mseq.length; s++) { +if (alignment[s] == null) { +alignment[s] = mseq[s]; +} else { +alignment[s].setSequence (alignment[s].getSequenceAsString () + mseq[s].getSequenceAsString ()); +if (mseq[s].getEnd () >= mseq[s].getStart ()) { +alignment[s].setEnd (mseq[s].getEnd ()); +}if (order != null) { +order.updateSequence (mseq[s], alignment[s]); +}}} +} else { +if (start < owidth) { +if (true) { +for (var s = 0; s < this.sequences.length; s++) { +var oseq = this.sequences[s].getSeq (gapCharacter).getSubSequence (start, owidth + 1); +if (swidth < oseq.getLength ()) { +swidth = oseq.getLength (); +}if (alignment[s] == null) { +alignment[s] = oseq; +} else { +alignment[s].setSequence (alignment[s].getSequenceAsString () + oseq.getSequenceAsString ()); +if (oseq.getEnd () >= oseq.getStart ()) { +alignment[s].setEnd (oseq.getEnd ()); +}}} +nwidth += swidth; +} else { +throw new Error (jalview.util.MessageManager.getString ("error.padding_not_yet_implemented")); +}}}}}return Clazz.newArray (-1, [alignment, columnselection]); +} else { +if (nvismsa.length != 1) { +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 ()]))); +}if (nvismsa[0] != null) { +return Clazz.newArray (-1, [nvismsa[0], new jalview.datamodel.ColumnSelection ()]); +} else { +return this.getAlignmentAndColumnSelection (gapCharacter); +}}}, "~A,~A,~S"); +Clazz.defineMethod (c$, "getVisibleContigs", +function () { +if (this.contigs != null && this.contigs.length > 0) { +var start = 0; +var nvis = 0; +var fwidth = this.width; +for (var contig = 0; contig < this.contigs.length; contig += 3) { +if ((this.contigs[contig + 1] - start) > 0) { +nvis++; +}fwidth += this.contigs[contig + 2]; +start = this.contigs[contig + 1] + this.contigs[contig + 2]; +} +if (start < fwidth) { +nvis++; +}var viscontigs = Clazz.newIntArray (nvis * 2, 0); +nvis = 0; +start = 0; +for (var contig = 0; contig < this.contigs.length; contig += 3) { +if ((this.contigs[contig + 1] - start) > 0) { +viscontigs[nvis] = start; +viscontigs[nvis + 1] = this.contigs[contig + 1] - 1; +nvis += 2; +}start = this.contigs[contig + 1] + this.contigs[contig + 2]; +} +if (start < fwidth) { +viscontigs[nvis] = start; +viscontigs[nvis + 1] = fwidth; +nvis += 2; +}return viscontigs; +} else { +return Clazz.newIntArray (-1, [0, this.width]); +}}); +Clazz.defineMethod (c$, "getAlignmentOrigin", +function () { +return this.firstCol; +}); +Clazz.defineMethod (c$, "getVisibleContigMapFor", +function (gapMap) { +var delMap = null; +var viscontigs = this.getVisibleContigs (); +var spos = 0; +var i = 0; +if (viscontigs != null) { +delMap = Clazz.newIntArray (gapMap.length, 0); +for (var contig = 0; contig < viscontigs.length; contig += 2) { +while (spos < gapMap.length && gapMap[spos] < viscontigs[contig]) { +spos++; +} +while (spos < gapMap.length && gapMap[spos] <= viscontigs[contig + 1]) { +delMap[i++] = spos++; +} +} +var tmap = Clazz.newIntArray (i, 0); +System.arraycopy (delMap, 0, tmap, 0, i); +delMap = tmap; +}return delMap; +}, "~A"); +Clazz.defineMethod (c$, "getEditedSequences", +function (gc, $delete) { +var msf = this.getSequences (); +var aln = new Array (msf.length); +for (var i = 0, j = msf.length; i < j; i++) { +aln[i] = msf[i].getSeq (gc); +} +if ($delete) { +var sqs = this.getSequenceStrings (gc); +for (var i = 0; i < sqs.length; i++) { +aln[i].setSequence (sqs[i]); +sqs[i] = null; +} +}return aln; +}, "~S,~B"); +c$.summariseAlignmentView = Clazz.defineMethod (c$, "summariseAlignmentView", +function (view, os) { +os.print ("View has " + view.sequences.length + " of which "); +if (view.selected == null) { +os.print ("None"); +} else { +os.print (" " + view.selected.size ()); +}os.println (" are selected."); +os.print ("View is " + view.getWidth () + " columns wide"); +var viswid = 0; +var contigs = view.getContigs (); +if (contigs != null) { +viswid = view.width; +for (var i = 0; i < contigs.length; i += 3) { +viswid += contigs[i + 2]; +} +os.println ("with " + viswid + " visible columns spread over " + Clazz.doubleToInt (contigs.length / 3) + " regions."); +} else { +viswid = view.width; +os.println ("."); +}if (view.scGroups != null) { +os.println ("There are " + view.scGroups.size () + " groups defined on the view."); +for (var g = 0; g < view.scGroups.size (); g++) { +var sgr = view.scGroups.get (g); +os.println ("Group " + g + ": Name = " + sgr.sg.getName () + " Contains " + sgr.seqs.size () + " Seqs."); +os.println ("This group runs from " + sgr.sg.getStartRes () + " to " + sgr.sg.getEndRes ()); +for (var s = 0; s < sgr.seqs.size (); s++) { +if (!(sgr.seqs.elementAt (s)).isMemberOf (sgr)) { +os.println ("** WARNING: sequence " + (sgr.seqs.elementAt (s)).toString () + " is not marked as member of group."); +}} +} +var visal = view.getVisibleAlignment ('-'); +if (visal != null) { +os.println ("Vis. alignment is " + visal.getWidth () + " wide and has " + visal.getHeight () + " seqs."); +if (visal.getGroups () != null && visal.getGroups ().size () > 0) { +var i = 1; +for (var sg, $sg = visal.getGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) { +os.println ("Group " + (i++) + " begins at column " + sg.getStartRes () + " and ends at " + sg.getEndRes ()); +} +}}}}, "jalview.datamodel.AlignmentView,java.io.PrintStream"); +c$.testSelectionViews = Clazz.defineMethod (c$, "testSelectionViews", +function (alignment, csel, selection) { +System.out.println ("Testing standard view creation:\n"); +var view = null; +try { +System.out.println ("View with no hidden columns, no limit to selection, no groups to be collected:"); +view = new jalview.datamodel.AlignmentView (alignment, csel, selection, false, false, false); +jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); +} catch (e) { +if (Clazz.exceptionOf (e, Exception)) { +e.printStackTrace (); +System.err.println ("Failed to generate alignment with selection but no groups marked."); +} else { +throw e; +} +} +try { +System.out.println ("View with no hidden columns, no limit to selection, and all groups to be collected:"); +view = new jalview.datamodel.AlignmentView (alignment, csel, selection, false, false, true); +jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); +} catch (e) { +if (Clazz.exceptionOf (e, Exception)) { +e.printStackTrace (); +System.err.println ("Failed to generate alignment with selection marked but no groups marked."); +} else { +throw e; +} +} +try { +System.out.println ("View with no hidden columns, limited to selection and no groups to be collected:"); +view = new jalview.datamodel.AlignmentView (alignment, csel, selection, false, true, false); +jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); +} catch (e) { +if (Clazz.exceptionOf (e, Exception)) { +e.printStackTrace (); +System.err.println ("Failed to generate alignment with selection restricted but no groups marked."); +} else { +throw e; +} +} +try { +System.out.println ("View with no hidden columns, limited to selection, and all groups to be collected:"); +view = new jalview.datamodel.AlignmentView (alignment, csel, selection, false, true, true); +jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); +} catch (e) { +if (Clazz.exceptionOf (e, Exception)) { +e.printStackTrace (); +System.err.println ("Failed to generate alignment with selection restricted and groups marked."); +} else { +throw e; +} +} +try { +System.out.println ("View *with* hidden columns, no limit to selection, no groups to be collected:"); +view = new jalview.datamodel.AlignmentView (alignment, csel, selection, true, false, false); +jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); +} catch (e) { +if (Clazz.exceptionOf (e, Exception)) { +e.printStackTrace (); +System.err.println ("Failed to generate alignment with selection but no groups marked."); +} else { +throw e; +} +} +try { +System.out.println ("View *with* hidden columns, no limit to selection, and all groups to be collected:"); +view = new jalview.datamodel.AlignmentView (alignment, csel, selection, true, false, true); +jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); +} catch (e) { +if (Clazz.exceptionOf (e, Exception)) { +e.printStackTrace (); +System.err.println ("Failed to generate alignment with selection marked but no groups marked."); +} else { +throw e; +} +} +try { +System.out.println ("View *with* hidden columns, limited to selection and no groups to be collected:"); +view = new jalview.datamodel.AlignmentView (alignment, csel, selection, true, true, false); +jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); +} catch (e) { +if (Clazz.exceptionOf (e, Exception)) { +e.printStackTrace (); +System.err.println ("Failed to generate alignment with selection restricted but no groups marked."); +} else { +throw e; +} +} +try { +System.out.println ("View *with* hidden columns, limited to selection, and all groups to be collected:"); +view = new jalview.datamodel.AlignmentView (alignment, csel, selection, true, true, true); +jalview.datamodel.AlignmentView.summariseAlignmentView (view, System.out); +} catch (e) { +if (Clazz.exceptionOf (e, Exception)) { +e.printStackTrace (); +System.err.println ("Failed to generate alignment with selection restricted and groups marked."); +} else { +throw e; +} +} +}, "jalview.datamodel.AlignmentI,jalview.datamodel.ColumnSelection,jalview.datamodel.SequenceGroup"); +c$.$AlignmentView$ScGroup$ = function () { +Clazz.pu$h(self.c$); +c$ = Clazz.decorateAsClass (function () { +Clazz.prepareCallback (this, arguments); +this.seqs = null; +this.sg = null; +Clazz.instantialize (this, arguments); +}, jalview.datamodel.AlignmentView, "ScGroup"); +Clazz.makeConstructor (c$, +function () { +this.seqs = new java.util.Vector (); +}); +c$ = Clazz.p0p (); +}; +});