@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);