{
delete_actionPerformed();
}
+ else if (source == grpsFromSelection)
+ {
+ makeGrpsFromSelection_actionPerformed();
+ }
else if (source == deleteGroups)
{
deleteGroups_actionPerformed();
this.setVisible(false);
}
}
-
+ protected void makeGrpsFromSelection_actionPerformed()
+ {
+ if (viewport.getSelectionGroup() != null)
+ {
+ SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(
+ viewport.getSequenceSelection(), viewport.getAlignmentView(
+ true).getSequenceStrings(viewport.getGapCharacter()),
+ viewport.alignment.getGroups());
+ viewport.alignment.deleteAllGroups();
+ viewport.sequenceColours = null;
+ viewport.setSelectionGroup(null);
+ // set view properties for each group
+ for (int g = 0; g < gps.length; g++)
+ {
+ // gps[g].setShowunconserved(viewport.getShowUnconserved());
+ gps[g].setIncludeAllConsSymbols(viewport.isIncludeAllConsensusSymbols());
+ viewport.alignment.addGroup(gps[g]);
+ Color col = new Color((int) (Math.random() * 255), (int) (Math
+ .random() * 255), (int) (Math.random() * 255));
+ col = col.brighter();
+ for (Enumeration sq = gps[g].getSequences(null).elements(); sq
+ .hasMoreElements(); viewport.setSequenceColour(
+ (SequenceI) sq.nextElement(), col))
+ ;
+ }
+ PaintRefresher.Refresh(this, viewport.getSequenceSetId());
+ // alignPanel.updateAnnotation();
+ alignPanel.paintAlignment(true);
+ }
+ }
protected void deleteGroups_actionPerformed()
{
viewport.alignment.deleteAllGroups();
MenuItem deleteGroups = new MenuItem();
+ MenuItem grpsFromSelection= new MenuItem();
+
MenuItem delete = new MenuItem();
MenuItem copy = new MenuItem();
nucleotideColour.addActionListener(this);
deleteGroups.setLabel("Undefine Groups");
deleteGroups.addActionListener(this);
+ grpsFromSelection.setLabel("Make Groups for selection");
+ grpsFromSelection.addActionListener(this);
copy.setLabel("Copy");
copy.addActionListener(this);
cut.setLabel("Cut");
selectMenu.add(deselectAllSequenceMenuItem);
selectMenu.add(invertSequenceMenuItem);
selectMenu.add(invertColSel);
+ selectMenu.add(grpsFromSelection);
selectMenu.add(deleteGroups);
+
}
MenuItem featureSettings = new MenuItem();
return sequences;
}
-
+ /**
+ * get the currently selected sequence objects or all the sequences in the
+ * alignment.
+ *
+ * @return array of references to sequence objects
+ */
+ public SequenceI[] getSequenceSelection()
+ {
+ SequenceI[] sequences=null;
+ if (selectionGroup!=null)
+ {
+ sequences = selectionGroup.getSequencesInOrder(alignment);
+ }
+ if (sequences == null)
+ {
+ sequences = alignment.getSequencesArray();
+ }
+ return sequences;
+ }
/**
* This method returns the visible alignment as text, as seen on the GUI, ie
* if columns are hidden they will not be returned in the result. Use this for