From: Jim Procter Date: Thu, 29 Oct 2020 15:17:37 +0000 (+0000) Subject: JAL-3759 exclude hidden columns when processing column selection X-Git-Tag: Release_2_11_1_3~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=038cb9c86641c3de91d8f330c5e3267507c46643;p=jalview.git JAL-3759 exclude hidden columns when processing column selection --- diff --git a/src/jalview/analysis/Grouping.java b/src/jalview/analysis/Grouping.java index 066814e..88d3525 100644 --- a/src/jalview/analysis/Grouping.java +++ b/src/jalview/analysis/Grouping.java @@ -21,6 +21,7 @@ package jalview.analysis; import jalview.datamodel.ColumnSelection; +import jalview.datamodel.HiddenColumns; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; @@ -109,10 +110,12 @@ public class Grouping * @param sequences * @param columnSelection * @param list + * @param hiddenColumns * @return */ public static SequenceGroup[] makeGroupsFromCols(SequenceI[] sequences, - ColumnSelection cs, List list) + ColumnSelection cs, List list, + HiddenColumns hiddenColumns) { // TODO: determine how to get/recover input data for group generation Map> gps = new HashMap>(); @@ -137,9 +140,17 @@ public class Grouping int i = 0; for (Integer pos : cs.getSelected()) { - spos[i++] = pos.intValue(); + if (hiddenColumns == null || hiddenColumns.isVisible(pos.intValue())) + { + spos[i++] = pos.intValue(); + } } - + if (i < spos.length) + { + // mark end of visible column position + spos[i] = -1; + } + // actual number of visible columns for (i = 0; i < sequences.length; i++) { int slen = sequences[i].getLength(); @@ -156,6 +167,10 @@ public class Grouping } for (int p : spos) { + if (p < 0) + { + break; + } if (p >= slen) { schar.append("~"); diff --git a/src/jalview/controller/AlignViewController.java b/src/jalview/controller/AlignViewController.java index 0bb2d03..1fc1946 100644 --- a/src/jalview/controller/AlignViewController.java +++ b/src/jalview/controller/AlignViewController.java @@ -90,7 +90,8 @@ public class AlignViewController implements AlignViewControllerI gps = jalview.analysis.Grouping.makeGroupsFromCols( (sg == null) ? viewport.getAlignment().getSequencesArray() : sg.getSequences().toArray(new SequenceI[0]), - cs, viewport.getAlignment().getGroups()); + cs, viewport.getAlignment().getGroups(), + viewport.getAlignment().getHiddenColumns()); } } if (gps != null)