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 * reference to the complementary CDS/Protein alignment for this alignment, if available
56 private AlignmentView complementView=null;
60 * @param complementView
62 public void setComplement(AlignmentView complementView)
64 this.complementView = complementView;
69 * @return true if a complement is available
71 public boolean hasComplementView()
73 return complementView!=null;
77 * @return the complement view or null
79 public AlignmentView getComplementView()
81 return complementView;
85 * false if the view concerns peptides
95 * Group defined over SeqCigars. Unlike AlignmentI associated groups, each
96 * SequenceGroup hold just the essential properties for the group, but no
97 * references to the sequences involved. SeqCigars hold references to the
98 * seuqenceGroup entities themselves.
100 private class ScGroup
102 public List<SeqCigar> seqs;
104 public SequenceGroup sg;
108 seqs = new ArrayList<>();
113 * @return true if seq was not a member before and was added to group
115 public boolean add(SeqCigar seq)
117 if (!seq.isMemberOf(this))
120 seq.setGroupMembership(this);
132 * @return true if seq was a member and was removed from group
134 public boolean remove(SeqCigar seq)
136 if (seq.removeGroupMembership(this))
151 * vector of selected seqCigars. This vector is also referenced by each
152 * seqCigar contained in it.
154 private ScGroup selected;
157 * Construct an alignmentView from a live jalview alignment view. Note -
158 * hidden rows will be excluded from alignmentView Note: JAL-1179
161 * - alignment as referenced by an AlignViewport
162 * @param columnSelection
165 * @param hasHiddenColumns
166 * - mark the hidden columns in columnSelection as hidden in the view
167 * @param selectedRegionOnly
168 * - when set, only include the selected region in the view,
169 * otherwise just mark the selected region on the constructed view.
170 * @param recordGroups
171 * - when set, any groups on the given alignment will be marked on
174 public AlignmentView(AlignmentI alignment, HiddenColumns hidden,
175 SequenceGroup selection, boolean hasHiddenColumns,
176 boolean selectedRegionOnly, boolean recordGroups)
178 // refactored from AlignViewport.getAlignmentView(selectedOnly);
179 this(new jalview.datamodel.CigarArray(alignment,
180 (hasHiddenColumns ? hidden : null),
181 (selectedRegionOnly ? selection : null)),
182 (selectedRegionOnly && selection != null)
183 ? selection.getStartRes()
185 isNa = alignment.isNucleotide();
186 // walk down SeqCigar array and Alignment Array - optionally restricted by
188 // test group membership for each sequence in each group, store membership
189 // and record non-empty groups in group list.
190 // record / sub-select selected region on the alignment view
192 if (selection != null && selection.getSize() > 0)
194 this.selected = new ScGroup();
195 selseqs = selection.getSequencesInOrder(alignment,
200 selseqs = alignment.getSequencesArray();
203 List<List<SequenceI>> seqsets = new ArrayList<>();
204 // get the alignment's group list and make a copy
205 List<SequenceGroup> grps = new ArrayList<>();
206 List<SequenceGroup> gg = alignment.getGroups();
208 ScGroup[] sgrps = null;
209 boolean addedgps[] = null;
212 if (selection != null && selectedRegionOnly)
214 // trim annotation to the region being stored.
215 // strip out any groups that do not actually intersect with the
216 // visible and selected region
217 int ssel = selection.getStartRes(), esel = selection.getEndRes();
218 List<SequenceGroup> isg = new ArrayList<>();
219 for (SequenceGroup sg : grps)
221 if (!(sg.getStartRes() > esel || sg.getEndRes() < ssel))
223 // adjust bounds of new group, if necessary.
224 if (sg.getStartRes() < ssel)
226 sg.setStartRes(ssel);
228 if (sg.getEndRes() > esel)
232 sg.setStartRes(sg.getStartRes() - ssel + 1);
233 sg.setEndRes(sg.getEndRes() - ssel + 1);
241 sgrps = new ScGroup[grps.size()];
242 addedgps = new boolean[grps.size()];
243 for (int g = 0; g < sgrps.length; g++)
245 SequenceGroup sg = grps.get(g);
246 sgrps[g] = new ScGroup();
247 sgrps[g].sg = new SequenceGroup(sg);
249 // can't set entry 0 in an empty list
250 // seqsets.set(g, sg.getSequences(null));
251 seqsets.add(sg.getSequences());
253 // seqsets now contains vectors (should be sets) for each group, so we can
254 // track when we've done with the group
257 for (int i = 0; i < selseqs.length; i++)
259 if (selseqs[i] != null)
261 if (selection != null && selection.getSize() > 0
262 && !selectedRegionOnly)
264 selected.add(sequences[csi]);
268 for (int sg = 0; sg < sgrps.length; sg++)
270 if ((seqsets.get(sg)).contains(selseqs[i]))
272 sgrps[sg].sg.deleteSequence(selseqs[i], false);
273 sgrps[sg].add(sequences[csi]);
276 if (scGroups == null)
278 scGroups = new ArrayList<>();
281 scGroups.add(sgrps[sg]);
289 // finally, delete the remaining sequences (if any) not selected
290 for (int sg = 0; sg < sgrps.length; sg++)
292 SequenceI[] sqs = sgrps[sg].sg.getSequencesAsArray(null);
293 for (int si = 0; si < sqs.length; si++)
295 sgrps[sg].sg.deleteSequence(sqs[si], false);
302 * construct an alignmentView from a SeqCigarArray. Errors are thrown if the
303 * seqcigararray.isSeqCigarArray() flag is not set.
305 public AlignmentView(CigarArray seqcigararray)
307 if (!seqcigararray.isSeqCigarArray())
310 "Implementation Error - can only make an alignment view from a CigarArray of sequences.");
312 // contigs = seqcigararray.applyDeletions();
313 contigs = seqcigararray.getDeletedRegions();
314 sequences = seqcigararray.getSeqCigarArray();
315 width = seqcigararray.getWidth(); // visible width
319 * Create an alignmentView where the first column corresponds with the
320 * 'firstcol' column of some reference alignment
325 public AlignmentView(CigarArray sdata, int firstcol)
331 public void setSequences(SeqCigar[] sequences)
333 this.sequences = sequences;
336 public void setContigs(int[] contigs)
338 this.contigs = contigs;
341 public SeqCigar[] getSequences()
347 * @see CigarArray.getDeletedRegions
348 * @return int[] { vis_start, sym_start, length }
350 public int[] getContigs()
356 * get the full alignment and a columnselection object marking the hidden
359 * @param gapCharacter
361 * @return Object[] { SequenceI[], ColumnSelection}
363 public Object[] getAlignmentAndHiddenColumns(char gapCharacter)
365 HiddenColumns hidden = new HiddenColumns();
367 return new Object[] { SeqCigar.createAlignmentSequences(sequences,
368 gapCharacter, hidden, contigs),
373 * return the visible alignment corresponding to this view. Sequences in this
374 * alignment are edited versions of the parent sequences - where hidden
375 * regions have been removed. NOTE: the sequence data in this alignment is not
381 public AlignmentI getVisibleAlignment(char c)
383 SequenceI[] aln = getVisibleSeqs(c);
385 AlignmentI vcal = new Alignment(aln);
386 addPrunedGroupsInOrder(vcal, -1, -1, true);
391 * add groups from view to the given alignment
397 * -1 or gstart to width-1
399 * - true if vcal is alignment of the visible regions of the view
400 * (e.g. as returned from getVisibleAlignment)
402 private void addPrunedGroupsInOrder(AlignmentI vcal, int gstart, int gend,
406 if (gstart > -1 && gstart <= gend)
411 SequenceI[] aln = vcal.getSequencesArray();
414 * prune any groups to the visible coordinates of the alignment.
417 int nvg = (scGroups != null) ? scGroups.size() : 0;
420 SequenceGroup[] nsg = new SequenceGroup[nvg];
421 for (int g = 0; g < nvg; g++)
423 SequenceGroup sg = scGroups.get(g).sg;
426 if (sg.getStartRes() > gend || sg.getEndRes() < gstart)
434 // clone group properties
435 nsg[g] = new SequenceGroup(sg);
437 // may need to shift/trim start and end ?
438 if (r && !viscontigs)
440 // Not fully tested code - routine not yet called with
442 if (nsg[g].getStartRes() < gstart)
444 nsg[g].setStartRes(0);
448 nsg[g].setStartRes(nsg[g].getStartRes() - gstart);
449 nsg[g].setEndRes(nsg[g].getEndRes() - gstart);
451 if (nsg[g].getEndRes() > (gend - gstart))
453 nsg[g].setEndRes(gend - gstart);
459 // prune groups to cover just the visible positions between
464 ShiftList prune = new ShiftList();
467 // adjust for start of alignment within visible window.
468 prune.addShift(gstart, -gstart); //
470 for (int h = 0; h < contigs.length; h += 3)
473 prune.addShift(p + contigs[h + 1],
474 contigs[h + 2] - contigs[h + 1]);
476 p = contigs[h + 1] + contigs[h + 2];
478 for (int g = 0; g < nsg.length; g++)
482 int s = nsg[g].getStartRes(), t = nsg[g].getEndRes();
497 nsg[g].setStartRes(s);
504 for (int nsq = 0; nsq < aln.length; nsq++)
506 for (int g = 0; g < nvg; g++)
509 && sequences[nsq].isMemberOf(scGroups.get(g)))
511 nsg[g].addSequence(aln[nsq], false);
515 for (int g = 0; g < nvg; g++)
517 if (nsg[g] != null && nsg[g].getSize() > 0)
519 vcal.addGroup(nsg[g]);
529 * generate sequence array corresponding to the visible parts of the
533 * gap character to use to recreate the alignment
536 private SequenceI[] getVisibleSeqs(char c)
538 SequenceI[] aln = new SequenceI[sequences.length];
539 for (int i = 0, j = sequences.length; i < j; i++)
541 aln[i] = sequences[i].getSeq(c);
542 // Remove hidden regions from sequence
543 aln[i].setSequence(getASequenceString(c, i));
549 * creates new alignment objects for all contiguous visible segments
554 * @param regionOfInterest
555 * specify which sequences to include (or null to include all
557 * @return AlignmentI[] - all alignments where each sequence is a subsequence
558 * constructed from visible contig regions of view
560 public AlignmentI[] getVisibleContigAlignments(char c)
563 int[] vcontigs = getVisibleContigs();
564 SequenceI[][] contigviews = getVisibleContigs(c);
565 AlignmentI[] vcals = new AlignmentI[contigviews.length];
566 for (nvc = 0; nvc < contigviews.length; nvc++)
568 vcals[nvc] = new Alignment(contigviews[nvc]);
569 if (scGroups != null && scGroups.size() > 0)
571 addPrunedGroupsInOrder(vcals[nvc], vcontigs[nvc * 2],
572 vcontigs[nvc * 2 + 1], true);
579 * build a string excluding hidden regions from a particular sequence in the
586 private String getASequenceString(char c, int n)
589 String fullseq = sequences[n].getSequenceString(c);
594 for (int h = 0; h < contigs.length; h += 3)
596 sqn += fullseq.substring(p, contigs[h + 1]);
597 p = contigs[h + 1] + contigs[h + 2];
599 sqn += fullseq.substring(p);
609 * get an array of visible sequence strings for a view on an alignment using
610 * the given gap character uses getASequenceString
616 public String[] getSequenceStrings(char c)
618 String[] seqs = new String[sequences.length];
619 for (int n = 0; n < sequences.length; n++)
621 seqs[n] = getASequenceString(c, n);
628 * @return visible number of columns in alignment view
630 public int getWidth()
635 protected void setWidth(int width)
641 * get the contiguous subalignments in an alignment view.
643 * @param gapCharacter
645 * @return SequenceI[][]
647 public SequenceI[][] getVisibleContigs(char gapCharacter)
651 if (sequences == null || width <= 0)
655 if (contigs != null && contigs.length > 0)
660 for (int contig = 0; contig < contigs.length; contig += 3)
662 if ((contigs[contig + 1] - start) > 0)
666 fwidth += contigs[contig + 2]; // end up with full region width
667 // (including hidden regions)
668 start = contigs[contig + 1] + contigs[contig + 2];
674 smsa = new SequenceI[njobs][];
677 for (int contig = 0; contig < contigs.length; contig += 3)
679 if (contigs[contig + 1] - start > 0)
681 SequenceI mseq[] = new SequenceI[sequences.length];
682 for (int s = 0; s < mseq.length; s++)
684 mseq[s] = sequences[s].getSeq(gapCharacter)
685 .getSubSequence(start, contigs[contig + 1]);
690 start = contigs[contig + 1] + contigs[contig + 2];
694 SequenceI mseq[] = new SequenceI[sequences.length];
695 for (int s = 0; s < mseq.length; s++)
697 mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start,
706 smsa = new SequenceI[1][];
707 smsa[0] = new SequenceI[sequences.length];
708 for (int s = 0; s < sequences.length; s++)
710 smsa[0][s] = sequences[s].getSeq(gapCharacter);
717 * return full msa and hidden regions with visible blocks replaced with new
723 * AlignmentOrder[] corresponding to each SequenceI[] block.
726 public Object[] getUpdatedView(SequenceI[][] nvismsa,
727 AlignmentOrder[] orders, char gapCharacter)
729 if (sequences == null || width <= 0)
731 throw new Error(MessageManager
732 .getString("error.empty_view_cannot_be_updated"));
737 "nvismsa==null. use getAlignmentAndColumnSelection() instead.");
739 if (contigs != null && contigs.length > 0)
741 SequenceI[] alignment = new SequenceI[sequences.length];
742 // ColumnSelection columnselection = new ColumnSelection();
743 HiddenColumns hidden = new HiddenColumns();
744 if (contigs != null && contigs.length > 0)
750 for (int contig = 0; contig < contigs.length; contig += 3)
752 owidth += contigs[contig + 2]; // recover final column width
753 if (contigs[contig + 1] - start > 0)
755 int swidth = 0; // subalignment width
756 if (nvismsa[j] != null)
758 SequenceI mseq[] = nvismsa[j];
759 AlignmentOrder order = (orders == null) ? null : orders[j];
761 if (mseq.length != sequences.length)
763 throw new Error(MessageManager.formatMessage(
764 "error.mismatch_between_number_of_sequences_in_block",
766 { Integer.valueOf(j).toString(),
767 Integer.valueOf(mseq.length).toString(),
768 Integer.valueOf(sequences.length)
771 swidth = mseq[0].getLength(); // JBPNote: could ensure padded
773 for (int s = 0; s < mseq.length; s++)
775 if (alignment[s] == null)
777 alignment[s] = mseq[s];
782 .setSequence(alignment[s].getSequenceAsString()
783 + mseq[s].getSequenceAsString());
784 if (mseq[s].getStart() <= mseq[s].getEnd())
786 alignment[s].setEnd(mseq[s].getEnd());
790 order.updateSequence(mseq[s], alignment[s]);
797 // recover original alignment block or place gaps
800 // recover input data
801 for (int s = 0; s < sequences.length; s++)
803 SequenceI oseq = sequences[s].getSeq(gapCharacter)
804 .getSubSequence(start, contigs[contig + 1]);
805 if (swidth < oseq.getLength())
807 swidth = oseq.getLength();
809 if (alignment[s] == null)
816 .setSequence(alignment[s].getSequenceAsString()
817 + oseq.getSequenceAsString());
818 if (oseq.getEnd() >= oseq.getStart())
820 alignment[s].setEnd(oseq.getEnd());
830 // advance to begining of visible region
831 start = contigs[contig + 1] + contigs[contig + 2];
832 // add hidden segment to right of next region
833 for (int s = 0; s < sequences.length; s++)
835 SequenceI hseq = sequences[s].getSeq(gapCharacter)
836 .getSubSequence(contigs[contig + 1], start);
837 if (alignment[s] == null)
843 alignment[s].setSequence(alignment[s].getSequenceAsString()
844 + hseq.getSequenceAsString());
845 if (hseq.getEnd() >= hseq.getStart())
847 alignment[s].setEnd(hseq.getEnd());
851 // mark hidden segment as hidden in the new alignment
852 hidden.hideColumns(nwidth, nwidth + contigs[contig + 2] - 1);
853 nwidth += contigs[contig + 2];
855 // Do final segment - if it exists
856 if (j < nvismsa.length)
859 if (nvismsa[j] != null)
861 SequenceI mseq[] = nvismsa[j];
862 AlignmentOrder order = (orders != null) ? orders[j] : null;
863 swidth = mseq[0].getLength();
864 for (int s = 0; s < mseq.length; s++)
866 if (alignment[s] == null)
868 alignment[s] = mseq[s];
872 alignment[s].setSequence(alignment[s].getSequenceAsString()
873 + mseq[s].getSequenceAsString());
874 if (mseq[s].getEnd() >= mseq[s].getStart())
876 alignment[s].setEnd(mseq[s].getEnd());
880 order.updateSequence(mseq[s], alignment[s]);
889 // recover input data or place gaps
892 // recover input data
893 for (int s = 0; s < sequences.length; s++)
895 SequenceI oseq = sequences[s].getSeq(gapCharacter)
896 .getSubSequence(start, owidth + 1);
897 if (swidth < oseq.getLength())
899 swidth = oseq.getLength();
901 if (alignment[s] == null)
908 .setSequence(alignment[s].getSequenceAsString()
909 + oseq.getSequenceAsString());
910 if (oseq.getEnd() >= oseq.getStart())
912 alignment[s].setEnd(oseq.getEnd());
921 throw new Error(MessageManager
922 .getString("error.padding_not_yet_implemented"));
928 return new Object[] { alignment, hidden };
932 if (nvismsa.length != 1)
934 throw new Error(MessageManager.formatMessage(
935 "error.mismatch_between_visible_blocks_to_update_and_number_of_contigs_in_view",
937 { Integer.valueOf(nvismsa.length).toString() }));
939 if (nvismsa[0] != null)
941 return new Object[] { nvismsa[0], new HiddenColumns() };
945 return getAlignmentAndHiddenColumns(gapCharacter);
951 * returns simple array of start end positions of visible range on alignment.
952 * vis_start and vis_end are inclusive - use
953 * SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence
954 * from underlying alignment.
956 * @return int[] { start_i, end_i } for 1<i<n visible regions.
958 public int[] getVisibleContigs()
960 if (contigs != null && contigs.length > 0)
965 for (int contig = 0; contig < contigs.length; contig += 3)
967 if ((contigs[contig + 1] - start) > 0)
971 fwidth += contigs[contig + 2]; // end up with full region width
972 // (including hidden regions)
973 start = contigs[contig + 1] + contigs[contig + 2];
979 int viscontigs[] = new int[nvis * 2];
982 for (int contig = 0; contig < contigs.length; contig += 3)
984 if ((contigs[contig + 1] - start) > 0)
986 viscontigs[nvis] = start;
987 viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive
990 start = contigs[contig + 1] + contigs[contig + 2];
994 viscontigs[nvis] = start;
995 viscontigs[nvis + 1] = fwidth - 1; // end is inclusive
1002 return new int[] { 0, width - 1 };
1008 * @return position of first visible column of AlignmentView within its
1009 * parent's alignment reference frame
1011 public int getAlignmentOrigin()
1017 * compute a deletion map for the current view according to the given
1021 * (as returned from SequenceI.gapMap())
1022 * @return int[] {intersection of visible regions with gapMap)
1024 public int[] getVisibleContigMapFor(int[] gapMap)
1026 int[] delMap = null;
1027 int[] viscontigs = getVisibleContigs();
1030 if (viscontigs != null)
1032 // viscontigs maps from a subset of the gapMap to the gapMap, so it will
1033 // always be equal to or shorter than gapMap
1034 delMap = new int[gapMap.length];
1035 for (int contig = 0; contig < viscontigs.length; contig += 2)
1038 while (spos < gapMap.length && gapMap[spos] < viscontigs[contig])
1042 while (spos < gapMap.length
1043 && gapMap[spos] <= viscontigs[contig + 1])
1045 delMap[i++] = spos++;
1048 int tmap[] = new int[i];
1049 System.arraycopy(delMap, 0, tmap, 0, i);
1056 * apply the getSeq(gc) method to each sequence cigar, and return the array of
1057 * edited sequences, optionally with hidden regions removed.
1060 * gap character to use for insertions
1062 * remove hidden regions from sequences. Note: currently implemented
1063 * in a memory inefficient way - space needed is 2*result set for
1066 * @return SequenceI[]
1068 public SequenceI[] getEditedSequences(char gc, boolean delete)
1070 SeqCigar[] msf = getSequences();
1071 SequenceI[] aln = new SequenceI[msf.length];
1072 for (int i = 0, j = msf.length; i < j; i++)
1074 aln[i] = msf[i].getSeq(gc);
1078 String[] sqs = getSequenceStrings(gc);
1079 for (int i = 0; i < sqs.length; i++)
1081 aln[i].setSequence(sqs[i]);
1088 public static void summariseAlignmentView(AlignmentView view,
1091 os.print("View has " + view.sequences.length + " of which ");
1092 if (view.selected == null)
1098 os.print(" " + view.selected.size());
1100 os.println(" are selected.");
1101 os.print("View is " + view.getWidth() + " columns wide");
1103 int[] contigs = view.getContigs();
1104 if (contigs != null)
1106 viswid = view.width;
1107 for (int i = 0; i < contigs.length; i += 3)
1109 viswid += contigs[i + 2];
1111 os.println("with " + viswid + " visible columns spread over "
1112 + contigs.length / 3 + " regions.");
1116 viswid = view.width;
1119 if (view.scGroups != null)
1121 os.println("There are " + view.scGroups.size()
1122 + " groups defined on the view.");
1123 for (int g = 0; g < view.scGroups.size(); g++)
1125 ScGroup sgr = view.scGroups.get(g);
1126 os.println("Group " + g + ": Name = " + sgr.sg.getName()
1127 + " Contains " + sgr.seqs.size() + " Seqs.");
1128 os.println("This group runs from " + sgr.sg.getStartRes() + " to "
1129 + sgr.sg.getEndRes());
1130 for (int s = 0; s < sgr.seqs.size(); s++)
1132 // JBPnote this should be a unit test for ScGroup
1133 if (!sgr.seqs.get(s).isMemberOf(sgr))
1135 os.println("** WARNING: sequence " + sgr.seqs.get(s).toString()
1136 + " is not marked as member of group.");
1140 AlignmentI visal = view.getVisibleAlignment('-');
1143 os.println("Vis. alignment is " + visal.getWidth()
1144 + " wide and has " + visal.getHeight() + " seqs.");
1145 if (visal.getGroups() != null && visal.getGroups().size() > 0)
1149 for (SequenceGroup sg : visal.getGroups())
1151 os.println("Group " + (i++) + " begins at column "
1152 + sg.getStartRes() + " and ends at " + sg.getEndRes());
1159 public static void testSelectionViews(AlignmentI alignment,
1160 HiddenColumns hidden, SequenceGroup selection)
1162 System.out.println("Testing standard view creation:\n");
1163 AlignmentView view = null;
1167 "View with no hidden columns, no limit to selection, no groups to be collected:");
1168 view = new AlignmentView(alignment, hidden, selection, false, false,
1170 summariseAlignmentView(view, System.out);
1172 } catch (Exception e)
1174 e.printStackTrace();
1176 "Failed to generate alignment with selection but no groups marked.");
1181 "View with no hidden columns, no limit to selection, and all groups to be collected:");
1182 view = new AlignmentView(alignment, hidden, selection, false, false,
1184 summariseAlignmentView(view, System.out);
1185 } catch (Exception e)
1187 e.printStackTrace();
1189 "Failed to generate alignment with selection marked but no groups marked.");
1194 "View with no hidden columns, limited to selection and no groups to be collected:");
1195 view = new AlignmentView(alignment, hidden, selection, false, true,
1197 summariseAlignmentView(view, System.out);
1198 } catch (Exception e)
1200 e.printStackTrace();
1202 "Failed to generate alignment with selection restricted but no groups marked.");
1207 "View with no hidden columns, limited to selection, and all groups to be collected:");
1208 view = new AlignmentView(alignment, hidden, selection, false, true,
1210 summariseAlignmentView(view, System.out);
1211 } catch (Exception e)
1213 e.printStackTrace();
1215 "Failed to generate alignment with selection restricted and groups marked.");
1220 "View *with* hidden columns, no limit to selection, no groups to be collected:");
1221 view = new AlignmentView(alignment, hidden, selection, true, false,
1223 summariseAlignmentView(view, System.out);
1224 } catch (Exception e)
1226 e.printStackTrace();
1228 "Failed to generate alignment with selection but no groups marked.");
1233 "View *with* hidden columns, no limit to selection, and all groups to be collected:");
1234 view = new AlignmentView(alignment, hidden, selection, true, false,
1236 summariseAlignmentView(view, System.out);
1237 } catch (Exception e)
1239 e.printStackTrace();
1241 "Failed to generate alignment with selection marked but no groups marked.");
1246 "View *with* hidden columns, limited to selection and no groups to be collected:");
1247 view = new AlignmentView(alignment, hidden, selection, true, true,
1249 summariseAlignmentView(view, System.out);
1250 } catch (Exception e)
1252 e.printStackTrace();
1254 "Failed to generate alignment with selection restricted but no groups marked.");
1259 "View *with* hidden columns, limited to selection, and all groups to be collected:");
1260 view = new AlignmentView(alignment, hidden, selection, true, true,
1262 summariseAlignmentView(view, System.out);
1263 } catch (Exception e)
1265 e.printStackTrace();
1267 "Failed to generate alignment with selection restricted and groups marked.");