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())
281 .getString("error.implementation_error_can_only_make_alignmnet_from_cigararray"));
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[] getAlignmentAndColumnSelection(char gapCharacter)
336 ColumnSelection colsel = new ColumnSelection();
338 return new Object[] {
339 SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel,
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 if (contigs != null && contigs.length > 0)
721 for (int contig = 0; contig < contigs.length; contig += 3)
723 owidth += contigs[contig + 2]; // recover final column width
724 if (contigs[contig + 1] - start > 0)
726 int swidth = 0; // subalignment width
727 if (nvismsa[j] != null)
729 SequenceI mseq[] = nvismsa[j];
730 AlignmentOrder order = (orders == null) ? null : orders[j];
732 if (mseq.length != sequences.length)
737 "error.mismatch_between_number_of_sequences_in_block",
739 Integer.valueOf(j).toString(),
740 Integer.valueOf(mseq.length)
746 swidth = mseq[0].getLength(); // JBPNote: could ensure padded
748 for (int s = 0; s < mseq.length; s++)
750 if (alignment[s] == null)
752 alignment[s] = mseq[s];
756 alignment[s].setSequence(alignment[s]
757 .getSequenceAsString()
758 + mseq[s].getSequenceAsString());
759 if (mseq[s].getStart() <= mseq[s].getEnd())
761 alignment[s].setEnd(mseq[s].getEnd());
765 order.updateSequence(mseq[s], alignment[s]);
772 // recover original alignment block or place gaps
775 // recover input data
776 for (int s = 0; s < sequences.length; s++)
778 SequenceI oseq = sequences[s].getSeq(gapCharacter)
779 .getSubSequence(start, contigs[contig + 1]);
780 if (swidth < oseq.getLength())
782 swidth = oseq.getLength();
784 if (alignment[s] == null)
790 alignment[s].setSequence(alignment[s]
791 .getSequenceAsString()
792 + oseq.getSequenceAsString());
793 if (oseq.getEnd() >= oseq.getStart())
795 alignment[s].setEnd(oseq.getEnd());
805 // advance to begining of visible region
806 start = contigs[contig + 1] + contigs[contig + 2];
807 // add hidden segment to right of next region
808 for (int s = 0; s < sequences.length; s++)
810 SequenceI hseq = sequences[s].getSeq(gapCharacter)
811 .getSubSequence(contigs[contig + 1], start);
812 if (alignment[s] == null)
818 alignment[s].setSequence(alignment[s].getSequenceAsString()
819 + hseq.getSequenceAsString());
820 if (hseq.getEnd() >= hseq.getStart())
822 alignment[s].setEnd(hseq.getEnd());
826 // mark hidden segment as hidden in the new alignment
827 columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2]
829 nwidth += contigs[contig + 2];
831 // Do final segment - if it exists
832 if (j < nvismsa.length)
835 if (nvismsa[j] != null)
837 SequenceI mseq[] = nvismsa[j];
838 AlignmentOrder order = (orders != null) ? orders[j] : null;
839 swidth = mseq[0].getLength();
840 for (int s = 0; s < mseq.length; s++)
842 if (alignment[s] == null)
844 alignment[s] = mseq[s];
848 alignment[s].setSequence(alignment[s].getSequenceAsString()
849 + mseq[s].getSequenceAsString());
850 if (mseq[s].getEnd() >= mseq[s].getStart())
852 alignment[s].setEnd(mseq[s].getEnd());
856 order.updateSequence(mseq[s], alignment[s]);
865 // recover input data or place gaps
868 // recover input data
869 for (int s = 0; s < sequences.length; s++)
871 SequenceI oseq = sequences[s].getSeq(gapCharacter)
872 .getSubSequence(start, owidth + 1);
873 if (swidth < oseq.getLength())
875 swidth = oseq.getLength();
877 if (alignment[s] == null)
883 alignment[s].setSequence(alignment[s]
884 .getSequenceAsString()
885 + oseq.getSequenceAsString());
886 if (oseq.getEnd() >= oseq.getStart())
888 alignment[s].setEnd(oseq.getEnd());
899 .getString("error.padding_not_yet_implemented"));
905 return new Object[] { alignment, columnselection };
909 if (nvismsa.length != 1)
914 "error.mismatch_between_visible_blocks_to_update_and_number_of_contigs_in_view",
915 new String[] { Integer.valueOf(
916 nvismsa.length).toString() }));
918 if (nvismsa[0] != null)
920 return new Object[] { nvismsa[0], new ColumnSelection() };
924 return getAlignmentAndColumnSelection(gapCharacter);
930 * returns simple array of start end positions of visible range on alignment.
931 * vis_start and vis_end are inclusive - use
932 * SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence
933 * from underlying alignment.
935 * @return int[] { start_i, end_i } for 1<i<n visible regions.
937 public int[] getVisibleContigs()
939 if (contigs != null && contigs.length > 0)
944 for (int contig = 0; contig < contigs.length; contig += 3)
946 if ((contigs[contig + 1] - start) > 0)
950 fwidth += contigs[contig + 2]; // end up with full region width
951 // (including hidden regions)
952 start = contigs[contig + 1] + contigs[contig + 2];
958 int viscontigs[] = new int[nvis * 2];
961 for (int contig = 0; contig < contigs.length; contig += 3)
963 if ((contigs[contig + 1] - start) > 0)
965 viscontigs[nvis] = start;
966 viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive
969 start = contigs[contig + 1] + contigs[contig + 2];
973 viscontigs[nvis] = start;
974 viscontigs[nvis + 1] = fwidth; // end is inclusive
981 return new int[] { 0, width };
987 * @return position of first visible column of AlignmentView within its
988 * parent's alignment reference frame
990 public int getAlignmentOrigin()
996 * compute a deletion map for the current view according to the given
1000 * (as returned from SequenceI.gapMap())
1001 * @return int[] {intersection of visible regions with gapMap)
1003 public int[] getVisibleContigMapFor(int[] gapMap)
1005 int[] delMap = null;
1006 int[] viscontigs = getVisibleContigs();
1009 if (viscontigs != null)
1011 // viscontigs maps from a subset of the gapMap to the gapMap, so it will
1012 // always be equal to or shorter than gapMap
1013 delMap = new int[gapMap.length];
1014 for (int contig = 0; contig < viscontigs.length; contig += 2)
1017 while (spos < gapMap.length && gapMap[spos] < viscontigs[contig])
1021 while (spos < gapMap.length
1022 && gapMap[spos] <= viscontigs[contig + 1])
1024 delMap[i++] = spos++;
1027 int tmap[] = new int[i];
1028 System.arraycopy(delMap, 0, tmap, 0, i);
1035 * apply the getSeq(gc) method to each sequence cigar, and return the array of
1036 * edited sequences, optionally with hidden regions removed.
1039 * gap character to use for insertions
1041 * remove hidden regions from sequences. Note: currently implemented
1042 * in a memory inefficient way - space needed is 2*result set for
1045 * @return SequenceI[]
1047 public SequenceI[] getEditedSequences(char gc, boolean delete)
1049 SeqCigar[] msf = getSequences();
1050 SequenceI[] aln = new SequenceI[msf.length];
1051 for (int i = 0, j = msf.length; i < j; i++)
1053 aln[i] = msf[i].getSeq(gc);
1057 String[] sqs = getSequenceStrings(gc);
1058 for (int i = 0; i < sqs.length; i++)
1060 aln[i].setSequence(sqs[i]);
1067 public static void summariseAlignmentView(AlignmentView view,
1070 os.print("View has " + view.sequences.length + " of which ");
1071 if (view.selected == null)
1077 os.print(" " + view.selected.size());
1079 os.println(" are selected.");
1080 os.print("View is " + view.getWidth() + " columns wide");
1082 int[] contigs = view.getContigs();
1083 if (contigs != null)
1085 viswid = view.width;
1086 for (int i = 0; i < contigs.length; i += 3)
1088 viswid += contigs[i + 2];
1090 os.println("with " + viswid + " visible columns spread over "
1091 + contigs.length / 3 + " regions.");
1095 viswid = view.width;
1098 if (view.scGroups != null)
1100 os.println("There are " + view.scGroups.size()
1101 + " groups defined on the view.");
1102 for (int g = 0; g < view.scGroups.size(); g++)
1104 ScGroup sgr = view.scGroups.get(g);
1105 os.println("Group " + g + ": Name = " + sgr.sg.getName()
1106 + " Contains " + sgr.seqs.size() + " Seqs.");
1107 os.println("This group runs from " + sgr.sg.getStartRes() + " to "
1108 + sgr.sg.getEndRes());
1109 for (int s = 0; s < sgr.seqs.size(); s++)
1111 // JBPnote this should be a unit test for ScGroup
1112 if (!sgr.seqs.get(s).isMemberOf(sgr))
1114 os.println("** WARNING: sequence " + sgr.seqs.get(s).toString()
1115 + " is not marked as member of group.");
1119 AlignmentI visal = view.getVisibleAlignment('-');
1122 os.println("Vis. alignment is " + visal.getWidth()
1123 + " wide and has " + visal.getHeight() + " seqs.");
1124 if (visal.getGroups() != null && visal.getGroups().size() > 0)
1128 for (SequenceGroup sg : visal.getGroups())
1130 os.println("Group " + (i++) + " begins at column "
1131 + sg.getStartRes() + " and ends at " + sg.getEndRes());
1138 public static void testSelectionViews(AlignmentI alignment,
1139 ColumnSelection csel, SequenceGroup selection)
1141 System.out.println("Testing standard view creation:\n");
1142 AlignmentView view = null;
1146 .println("View with no hidden columns, no limit to selection, no groups to be collected:");
1147 view = new AlignmentView(alignment, csel, selection, false, false,
1149 summariseAlignmentView(view, System.out);
1151 } catch (Exception e)
1153 e.printStackTrace();
1155 .println("Failed to generate alignment with selection but no groups marked.");
1160 .println("View with no hidden columns, no limit to selection, and all groups to be collected:");
1161 view = new AlignmentView(alignment, csel, selection, false, false,
1163 summariseAlignmentView(view, System.out);
1164 } catch (Exception e)
1166 e.printStackTrace();
1168 .println("Failed to generate alignment with selection marked but no groups marked.");
1173 .println("View with no hidden columns, limited to selection and no groups to be collected:");
1174 view = new AlignmentView(alignment, csel, selection, false, true,
1176 summariseAlignmentView(view, System.out);
1177 } catch (Exception e)
1179 e.printStackTrace();
1181 .println("Failed to generate alignment with selection restricted but no groups marked.");
1186 .println("View with no hidden columns, limited to selection, and all groups to be collected:");
1187 view = new AlignmentView(alignment, csel, selection, false, true,
1189 summariseAlignmentView(view, System.out);
1190 } catch (Exception e)
1192 e.printStackTrace();
1194 .println("Failed to generate alignment with selection restricted and groups marked.");
1199 .println("View *with* hidden columns, no limit to selection, no groups to be collected:");
1200 view = new AlignmentView(alignment, csel, selection, true, false,
1202 summariseAlignmentView(view, System.out);
1203 } catch (Exception e)
1205 e.printStackTrace();
1207 .println("Failed to generate alignment with selection but no groups marked.");
1212 .println("View *with* hidden columns, no limit to selection, and all groups to be collected:");
1213 view = new AlignmentView(alignment, csel, selection, true, false,
1215 summariseAlignmentView(view, System.out);
1216 } catch (Exception e)
1218 e.printStackTrace();
1220 .println("Failed to generate alignment with selection marked but no groups marked.");
1225 .println("View *with* hidden columns, limited to selection and no groups to be collected:");
1226 view = new AlignmentView(alignment, csel, selection, true, true,
1228 summariseAlignmentView(view, System.out);
1229 } catch (Exception e)
1231 e.printStackTrace();
1233 .println("Failed to generate alignment with selection restricted but no groups marked.");
1238 .println("View *with* hidden columns, limited to selection, and all groups to be collected:");
1239 view = new AlignmentView(alignment, csel, selection, true, true, true);
1240 summariseAlignmentView(view, System.out);
1241 } catch (Exception e)
1243 e.printStackTrace();
1245 .println("Failed to generate alignment with selection restricted and groups marked.");