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, HiddenColumns hidden,
144 SequenceGroup selection, boolean hasHiddenColumns,
145 boolean selectedRegionOnly, boolean recordGroups)
147 // refactored from AlignViewport.getAlignmentView(selectedOnly);
148 this(new jalview.datamodel.CigarArray(alignment,
149 (hasHiddenColumns ? hidden : null),
150 (selectedRegionOnly ? selection : null)),
151 (selectedRegionOnly && selection != null)
152 ? selection.getStartRes()
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();
165 selseqs = selection.getSequencesInOrder(alignment,
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[] getAlignmentAndHiddenColumns(char gapCharacter)
335 HiddenColumns hidden = new HiddenColumns();
337 return new Object[] { SeqCigar.createAlignmentSequences(sequences,
338 gapCharacter, hidden, contigs),
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, int gend,
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],
444 contigs[h + 2] - contigs[h + 1]);
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)
655 .getSubSequence(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)
701 throw new Error(MessageManager
702 .getString("error.empty_view_cannot_be_updated"));
707 "nvismsa==null. use getAlignmentAndColumnSelection() instead.");
709 if (contigs != null && contigs.length > 0)
711 SequenceI[] alignment = new SequenceI[sequences.length];
712 // ColumnSelection columnselection = new ColumnSelection();
713 HiddenColumns hidden = new HiddenColumns();
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)
733 throw new Error(MessageManager.formatMessage(
734 "error.mismatch_between_number_of_sequences_in_block",
736 { Integer.valueOf(j).toString(),
737 Integer.valueOf(mseq.length).toString(),
738 Integer.valueOf(sequences.length)
741 swidth = mseq[0].getLength(); // JBPNote: could ensure padded
743 for (int s = 0; s < mseq.length; s++)
745 if (alignment[s] == null)
747 alignment[s] = mseq[s];
752 .setSequence(alignment[s].getSequenceAsString()
753 + mseq[s].getSequenceAsString());
754 if (mseq[s].getStart() <= mseq[s].getEnd())
756 alignment[s].setEnd(mseq[s].getEnd());
760 order.updateSequence(mseq[s], alignment[s]);
767 // recover original alignment block or place gaps
770 // recover input data
771 for (int s = 0; s < sequences.length; s++)
773 SequenceI oseq = sequences[s].getSeq(gapCharacter)
774 .getSubSequence(start, contigs[contig + 1]);
775 if (swidth < oseq.getLength())
777 swidth = oseq.getLength();
779 if (alignment[s] == null)
786 .setSequence(alignment[s].getSequenceAsString()
787 + oseq.getSequenceAsString());
788 if (oseq.getEnd() >= oseq.getStart())
790 alignment[s].setEnd(oseq.getEnd());
800 // advance to begining of visible region
801 start = contigs[contig + 1] + contigs[contig + 2];
802 // add hidden segment to right of next region
803 for (int s = 0; s < sequences.length; s++)
805 SequenceI hseq = sequences[s].getSeq(gapCharacter)
806 .getSubSequence(contigs[contig + 1], start);
807 if (alignment[s] == null)
813 alignment[s].setSequence(alignment[s].getSequenceAsString()
814 + hseq.getSequenceAsString());
815 if (hseq.getEnd() >= hseq.getStart())
817 alignment[s].setEnd(hseq.getEnd());
821 // mark hidden segment as hidden in the new alignment
822 hidden.hideColumns(nwidth, nwidth + contigs[contig + 2] - 1);
823 nwidth += contigs[contig + 2];
825 // Do final segment - if it exists
826 if (j < nvismsa.length)
829 if (nvismsa[j] != null)
831 SequenceI mseq[] = nvismsa[j];
832 AlignmentOrder order = (orders != null) ? orders[j] : null;
833 swidth = mseq[0].getLength();
834 for (int s = 0; s < mseq.length; s++)
836 if (alignment[s] == null)
838 alignment[s] = mseq[s];
842 alignment[s].setSequence(alignment[s].getSequenceAsString()
843 + mseq[s].getSequenceAsString());
844 if (mseq[s].getEnd() >= mseq[s].getStart())
846 alignment[s].setEnd(mseq[s].getEnd());
850 order.updateSequence(mseq[s], alignment[s]);
859 // recover input data or place gaps
862 // recover input data
863 for (int s = 0; s < sequences.length; s++)
865 SequenceI oseq = sequences[s].getSeq(gapCharacter)
866 .getSubSequence(start, owidth + 1);
867 if (swidth < oseq.getLength())
869 swidth = oseq.getLength();
871 if (alignment[s] == null)
878 .setSequence(alignment[s].getSequenceAsString()
879 + oseq.getSequenceAsString());
880 if (oseq.getEnd() >= oseq.getStart())
882 alignment[s].setEnd(oseq.getEnd());
891 throw new Error(MessageManager
892 .getString("error.padding_not_yet_implemented"));
898 return new Object[] { alignment, hidden };
902 if (nvismsa.length != 1)
904 throw new Error(MessageManager.formatMessage(
905 "error.mismatch_between_visible_blocks_to_update_and_number_of_contigs_in_view",
907 { Integer.valueOf(nvismsa.length).toString() }));
909 if (nvismsa[0] != null)
911 return new Object[] { nvismsa[0], new HiddenColumns() };
915 return getAlignmentAndHiddenColumns(gapCharacter);
921 * returns simple array of start end positions of visible range on alignment.
922 * vis_start and vis_end are inclusive - use
923 * SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence
924 * from underlying alignment.
926 * @return int[] { start_i, end_i } for 1<i<n visible regions.
928 public int[] getVisibleContigs()
930 if (contigs != null && contigs.length > 0)
935 for (int contig = 0; contig < contigs.length; contig += 3)
937 if ((contigs[contig + 1] - start) > 0)
941 fwidth += contigs[contig + 2]; // end up with full region width
942 // (including hidden regions)
943 start = contigs[contig + 1] + contigs[contig + 2];
949 int viscontigs[] = new int[nvis * 2];
952 for (int contig = 0; contig < contigs.length; contig += 3)
954 if ((contigs[contig + 1] - start) > 0)
956 viscontigs[nvis] = start;
957 viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive
960 start = contigs[contig + 1] + contigs[contig + 2];
964 viscontigs[nvis] = start;
965 viscontigs[nvis + 1] = fwidth - 1; // end is inclusive
972 return new int[] { 0, width - 1 };
978 * @return position of first visible column of AlignmentView within its
979 * parent's alignment reference frame
981 public int getAlignmentOrigin()
987 * compute a deletion map for the current view according to the given
991 * (as returned from SequenceI.gapMap())
992 * @return int[] {intersection of visible regions with gapMap)
994 public int[] getVisibleContigMapFor(int[] gapMap)
997 int[] viscontigs = getVisibleContigs();
1000 if (viscontigs != null)
1002 // viscontigs maps from a subset of the gapMap to the gapMap, so it will
1003 // always be equal to or shorter than gapMap
1004 delMap = new int[gapMap.length];
1005 for (int contig = 0; contig < viscontigs.length; contig += 2)
1008 while (spos < gapMap.length && gapMap[spos] < viscontigs[contig])
1012 while (spos < gapMap.length
1013 && gapMap[spos] <= viscontigs[contig + 1])
1015 delMap[i++] = spos++;
1018 int tmap[] = new int[i];
1019 System.arraycopy(delMap, 0, tmap, 0, i);
1026 * apply the getSeq(gc) method to each sequence cigar, and return the array of
1027 * edited sequences, optionally with hidden regions removed.
1030 * gap character to use for insertions
1032 * remove hidden regions from sequences. Note: currently implemented
1033 * in a memory inefficient way - space needed is 2*result set for
1036 * @return SequenceI[]
1038 public SequenceI[] getEditedSequences(char gc, boolean delete)
1040 SeqCigar[] msf = getSequences();
1041 SequenceI[] aln = new SequenceI[msf.length];
1042 for (int i = 0, j = msf.length; i < j; i++)
1044 aln[i] = msf[i].getSeq(gc);
1048 String[] sqs = getSequenceStrings(gc);
1049 for (int i = 0; i < sqs.length; i++)
1051 aln[i].setSequence(sqs[i]);
1058 public static void summariseAlignmentView(AlignmentView view,
1061 os.print("View has " + view.sequences.length + " of which ");
1062 if (view.selected == null)
1068 os.print(" " + view.selected.size());
1070 os.println(" are selected.");
1071 os.print("View is " + view.getWidth() + " columns wide");
1073 int[] contigs = view.getContigs();
1074 if (contigs != null)
1076 viswid = view.width;
1077 for (int i = 0; i < contigs.length; i += 3)
1079 viswid += contigs[i + 2];
1081 os.println("with " + viswid + " visible columns spread over "
1082 + contigs.length / 3 + " regions.");
1086 viswid = view.width;
1089 if (view.scGroups != null)
1091 os.println("There are " + view.scGroups.size()
1092 + " groups defined on the view.");
1093 for (int g = 0; g < view.scGroups.size(); g++)
1095 ScGroup sgr = view.scGroups.get(g);
1096 os.println("Group " + g + ": Name = " + sgr.sg.getName()
1097 + " Contains " + sgr.seqs.size() + " Seqs.");
1098 os.println("This group runs from " + sgr.sg.getStartRes() + " to "
1099 + sgr.sg.getEndRes());
1100 for (int s = 0; s < sgr.seqs.size(); s++)
1102 // JBPnote this should be a unit test for ScGroup
1103 if (!sgr.seqs.get(s).isMemberOf(sgr))
1105 os.println("** WARNING: sequence " + sgr.seqs.get(s).toString()
1106 + " is not marked as member of group.");
1110 AlignmentI visal = view.getVisibleAlignment('-');
1113 os.println("Vis. alignment is " + visal.getWidth()
1114 + " wide and has " + visal.getHeight() + " seqs.");
1115 if (visal.getGroups() != null && visal.getGroups().size() > 0)
1119 for (SequenceGroup sg : visal.getGroups())
1121 os.println("Group " + (i++) + " begins at column "
1122 + sg.getStartRes() + " and ends at " + sg.getEndRes());
1129 public static void testSelectionViews(AlignmentI alignment,
1130 HiddenColumns hidden, SequenceGroup selection)
1132 System.out.println("Testing standard view creation:\n");
1133 AlignmentView view = null;
1137 "View with no hidden columns, no limit to selection, no groups to be collected:");
1138 view = new AlignmentView(alignment, hidden, selection, false, false,
1140 summariseAlignmentView(view, System.out);
1142 } catch (Exception e)
1144 e.printStackTrace();
1146 "Failed to generate alignment with selection but no groups marked.");
1151 "View with no hidden columns, no limit to selection, and all groups to be collected:");
1152 view = new AlignmentView(alignment, hidden, selection, false, false,
1154 summariseAlignmentView(view, System.out);
1155 } catch (Exception e)
1157 e.printStackTrace();
1159 "Failed to generate alignment with selection marked but no groups marked.");
1164 "View with no hidden columns, limited to selection and no groups to be collected:");
1165 view = new AlignmentView(alignment, hidden, selection, false, true,
1167 summariseAlignmentView(view, System.out);
1168 } catch (Exception e)
1170 e.printStackTrace();
1172 "Failed to generate alignment with selection restricted but no groups marked.");
1177 "View with no hidden columns, limited to selection, and all groups to be collected:");
1178 view = new AlignmentView(alignment, hidden, selection, false, true,
1180 summariseAlignmentView(view, System.out);
1181 } catch (Exception e)
1183 e.printStackTrace();
1185 "Failed to generate alignment with selection restricted and groups marked.");
1190 "View *with* hidden columns, no limit to selection, no groups to be collected:");
1191 view = new AlignmentView(alignment, hidden, selection, true, false,
1193 summariseAlignmentView(view, System.out);
1194 } catch (Exception e)
1196 e.printStackTrace();
1198 "Failed to generate alignment with selection but no groups marked.");
1203 "View *with* hidden columns, no limit to selection, and all groups to be collected:");
1204 view = new AlignmentView(alignment, hidden, selection, true, false,
1206 summariseAlignmentView(view, System.out);
1207 } catch (Exception e)
1209 e.printStackTrace();
1211 "Failed to generate alignment with selection marked but no groups marked.");
1216 "View *with* hidden columns, limited to selection and no groups to be collected:");
1217 view = new AlignmentView(alignment, hidden, selection, true, true,
1219 summariseAlignmentView(view, System.out);
1220 } catch (Exception e)
1222 e.printStackTrace();
1224 "Failed to generate alignment with selection restricted but no groups marked.");
1229 "View *with* hidden columns, limited to selection, and all groups to be collected:");
1230 view = new AlignmentView(alignment, hidden, selection, true, true,
1232 summariseAlignmentView(view, System.out);
1233 } catch (Exception e)
1235 e.printStackTrace();
1237 "Failed to generate alignment with selection restricted and groups marked.");