2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.datamodel;
23 import jalview.util.MessageManager;
24 import jalview.util.ShiftList;
26 import java.io.PrintStream;
27 import java.util.ArrayList;
28 import java.util.List;
31 * Transient object compactly representing a 'view' of an alignment - with
32 * discontinuities marked. Extended in Jalview 2.7 to optionally record sequence
33 * groups and specific selected regions on the alignment.
35 public class AlignmentView
37 private SeqCigar[] sequences = null;
39 private int[] contigs = null;
41 private int width = 0;
43 private int firstCol = 0;
46 * one or more ScGroup objects, which are referenced by each seqCigar's group
49 private List<ScGroup> scGroups = null;
51 private boolean isNa = false;
54 * false if the view concerns peptides
64 * Group defined over SeqCigars. Unlike AlignmentI associated groups, each
65 * SequenceGroup hold just the essential properties for the group, but no
66 * references to the sequences involved. SeqCigars hold references to the
67 * seuqenceGroup entities themselves.
71 public List<SeqCigar> seqs;
73 public SequenceGroup sg;
77 seqs = new ArrayList<SeqCigar>();
82 * @return true if seq was not a member before and was added to group
84 public boolean add(SeqCigar seq)
86 if (!seq.isMemberOf(this))
89 seq.setGroupMembership(this);
101 * @return true if seq was a member and was removed from group
103 public boolean remove(SeqCigar seq)
105 if (seq.removeGroupMembership(this))
120 * vector of selected seqCigars. This vector is also referenced by each
121 * seqCigar contained in it.
123 private ScGroup selected;
126 * Construct an alignmentView from a live jalview alignment view. Note -
127 * hidden rows will be excluded from alignmentView Note: JAL-1179
130 * - alignment as referenced by an AlignViewport
131 * @param columnSelection
134 * @param hasHiddenColumns
135 * - mark the hidden columns in columnSelection as hidden in the view
136 * @param selectedRegionOnly
137 * - when set, only include the selected region in the view,
138 * otherwise just mark the selected region on the constructed view.
139 * @param recordGroups
140 * - when set, any groups on the given alignment will be marked on
143 public AlignmentView(AlignmentI alignment,
144 ColumnSelection columnSelection, SequenceGroup selection,
145 boolean hasHiddenColumns, boolean selectedRegionOnly,
146 boolean recordGroups)
148 // refactored from AlignViewport.getAlignmentView(selectedOnly);
149 this(new jalview.datamodel.CigarArray(alignment,
150 (hasHiddenColumns ? columnSelection : null),
151 (selectedRegionOnly ? selection : null)),
152 (selectedRegionOnly && selection != null) ? selection
154 isNa = alignment.isNucleotide();
155 // walk down SeqCigar array and Alignment Array - optionally restricted by
157 // test group membership for each sequence in each group, store membership
158 // and record non-empty groups in group list.
159 // record / sub-select selected region on the alignment view
161 if (selection != null && selection.getSize() > 0)
163 List<SequenceI> sel = selection.getSequences(null);
164 this.selected = new ScGroup();
166 .getSequencesInOrder(alignment, selectedRegionOnly);
170 selseqs = alignment.getSequencesArray();
173 List<List<SequenceI>> seqsets = new ArrayList<List<SequenceI>>();
174 // get the alignment's group list and make a copy
175 List<SequenceGroup> grps = new ArrayList<SequenceGroup>();
176 List<SequenceGroup> gg = alignment.getGroups();
178 ScGroup[] sgrps = null;
179 boolean addedgps[] = null;
182 if (selection != null && selectedRegionOnly)
184 // trim annotation to the region being stored.
185 // strip out any groups that do not actually intersect with the
186 // visible and selected region
187 int ssel = selection.getStartRes(), esel = selection.getEndRes();
188 List<SequenceGroup> isg = new ArrayList<SequenceGroup>();
189 for (SequenceGroup sg : grps)
191 if (!(sg.getStartRes() > esel || sg.getEndRes() < ssel))
193 // adjust bounds of new group, if necessary.
194 if (sg.getStartRes() < ssel)
196 sg.setStartRes(ssel);
198 if (sg.getEndRes() > esel)
202 sg.setStartRes(sg.getStartRes() - ssel + 1);
203 sg.setEndRes(sg.getEndRes() - ssel + 1);
211 sgrps = new ScGroup[grps.size()];
212 addedgps = new boolean[grps.size()];
213 for (int g = 0; g < sgrps.length; g++)
215 SequenceGroup sg = grps.get(g);
216 sgrps[g] = new ScGroup();
217 sgrps[g].sg = new SequenceGroup(sg);
219 // can't set entry 0 in an empty list
220 // seqsets.set(g, sg.getSequences(null));
221 seqsets.add(sg.getSequences());
223 // seqsets now contains vectors (should be sets) for each group, so we can
224 // track when we've done with the group
227 for (int i = 0; i < selseqs.length; i++)
229 if (selseqs[i] != null)
231 if (selection != null && selection.getSize() > 0
232 && !selectedRegionOnly)
234 selected.add(sequences[csi]);
238 for (int sg = 0; sg < sgrps.length; sg++)
240 if ((seqsets.get(sg)).contains(selseqs[i]))
242 sgrps[sg].sg.deleteSequence(selseqs[i], false);
243 sgrps[sg].add(sequences[csi]);
246 if (scGroups == null)
248 scGroups = new ArrayList<ScGroup>();
251 scGroups.add(sgrps[sg]);
259 // finally, delete the remaining sequences (if any) not selected
260 for (int sg = 0; sg < sgrps.length; sg++)
262 SequenceI[] sqs = sgrps[sg].sg.getSequencesAsArray(null);
263 for (int si = 0; si < sqs.length; si++)
265 sgrps[sg].sg.deleteSequence(sqs[si], false);
272 * construct an alignmentView from a SeqCigarArray. Errors are thrown if the
273 * seqcigararray.isSeqCigarArray() flag is not set.
275 public AlignmentView(CigarArray seqcigararray)
277 if (!seqcigararray.isSeqCigarArray())
280 "Implementation Error - can only make an alignment view from a CigarArray of sequences.");
282 // contigs = seqcigararray.applyDeletions();
283 contigs = seqcigararray.getDeletedRegions();
284 sequences = seqcigararray.getSeqCigarArray();
285 width = seqcigararray.getWidth(); // visible width
289 * Create an alignmentView where the first column corresponds with the
290 * 'firstcol' column of some reference alignment
295 public AlignmentView(CigarArray sdata, int firstcol)
301 public void setSequences(SeqCigar[] sequences)
303 this.sequences = sequences;
306 public void setContigs(int[] contigs)
308 this.contigs = contigs;
311 public SeqCigar[] getSequences()
317 * @see CigarArray.getDeletedRegions
318 * @return int[] { vis_start, sym_start, length }
320 public int[] getContigs()
326 * get the full alignment and a columnselection object marking the hidden
329 * @param gapCharacter
331 * @return Object[] { SequenceI[], ColumnSelection}
333 public Object[] getAlignmentAndColumnSelection(char gapCharacter)
335 ColumnSelection colsel = new ColumnSelection();
337 return new Object[] {
338 SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel,
343 * return the visible alignment corresponding to this view. Sequences in this
344 * alignment are edited versions of the parent sequences - where hidden
345 * regions have been removed. NOTE: the sequence data in this alignment is not
351 public AlignmentI getVisibleAlignment(char c)
353 SequenceI[] aln = getVisibleSeqs(c);
355 AlignmentI vcal = new Alignment(aln);
356 addPrunedGroupsInOrder(vcal, -1, -1, true);
361 * add groups from view to the given alignment
367 * -1 or gstart to width-1
369 * - true if vcal is alignment of the visible regions of the view
370 * (e.g. as returned from getVisibleAlignment)
372 private void addPrunedGroupsInOrder(AlignmentI vcal, int gstart,
373 int gend, boolean viscontigs)
376 if (gstart > -1 && gstart <= gend)
381 SequenceI[] aln = vcal.getSequencesArray();
384 * prune any groups to the visible coordinates of the alignment.
387 int nvg = (scGroups != null) ? scGroups.size() : 0;
390 SequenceGroup[] nsg = new SequenceGroup[nvg];
391 for (int g = 0; g < nvg; g++)
393 SequenceGroup sg = scGroups.get(g).sg;
396 if (sg.getStartRes() > gend || sg.getEndRes() < gstart)
404 // clone group properties
405 nsg[g] = new SequenceGroup(sg);
407 // may need to shift/trim start and end ?
408 if (r && !viscontigs)
410 // Not fully tested code - routine not yet called with
412 if (nsg[g].getStartRes() < gstart)
414 nsg[g].setStartRes(0);
418 nsg[g].setStartRes(nsg[g].getStartRes() - gstart);
419 nsg[g].setEndRes(nsg[g].getEndRes() - gstart);
421 if (nsg[g].getEndRes() > (gend - gstart))
423 nsg[g].setEndRes(gend - gstart);
429 // prune groups to cover just the visible positions between
434 ShiftList prune = new ShiftList();
437 // adjust for start of alignment within visible window.
438 prune.addShift(gstart, -gstart); //
440 for (int h = 0; h < contigs.length; h += 3)
443 prune.addShift(p + contigs[h + 1], contigs[h + 2]
446 p = contigs[h + 1] + contigs[h + 2];
448 for (int g = 0; g < nsg.length; g++)
452 int s = nsg[g].getStartRes(), t = nsg[g].getEndRes();
467 nsg[g].setStartRes(s);
474 for (int nsq = 0; nsq < aln.length; nsq++)
476 for (int g = 0; g < nvg; g++)
479 && sequences[nsq].isMemberOf(scGroups.get(g)))
481 nsg[g].addSequence(aln[nsq], false);
485 for (int g = 0; g < nvg; g++)
487 if (nsg[g] != null && nsg[g].getSize() > 0)
489 vcal.addGroup(nsg[g]);
499 * generate sequence array corresponding to the visible parts of the
503 * gap character to use to recreate the alignment
506 private SequenceI[] getVisibleSeqs(char c)
508 SequenceI[] aln = new SequenceI[sequences.length];
509 for (int i = 0, j = sequences.length; i < j; i++)
511 aln[i] = sequences[i].getSeq(c);
512 // Remove hidden regions from sequence
513 aln[i].setSequence(getASequenceString(c, i));
519 * creates new alignment objects for all contiguous visible segments
524 * @param regionOfInterest
525 * specify which sequences to include (or null to include all
527 * @return AlignmentI[] - all alignments where each sequence is a subsequence
528 * constructed from visible contig regions of view
530 public AlignmentI[] getVisibleContigAlignments(char c)
533 int[] vcontigs = getVisibleContigs();
534 SequenceI[][] contigviews = getVisibleContigs(c);
535 AlignmentI[] vcals = new AlignmentI[contigviews.length];
536 for (nvc = 0; nvc < contigviews.length; nvc++)
538 vcals[nvc] = new Alignment(contigviews[nvc]);
539 if (scGroups != null && scGroups.size() > 0)
541 addPrunedGroupsInOrder(vcals[nvc], vcontigs[nvc * 2],
542 vcontigs[nvc * 2 + 1], true);
549 * build a string excluding hidden regions from a particular sequence in the
556 private String getASequenceString(char c, int n)
559 String fullseq = sequences[n].getSequenceString(c);
564 for (int h = 0; h < contigs.length; h += 3)
566 sqn += fullseq.substring(p, contigs[h + 1]);
567 p = contigs[h + 1] + contigs[h + 2];
569 sqn += fullseq.substring(p);
579 * get an array of visible sequence strings for a view on an alignment using
580 * the given gap character uses getASequenceString
586 public String[] getSequenceStrings(char c)
588 String[] seqs = new String[sequences.length];
589 for (int n = 0; n < sequences.length; n++)
591 seqs[n] = getASequenceString(c, n);
598 * @return visible number of columns in alignment view
600 public int getWidth()
605 protected void setWidth(int width)
611 * get the contiguous subalignments in an alignment view.
613 * @param gapCharacter
615 * @return SequenceI[][]
617 public SequenceI[][] getVisibleContigs(char gapCharacter)
621 if (sequences == null || width <= 0)
625 if (contigs != null && contigs.length > 0)
630 for (int contig = 0; contig < contigs.length; contig += 3)
632 if ((contigs[contig + 1] - start) > 0)
636 fwidth += contigs[contig + 2]; // end up with full region width
637 // (including hidden regions)
638 start = contigs[contig + 1] + contigs[contig + 2];
644 smsa = new SequenceI[njobs][];
647 for (int contig = 0; contig < contigs.length; contig += 3)
649 if (contigs[contig + 1] - start > 0)
651 SequenceI mseq[] = new SequenceI[sequences.length];
652 for (int s = 0; s < mseq.length; s++)
654 mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(
655 start, contigs[contig + 1]);
660 start = contigs[contig + 1] + contigs[contig + 2];
664 SequenceI mseq[] = new SequenceI[sequences.length];
665 for (int s = 0; s < mseq.length; s++)
667 mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start,
676 smsa = new SequenceI[1][];
677 smsa[0] = new SequenceI[sequences.length];
678 for (int s = 0; s < sequences.length; s++)
680 smsa[0][s] = sequences[s].getSeq(gapCharacter);
687 * return full msa and hidden regions with visible blocks replaced with new
693 * AlignmentOrder[] corresponding to each SequenceI[] block.
696 public Object[] getUpdatedView(SequenceI[][] nvismsa,
697 AlignmentOrder[] orders, char gapCharacter)
699 if (sequences == null || width <= 0)
703 .getString("error.empty_view_cannot_be_updated"));
708 "nvismsa==null. use getAlignmentAndColumnSelection() instead.");
710 if (contigs != null && contigs.length > 0)
712 SequenceI[] alignment = new SequenceI[sequences.length];
713 ColumnSelection columnselection = new ColumnSelection();
714 if (contigs != null && contigs.length > 0)
720 for (int contig = 0; contig < contigs.length; contig += 3)
722 owidth += contigs[contig + 2]; // recover final column width
723 if (contigs[contig + 1] - start > 0)
725 int swidth = 0; // subalignment width
726 if (nvismsa[j] != null)
728 SequenceI mseq[] = nvismsa[j];
729 AlignmentOrder order = (orders == null) ? null : orders[j];
731 if (mseq.length != sequences.length)
736 "error.mismatch_between_number_of_sequences_in_block",
738 Integer.valueOf(j).toString(),
739 Integer.valueOf(mseq.length)
745 swidth = mseq[0].getLength(); // JBPNote: could ensure padded
747 for (int s = 0; s < mseq.length; s++)
749 if (alignment[s] == null)
751 alignment[s] = mseq[s];
755 alignment[s].setSequence(alignment[s]
756 .getSequenceAsString()
757 + mseq[s].getSequenceAsString());
758 if (mseq[s].getStart() <= mseq[s].getEnd())
760 alignment[s].setEnd(mseq[s].getEnd());
764 order.updateSequence(mseq[s], alignment[s]);
771 // recover original alignment block or place gaps
774 // recover input data
775 for (int s = 0; s < sequences.length; s++)
777 SequenceI oseq = sequences[s].getSeq(gapCharacter)
778 .getSubSequence(start, contigs[contig + 1]);
779 if (swidth < oseq.getLength())
781 swidth = oseq.getLength();
783 if (alignment[s] == null)
789 alignment[s].setSequence(alignment[s]
790 .getSequenceAsString()
791 + oseq.getSequenceAsString());
792 if (oseq.getEnd() >= oseq.getStart())
794 alignment[s].setEnd(oseq.getEnd());
804 // advance to begining of visible region
805 start = contigs[contig + 1] + contigs[contig + 2];
806 // add hidden segment to right of next region
807 for (int s = 0; s < sequences.length; s++)
809 SequenceI hseq = sequences[s].getSeq(gapCharacter)
810 .getSubSequence(contigs[contig + 1], start);
811 if (alignment[s] == null)
817 alignment[s].setSequence(alignment[s].getSequenceAsString()
818 + hseq.getSequenceAsString());
819 if (hseq.getEnd() >= hseq.getStart())
821 alignment[s].setEnd(hseq.getEnd());
825 // mark hidden segment as hidden in the new alignment
826 columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2]
828 nwidth += contigs[contig + 2];
830 // Do final segment - if it exists
831 if (j < nvismsa.length)
834 if (nvismsa[j] != null)
836 SequenceI mseq[] = nvismsa[j];
837 AlignmentOrder order = (orders != null) ? orders[j] : null;
838 swidth = mseq[0].getLength();
839 for (int s = 0; s < mseq.length; s++)
841 if (alignment[s] == null)
843 alignment[s] = mseq[s];
847 alignment[s].setSequence(alignment[s].getSequenceAsString()
848 + mseq[s].getSequenceAsString());
849 if (mseq[s].getEnd() >= mseq[s].getStart())
851 alignment[s].setEnd(mseq[s].getEnd());
855 order.updateSequence(mseq[s], alignment[s]);
864 // recover input data or place gaps
867 // recover input data
868 for (int s = 0; s < sequences.length; s++)
870 SequenceI oseq = sequences[s].getSeq(gapCharacter)
871 .getSubSequence(start, owidth + 1);
872 if (swidth < oseq.getLength())
874 swidth = oseq.getLength();
876 if (alignment[s] == null)
882 alignment[s].setSequence(alignment[s]
883 .getSequenceAsString()
884 + oseq.getSequenceAsString());
885 if (oseq.getEnd() >= oseq.getStart())
887 alignment[s].setEnd(oseq.getEnd());
898 .getString("error.padding_not_yet_implemented"));
904 return new Object[] { alignment, columnselection };
908 if (nvismsa.length != 1)
913 "error.mismatch_between_visible_blocks_to_update_and_number_of_contigs_in_view",
914 new String[] { Integer.valueOf(
915 nvismsa.length).toString() }));
917 if (nvismsa[0] != null)
919 return new Object[] { nvismsa[0], new ColumnSelection() };
923 return getAlignmentAndColumnSelection(gapCharacter);
929 * returns simple array of start end positions of visible range on alignment.
930 * vis_start and vis_end are inclusive - use
931 * SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence
932 * from underlying alignment.
934 * @return int[] { start_i, end_i } for 1<i<n visible regions.
936 public int[] getVisibleContigs()
938 if (contigs != null && contigs.length > 0)
943 for (int contig = 0; contig < contigs.length; contig += 3)
945 if ((contigs[contig + 1] - start) > 0)
949 fwidth += contigs[contig + 2]; // end up with full region width
950 // (including hidden regions)
951 start = contigs[contig + 1] + contigs[contig + 2];
957 int viscontigs[] = new int[nvis * 2];
960 for (int contig = 0; contig < contigs.length; contig += 3)
962 if ((contigs[contig + 1] - start) > 0)
964 viscontigs[nvis] = start;
965 viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive
968 start = contigs[contig + 1] + contigs[contig + 2];
972 viscontigs[nvis] = start;
973 viscontigs[nvis + 1] = fwidth; // end is inclusive
980 return new int[] { 0, width };
986 * @return position of first visible column of AlignmentView within its
987 * parent's alignment reference frame
989 public int getAlignmentOrigin()
995 * compute a deletion map for the current view according to the given
999 * (as returned from SequenceI.gapMap())
1000 * @return int[] {intersection of visible regions with gapMap)
1002 public int[] getVisibleContigMapFor(int[] gapMap)
1004 int[] delMap = null;
1005 int[] viscontigs = getVisibleContigs();
1008 if (viscontigs != null)
1010 // viscontigs maps from a subset of the gapMap to the gapMap, so it will
1011 // always be equal to or shorter than gapMap
1012 delMap = new int[gapMap.length];
1013 for (int contig = 0; contig < viscontigs.length; contig += 2)
1016 while (spos < gapMap.length && gapMap[spos] < viscontigs[contig])
1020 while (spos < gapMap.length
1021 && gapMap[spos] <= viscontigs[contig + 1])
1023 delMap[i++] = spos++;
1026 int tmap[] = new int[i];
1027 System.arraycopy(delMap, 0, tmap, 0, i);
1034 * apply the getSeq(gc) method to each sequence cigar, and return the array of
1035 * edited sequences, optionally with hidden regions removed.
1038 * gap character to use for insertions
1040 * remove hidden regions from sequences. Note: currently implemented
1041 * in a memory inefficient way - space needed is 2*result set for
1044 * @return SequenceI[]
1046 public SequenceI[] getEditedSequences(char gc, boolean delete)
1048 SeqCigar[] msf = getSequences();
1049 SequenceI[] aln = new SequenceI[msf.length];
1050 for (int i = 0, j = msf.length; i < j; i++)
1052 aln[i] = msf[i].getSeq(gc);
1056 String[] sqs = getSequenceStrings(gc);
1057 for (int i = 0; i < sqs.length; i++)
1059 aln[i].setSequence(sqs[i]);
1066 public static void summariseAlignmentView(AlignmentView view,
1069 os.print("View has " + view.sequences.length + " of which ");
1070 if (view.selected == null)
1076 os.print(" " + view.selected.size());
1078 os.println(" are selected.");
1079 os.print("View is " + view.getWidth() + " columns wide");
1081 int[] contigs = view.getContigs();
1082 if (contigs != null)
1084 viswid = view.width;
1085 for (int i = 0; i < contigs.length; i += 3)
1087 viswid += contigs[i + 2];
1089 os.println("with " + viswid + " visible columns spread over "
1090 + contigs.length / 3 + " regions.");
1094 viswid = view.width;
1097 if (view.scGroups != null)
1099 os.println("There are " + view.scGroups.size()
1100 + " groups defined on the view.");
1101 for (int g = 0; g < view.scGroups.size(); g++)
1103 ScGroup sgr = view.scGroups.get(g);
1104 os.println("Group " + g + ": Name = " + sgr.sg.getName()
1105 + " Contains " + sgr.seqs.size() + " Seqs.");
1106 os.println("This group runs from " + sgr.sg.getStartRes() + " to "
1107 + sgr.sg.getEndRes());
1108 for (int s = 0; s < sgr.seqs.size(); s++)
1110 // JBPnote this should be a unit test for ScGroup
1111 if (!sgr.seqs.get(s).isMemberOf(sgr))
1113 os.println("** WARNING: sequence " + sgr.seqs.get(s).toString()
1114 + " is not marked as member of group.");
1118 AlignmentI visal = view.getVisibleAlignment('-');
1121 os.println("Vis. alignment is " + visal.getWidth()
1122 + " wide and has " + visal.getHeight() + " seqs.");
1123 if (visal.getGroups() != null && visal.getGroups().size() > 0)
1127 for (SequenceGroup sg : visal.getGroups())
1129 os.println("Group " + (i++) + " begins at column "
1130 + sg.getStartRes() + " and ends at " + sg.getEndRes());
1137 public static void testSelectionViews(AlignmentI alignment,
1138 ColumnSelection csel, SequenceGroup selection)
1140 System.out.println("Testing standard view creation:\n");
1141 AlignmentView view = null;
1145 .println("View with no hidden columns, no limit to selection, no groups to be collected:");
1146 view = new AlignmentView(alignment, csel, selection, false, false,
1148 summariseAlignmentView(view, System.out);
1150 } catch (Exception e)
1152 e.printStackTrace();
1154 .println("Failed to generate alignment with selection but no groups marked.");
1159 .println("View with no hidden columns, no limit to selection, and all groups to be collected:");
1160 view = new AlignmentView(alignment, csel, selection, false, false,
1162 summariseAlignmentView(view, System.out);
1163 } catch (Exception e)
1165 e.printStackTrace();
1167 .println("Failed to generate alignment with selection marked but no groups marked.");
1172 .println("View with no hidden columns, limited to selection and no groups to be collected:");
1173 view = new AlignmentView(alignment, csel, selection, false, true,
1175 summariseAlignmentView(view, System.out);
1176 } catch (Exception e)
1178 e.printStackTrace();
1180 .println("Failed to generate alignment with selection restricted but no groups marked.");
1185 .println("View with no hidden columns, limited to selection, and all groups to be collected:");
1186 view = new AlignmentView(alignment, csel, selection, false, true,
1188 summariseAlignmentView(view, System.out);
1189 } catch (Exception e)
1191 e.printStackTrace();
1193 .println("Failed to generate alignment with selection restricted and groups marked.");
1198 .println("View *with* hidden columns, no limit to selection, no groups to be collected:");
1199 view = new AlignmentView(alignment, csel, selection, true, false,
1201 summariseAlignmentView(view, System.out);
1202 } catch (Exception e)
1204 e.printStackTrace();
1206 .println("Failed to generate alignment with selection but no groups marked.");
1211 .println("View *with* hidden columns, no limit to selection, and all groups to be collected:");
1212 view = new AlignmentView(alignment, csel, selection, true, false,
1214 summariseAlignmentView(view, System.out);
1215 } catch (Exception e)
1217 e.printStackTrace();
1219 .println("Failed to generate alignment with selection marked but no groups marked.");
1224 .println("View *with* hidden columns, limited to selection and no groups to be collected:");
1225 view = new AlignmentView(alignment, csel, selection, true, true,
1227 summariseAlignmentView(view, System.out);
1228 } catch (Exception e)
1230 e.printStackTrace();
1232 .println("Failed to generate alignment with selection restricted but no groups marked.");
1237 .println("View *with* hidden columns, limited to selection, and all groups to be collected:");
1238 view = new AlignmentView(alignment, csel, selection, true, true, true);
1239 summariseAlignmentView(view, System.out);
1240 } catch (Exception e)
1242 e.printStackTrace();
1244 .println("Failed to generate alignment with selection restricted and groups marked.");