JAL-1350 pass the columnselection rather then selected sequence strings if column...
authorJim Procter <jprocter@dundee.ac.uk>
Thu, 12 Feb 2015 16:50:31 +0000 (16:50 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Thu, 12 Feb 2015 16:50:31 +0000 (16:50 +0000)
src/jalview/controller/AlignViewController.java

index 4d734c7..3b54641 100644 (file)
@@ -79,14 +79,26 @@ public class AlignViewController implements AlignViewControllerI
   @Override
   public boolean makeGroupsFromSelection()
   {
-
-    if (viewport.getSelectionGroup() != null)
+    SequenceGroup sg = viewport.getSelectionGroup();
+    ColumnSelection cs = viewport.getColumnSelection();
+    SequenceGroup[] gps = null;
+    if (sg != null
+            && (cs == null || cs.getSelected() == null || cs.size() == 0))
     {
-      SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(
+      gps = jalview.analysis.Grouping.makeGroupsFrom(
               viewport.getSequenceSelection(),
               viewport.getAlignmentView(true).getSequenceStrings(
                       viewport.getGapCharacter()), viewport.getAlignment()
                       .getGroups());
+    } else {
+      if (cs!=null) {
+        gps = jalview.analysis.Grouping.makeGroupsFromCols(
+                (sg == null) ? viewport.getAlignment().getSequencesArray()
+                        : sg.getSequences().toArray(new SequenceI[0]), cs,
+                viewport.getAlignment().getGroups());
+      }
+    }
+    if (gps!=null) {
       viewport.getAlignment().deleteAllGroups();
       viewport.clearSequenceColours();
       viewport.setSelectionGroup(null);