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 HiddenColumns hidden,
145 SequenceGroup selection,
146 boolean hasHiddenColumns, boolean selectedRegionOnly,
147 boolean recordGroups)
149 // refactored from AlignViewport.getAlignmentView(selectedOnly);
150 this(new jalview.datamodel.CigarArray(alignment,
151 (hasHiddenColumns ? hidden : null),
152 (selectedRegionOnly ? selection : null)),
153 (selectedRegionOnly && selection != null) ? selection
155 isNa = alignment.isNucleotide();
156 // walk down SeqCigar array and Alignment Array - optionally restricted by
158 // test group membership for each sequence in each group, store membership
159 // and record non-empty groups in group list.
160 // record / sub-select selected region on the alignment view
162 if (selection != null && selection.getSize() > 0)
164 List<SequenceI> sel = selection.getSequences(null);
165 this.selected = new ScGroup();
167 .getSequencesInOrder(alignment, selectedRegionOnly);
171 selseqs = alignment.getSequencesArray();
174 List<List<SequenceI>> seqsets = new ArrayList<List<SequenceI>>();
175 // get the alignment's group list and make a copy
176 List<SequenceGroup> grps = new ArrayList<SequenceGroup>();
177 List<SequenceGroup> gg = alignment.getGroups();
179 ScGroup[] sgrps = null;
180 boolean addedgps[] = null;
183 if (selection != null && selectedRegionOnly)
185 // trim annotation to the region being stored.
186 // strip out any groups that do not actually intersect with the
187 // visible and selected region
188 int ssel = selection.getStartRes(), esel = selection.getEndRes();
189 List<SequenceGroup> isg = new ArrayList<SequenceGroup>();
190 for (SequenceGroup sg : grps)
192 if (!(sg.getStartRes() > esel || sg.getEndRes() < ssel))
194 // adjust bounds of new group, if necessary.
195 if (sg.getStartRes() < ssel)
197 sg.setStartRes(ssel);
199 if (sg.getEndRes() > esel)
203 sg.setStartRes(sg.getStartRes() - ssel + 1);
204 sg.setEndRes(sg.getEndRes() - ssel + 1);
212 sgrps = new ScGroup[grps.size()];
213 addedgps = new boolean[grps.size()];
214 for (int g = 0; g < sgrps.length; g++)
216 SequenceGroup sg = grps.get(g);
217 sgrps[g] = new ScGroup();
218 sgrps[g].sg = new SequenceGroup(sg);
220 // can't set entry 0 in an empty list
221 // seqsets.set(g, sg.getSequences(null));
222 seqsets.add(sg.getSequences());
224 // seqsets now contains vectors (should be sets) for each group, so we can
225 // track when we've done with the group
228 for (int i = 0; i < selseqs.length; i++)
230 if (selseqs[i] != null)
232 if (selection != null && selection.getSize() > 0
233 && !selectedRegionOnly)
235 selected.add(sequences[csi]);
239 for (int sg = 0; sg < sgrps.length; sg++)
241 if ((seqsets.get(sg)).contains(selseqs[i]))
243 sgrps[sg].sg.deleteSequence(selseqs[i], false);
244 sgrps[sg].add(sequences[csi]);
247 if (scGroups == null)
249 scGroups = new ArrayList<ScGroup>();
252 scGroups.add(sgrps[sg]);
260 // finally, delete the remaining sequences (if any) not selected
261 for (int sg = 0; sg < sgrps.length; sg++)
263 SequenceI[] sqs = sgrps[sg].sg.getSequencesAsArray(null);
264 for (int si = 0; si < sqs.length; si++)
266 sgrps[sg].sg.deleteSequence(sqs[si], false);
273 * construct an alignmentView from a SeqCigarArray. Errors are thrown if the
274 * seqcigararray.isSeqCigarArray() flag is not set.
276 public AlignmentView(CigarArray seqcigararray)
278 if (!seqcigararray.isSeqCigarArray())
281 "Implementation Error - can only make an alignment view from a CigarArray of sequences.");
283 // contigs = seqcigararray.applyDeletions();
284 contigs = seqcigararray.getDeletedRegions();
285 sequences = seqcigararray.getSeqCigarArray();
286 width = seqcigararray.getWidth(); // visible width
290 * Create an alignmentView where the first column corresponds with the
291 * 'firstcol' column of some reference alignment
296 public AlignmentView(CigarArray sdata, int firstcol)
302 public void setSequences(SeqCigar[] sequences)
304 this.sequences = sequences;
307 public void setContigs(int[] contigs)
309 this.contigs = contigs;
312 public SeqCigar[] getSequences()
318 * @see CigarArray.getDeletedRegions
319 * @return int[] { vis_start, sym_start, length }
321 public int[] getContigs()
327 * get the full alignment and a columnselection object marking the hidden
330 * @param gapCharacter
332 * @return Object[] { SequenceI[], ColumnSelection}
334 public Object[] getAlignmentAndHiddenColumns(char gapCharacter)
336 HiddenColumns hidden = new HiddenColumns();
338 return new Object[] {
339 SeqCigar.createAlignmentSequences(sequences, gapCharacter, hidden,
344 * return the visible alignment corresponding to this view. Sequences in this
345 * alignment are edited versions of the parent sequences - where hidden
346 * regions have been removed. NOTE: the sequence data in this alignment is not
352 public AlignmentI getVisibleAlignment(char c)
354 SequenceI[] aln = getVisibleSeqs(c);
356 AlignmentI vcal = new Alignment(aln);
357 addPrunedGroupsInOrder(vcal, -1, -1, true);
362 * add groups from view to the given alignment
368 * -1 or gstart to width-1
370 * - true if vcal is alignment of the visible regions of the view
371 * (e.g. as returned from getVisibleAlignment)
373 private void addPrunedGroupsInOrder(AlignmentI vcal, int gstart,
374 int gend, boolean viscontigs)
377 if (gstart > -1 && gstart <= gend)
382 SequenceI[] aln = vcal.getSequencesArray();
385 * prune any groups to the visible coordinates of the alignment.
388 int nvg = (scGroups != null) ? scGroups.size() : 0;
391 SequenceGroup[] nsg = new SequenceGroup[nvg];
392 for (int g = 0; g < nvg; g++)
394 SequenceGroup sg = scGroups.get(g).sg;
397 if (sg.getStartRes() > gend || sg.getEndRes() < gstart)
405 // clone group properties
406 nsg[g] = new SequenceGroup(sg);
408 // may need to shift/trim start and end ?
409 if (r && !viscontigs)
411 // Not fully tested code - routine not yet called with
413 if (nsg[g].getStartRes() < gstart)
415 nsg[g].setStartRes(0);
419 nsg[g].setStartRes(nsg[g].getStartRes() - gstart);
420 nsg[g].setEndRes(nsg[g].getEndRes() - gstart);
422 if (nsg[g].getEndRes() > (gend - gstart))
424 nsg[g].setEndRes(gend - gstart);
430 // prune groups to cover just the visible positions between
435 ShiftList prune = new ShiftList();
438 // adjust for start of alignment within visible window.
439 prune.addShift(gstart, -gstart); //
441 for (int h = 0; h < contigs.length; h += 3)
444 prune.addShift(p + contigs[h + 1], contigs[h + 2]
447 p = contigs[h + 1] + contigs[h + 2];
449 for (int g = 0; g < nsg.length; g++)
453 int s = nsg[g].getStartRes(), t = nsg[g].getEndRes();
468 nsg[g].setStartRes(s);
475 for (int nsq = 0; nsq < aln.length; nsq++)
477 for (int g = 0; g < nvg; g++)
480 && sequences[nsq].isMemberOf(scGroups.get(g)))
482 nsg[g].addSequence(aln[nsq], false);
486 for (int g = 0; g < nvg; g++)
488 if (nsg[g] != null && nsg[g].getSize() > 0)
490 vcal.addGroup(nsg[g]);
500 * generate sequence array corresponding to the visible parts of the
504 * gap character to use to recreate the alignment
507 private SequenceI[] getVisibleSeqs(char c)
509 SequenceI[] aln = new SequenceI[sequences.length];
510 for (int i = 0, j = sequences.length; i < j; i++)
512 aln[i] = sequences[i].getSeq(c);
513 // Remove hidden regions from sequence
514 aln[i].setSequence(getASequenceString(c, i));
520 * creates new alignment objects for all contiguous visible segments
525 * @param regionOfInterest
526 * specify which sequences to include (or null to include all
528 * @return AlignmentI[] - all alignments where each sequence is a subsequence
529 * constructed from visible contig regions of view
531 public AlignmentI[] getVisibleContigAlignments(char c)
534 int[] vcontigs = getVisibleContigs();
535 SequenceI[][] contigviews = getVisibleContigs(c);
536 AlignmentI[] vcals = new AlignmentI[contigviews.length];
537 for (nvc = 0; nvc < contigviews.length; nvc++)
539 vcals[nvc] = new Alignment(contigviews[nvc]);
540 if (scGroups != null && scGroups.size() > 0)
542 addPrunedGroupsInOrder(vcals[nvc], vcontigs[nvc * 2],
543 vcontigs[nvc * 2 + 1], true);
550 * build a string excluding hidden regions from a particular sequence in the
557 private String getASequenceString(char c, int n)
560 String fullseq = sequences[n].getSequenceString(c);
565 for (int h = 0; h < contigs.length; h += 3)
567 sqn += fullseq.substring(p, contigs[h + 1]);
568 p = contigs[h + 1] + contigs[h + 2];
570 sqn += fullseq.substring(p);
580 * get an array of visible sequence strings for a view on an alignment using
581 * the given gap character uses getASequenceString
587 public String[] getSequenceStrings(char c)
589 String[] seqs = new String[sequences.length];
590 for (int n = 0; n < sequences.length; n++)
592 seqs[n] = getASequenceString(c, n);
599 * @return visible number of columns in alignment view
601 public int getWidth()
606 protected void setWidth(int width)
612 * get the contiguous subalignments in an alignment view.
614 * @param gapCharacter
616 * @return SequenceI[][]
618 public SequenceI[][] getVisibleContigs(char gapCharacter)
622 if (sequences == null || width <= 0)
626 if (contigs != null && contigs.length > 0)
631 for (int contig = 0; contig < contigs.length; contig += 3)
633 if ((contigs[contig + 1] - start) > 0)
637 fwidth += contigs[contig + 2]; // end up with full region width
638 // (including hidden regions)
639 start = contigs[contig + 1] + contigs[contig + 2];
645 smsa = new SequenceI[njobs][];
648 for (int contig = 0; contig < contigs.length; contig += 3)
650 if (contigs[contig + 1] - start > 0)
652 SequenceI mseq[] = new SequenceI[sequences.length];
653 for (int s = 0; s < mseq.length; s++)
655 mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(
656 start, contigs[contig + 1]);
661 start = contigs[contig + 1] + contigs[contig + 2];
665 SequenceI mseq[] = new SequenceI[sequences.length];
666 for (int s = 0; s < mseq.length; s++)
668 mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start,
677 smsa = new SequenceI[1][];
678 smsa[0] = new SequenceI[sequences.length];
679 for (int s = 0; s < sequences.length; s++)
681 smsa[0][s] = sequences[s].getSeq(gapCharacter);
688 * return full msa and hidden regions with visible blocks replaced with new
694 * AlignmentOrder[] corresponding to each SequenceI[] block.
697 public Object[] getUpdatedView(SequenceI[][] nvismsa,
698 AlignmentOrder[] orders, char gapCharacter)
700 if (sequences == null || width <= 0)
704 .getString("error.empty_view_cannot_be_updated"));
709 "nvismsa==null. use getAlignmentAndColumnSelection() instead.");
711 if (contigs != null && contigs.length > 0)
713 SequenceI[] alignment = new SequenceI[sequences.length];
714 // ColumnSelection columnselection = new ColumnSelection();
715 HiddenColumns hidden = new HiddenColumns();
716 if (contigs != null && contigs.length > 0)
722 for (int contig = 0; contig < contigs.length; contig += 3)
724 owidth += contigs[contig + 2]; // recover final column width
725 if (contigs[contig + 1] - start > 0)
727 int swidth = 0; // subalignment width
728 if (nvismsa[j] != null)
730 SequenceI mseq[] = nvismsa[j];
731 AlignmentOrder order = (orders == null) ? null : orders[j];
733 if (mseq.length != sequences.length)
738 "error.mismatch_between_number_of_sequences_in_block",
740 Integer.valueOf(j).toString(),
741 Integer.valueOf(mseq.length)
747 swidth = mseq[0].getLength(); // JBPNote: could ensure padded
749 for (int s = 0; s < mseq.length; s++)
751 if (alignment[s] == null)
753 alignment[s] = mseq[s];
757 alignment[s].setSequence(alignment[s]
758 .getSequenceAsString()
759 + mseq[s].getSequenceAsString());
760 if (mseq[s].getStart() <= mseq[s].getEnd())
762 alignment[s].setEnd(mseq[s].getEnd());
766 order.updateSequence(mseq[s], alignment[s]);
773 // recover original alignment block or place gaps
776 // recover input data
777 for (int s = 0; s < sequences.length; s++)
779 SequenceI oseq = sequences[s].getSeq(gapCharacter)
780 .getSubSequence(start, contigs[contig + 1]);
781 if (swidth < oseq.getLength())
783 swidth = oseq.getLength();
785 if (alignment[s] == null)
791 alignment[s].setSequence(alignment[s]
792 .getSequenceAsString()
793 + oseq.getSequenceAsString());
794 if (oseq.getEnd() >= oseq.getStart())
796 alignment[s].setEnd(oseq.getEnd());
806 // advance to begining of visible region
807 start = contigs[contig + 1] + contigs[contig + 2];
808 // add hidden segment to right of next region
809 for (int s = 0; s < sequences.length; s++)
811 SequenceI hseq = sequences[s].getSeq(gapCharacter)
812 .getSubSequence(contigs[contig + 1], start);
813 if (alignment[s] == null)
819 alignment[s].setSequence(alignment[s].getSequenceAsString()
820 + hseq.getSequenceAsString());
821 if (hseq.getEnd() >= hseq.getStart())
823 alignment[s].setEnd(hseq.getEnd());
827 // mark hidden segment as hidden in the new alignment
828 hidden.hideColumns(nwidth, nwidth + contigs[contig + 2]
830 nwidth += contigs[contig + 2];
832 // Do final segment - if it exists
833 if (j < nvismsa.length)
836 if (nvismsa[j] != null)
838 SequenceI mseq[] = nvismsa[j];
839 AlignmentOrder order = (orders != null) ? orders[j] : null;
840 swidth = mseq[0].getLength();
841 for (int s = 0; s < mseq.length; s++)
843 if (alignment[s] == null)
845 alignment[s] = mseq[s];
849 alignment[s].setSequence(alignment[s].getSequenceAsString()
850 + mseq[s].getSequenceAsString());
851 if (mseq[s].getEnd() >= mseq[s].getStart())
853 alignment[s].setEnd(mseq[s].getEnd());
857 order.updateSequence(mseq[s], alignment[s]);
866 // recover input data or place gaps
869 // recover input data
870 for (int s = 0; s < sequences.length; s++)
872 SequenceI oseq = sequences[s].getSeq(gapCharacter)
873 .getSubSequence(start, owidth + 1);
874 if (swidth < oseq.getLength())
876 swidth = oseq.getLength();
878 if (alignment[s] == null)
884 alignment[s].setSequence(alignment[s]
885 .getSequenceAsString()
886 + oseq.getSequenceAsString());
887 if (oseq.getEnd() >= oseq.getStart())
889 alignment[s].setEnd(oseq.getEnd());
900 .getString("error.padding_not_yet_implemented"));
906 return new Object[] { alignment, hidden };
910 if (nvismsa.length != 1)
915 "error.mismatch_between_visible_blocks_to_update_and_number_of_contigs_in_view",
916 new String[] { Integer.valueOf(
917 nvismsa.length).toString() }));
919 if (nvismsa[0] != null)
921 return new Object[] { nvismsa[0], new HiddenColumns() };
925 return getAlignmentAndHiddenColumns(gapCharacter);
931 * returns simple array of start end positions of visible range on alignment.
932 * vis_start and vis_end are inclusive - use
933 * SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence
934 * from underlying alignment.
936 * @return int[] { start_i, end_i } for 1<i<n visible regions.
938 public int[] getVisibleContigs()
940 if (contigs != null && contigs.length > 0)
945 for (int contig = 0; contig < contigs.length; contig += 3)
947 if ((contigs[contig + 1] - start) > 0)
951 fwidth += contigs[contig + 2]; // end up with full region width
952 // (including hidden regions)
953 start = contigs[contig + 1] + contigs[contig + 2];
959 int viscontigs[] = new int[nvis * 2];
962 for (int contig = 0; contig < contigs.length; contig += 3)
964 if ((contigs[contig + 1] - start) > 0)
966 viscontigs[nvis] = start;
967 viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive
970 start = contigs[contig + 1] + contigs[contig + 2];
974 viscontigs[nvis] = start;
975 viscontigs[nvis + 1] = fwidth - 1; // end is inclusive
982 return new int[] { 0, width - 1 };
988 * @return position of first visible column of AlignmentView within its
989 * parent's alignment reference frame
991 public int getAlignmentOrigin()
997 * compute a deletion map for the current view according to the given
1001 * (as returned from SequenceI.gapMap())
1002 * @return int[] {intersection of visible regions with gapMap)
1004 public int[] getVisibleContigMapFor(int[] gapMap)
1006 int[] delMap = null;
1007 int[] viscontigs = getVisibleContigs();
1010 if (viscontigs != null)
1012 // viscontigs maps from a subset of the gapMap to the gapMap, so it will
1013 // always be equal to or shorter than gapMap
1014 delMap = new int[gapMap.length];
1015 for (int contig = 0; contig < viscontigs.length; contig += 2)
1018 while (spos < gapMap.length && gapMap[spos] < viscontigs[contig])
1022 while (spos < gapMap.length
1023 && gapMap[spos] <= viscontigs[contig + 1])
1025 delMap[i++] = spos++;
1028 int tmap[] = new int[i];
1029 System.arraycopy(delMap, 0, tmap, 0, i);
1036 * apply the getSeq(gc) method to each sequence cigar, and return the array of
1037 * edited sequences, optionally with hidden regions removed.
1040 * gap character to use for insertions
1042 * remove hidden regions from sequences. Note: currently implemented
1043 * in a memory inefficient way - space needed is 2*result set for
1046 * @return SequenceI[]
1048 public SequenceI[] getEditedSequences(char gc, boolean delete)
1050 SeqCigar[] msf = getSequences();
1051 SequenceI[] aln = new SequenceI[msf.length];
1052 for (int i = 0, j = msf.length; i < j; i++)
1054 aln[i] = msf[i].getSeq(gc);
1058 String[] sqs = getSequenceStrings(gc);
1059 for (int i = 0; i < sqs.length; i++)
1061 aln[i].setSequence(sqs[i]);
1068 public static void summariseAlignmentView(AlignmentView view,
1071 os.print("View has " + view.sequences.length + " of which ");
1072 if (view.selected == null)
1078 os.print(" " + view.selected.size());
1080 os.println(" are selected.");
1081 os.print("View is " + view.getWidth() + " columns wide");
1083 int[] contigs = view.getContigs();
1084 if (contigs != null)
1086 viswid = view.width;
1087 for (int i = 0; i < contigs.length; i += 3)
1089 viswid += contigs[i + 2];
1091 os.println("with " + viswid + " visible columns spread over "
1092 + contigs.length / 3 + " regions.");
1096 viswid = view.width;
1099 if (view.scGroups != null)
1101 os.println("There are " + view.scGroups.size()
1102 + " groups defined on the view.");
1103 for (int g = 0; g < view.scGroups.size(); g++)
1105 ScGroup sgr = view.scGroups.get(g);
1106 os.println("Group " + g + ": Name = " + sgr.sg.getName()
1107 + " Contains " + sgr.seqs.size() + " Seqs.");
1108 os.println("This group runs from " + sgr.sg.getStartRes() + " to "
1109 + sgr.sg.getEndRes());
1110 for (int s = 0; s < sgr.seqs.size(); s++)
1112 // JBPnote this should be a unit test for ScGroup
1113 if (!sgr.seqs.get(s).isMemberOf(sgr))
1115 os.println("** WARNING: sequence " + sgr.seqs.get(s).toString()
1116 + " is not marked as member of group.");
1120 AlignmentI visal = view.getVisibleAlignment('-');
1123 os.println("Vis. alignment is " + visal.getWidth()
1124 + " wide and has " + visal.getHeight() + " seqs.");
1125 if (visal.getGroups() != null && visal.getGroups().size() > 0)
1129 for (SequenceGroup sg : visal.getGroups())
1131 os.println("Group " + (i++) + " begins at column "
1132 + sg.getStartRes() + " and ends at " + sg.getEndRes());
1139 public static void testSelectionViews(AlignmentI alignment,
1140 HiddenColumns hidden, SequenceGroup selection)
1142 System.out.println("Testing standard view creation:\n");
1143 AlignmentView view = null;
1147 .println("View with no hidden columns, no limit to selection, no groups to be collected:");
1148 view = new AlignmentView(alignment, hidden, selection, false, false,
1150 summariseAlignmentView(view, System.out);
1152 } catch (Exception e)
1154 e.printStackTrace();
1156 .println("Failed to generate alignment with selection but no groups marked.");
1161 .println("View with no hidden columns, no limit to selection, and all groups to be collected:");
1162 view = new AlignmentView(alignment, hidden, selection, false, false,
1164 summariseAlignmentView(view, System.out);
1165 } catch (Exception e)
1167 e.printStackTrace();
1169 .println("Failed to generate alignment with selection marked but no groups marked.");
1174 .println("View with no hidden columns, limited to selection and no groups to be collected:");
1175 view = new AlignmentView(alignment, hidden, selection, false, true,
1177 summariseAlignmentView(view, System.out);
1178 } catch (Exception e)
1180 e.printStackTrace();
1182 .println("Failed to generate alignment with selection restricted but no groups marked.");
1187 .println("View with no hidden columns, limited to selection, and all groups to be collected:");
1188 view = new AlignmentView(alignment, hidden, selection, false, true,
1190 summariseAlignmentView(view, System.out);
1191 } catch (Exception e)
1193 e.printStackTrace();
1195 .println("Failed to generate alignment with selection restricted and groups marked.");
1200 .println("View *with* hidden columns, no limit to selection, no groups to be collected:");
1201 view = new AlignmentView(alignment, hidden, selection, true, false,
1203 summariseAlignmentView(view, System.out);
1204 } catch (Exception e)
1206 e.printStackTrace();
1208 .println("Failed to generate alignment with selection but no groups marked.");
1213 .println("View *with* hidden columns, no limit to selection, and all groups to be collected:");
1214 view = new AlignmentView(alignment, hidden, selection, true, false,
1216 summariseAlignmentView(view, System.out);
1217 } catch (Exception e)
1219 e.printStackTrace();
1221 .println("Failed to generate alignment with selection marked but no groups marked.");
1226 .println("View *with* hidden columns, limited to selection and no groups to be collected:");
1227 view = new AlignmentView(alignment, hidden, selection, true, true,
1229 summariseAlignmentView(view, System.out);
1230 } catch (Exception e)
1232 e.printStackTrace();
1234 .println("Failed to generate alignment with selection restricted but no groups marked.");
1239 .println("View *with* hidden columns, limited to selection, and all groups to be collected:");
1240 view = new AlignmentView(alignment, hidden, selection, true, true,
1242 summariseAlignmentView(view, System.out);
1243 } catch (Exception e)
1245 e.printStackTrace();
1247 .println("Failed to generate alignment with selection restricted and groups marked.");