schrodinger.ui.residueselector module¶
-
class
schrodinger.ui.residueselector.
MutationSelectorComboBox
(parent, pop_up_class=<class 'schrodinger.ui.residueselector.MutationSelectorPopUp'>)¶ Bases:
schrodinger.ui.qt.pop_up_widgets.ComboBoxWithPopUp
This combo box will show a residue type selection pop-up box when clicked.
-
disableResidues
(disable_residues)¶ Parameters: disable_residues (List of (str, str) tuples.) – List of residues to disable. Each item is a tuple of (res_name, tooltip).
-
getSelectedMutations
()¶ Get the mutations that have been selected by the user in the popup
Return type: set of str Returns: Set of strings representing the user’s residue mutation selections
-
popUpUpdated
(mutations)¶ Over-ride the popUpUpdated() method of MutationSelectorComboBox. Callback that passes the selected mutations back to the line edit.
Parameters: mutations (set of str) – The mutations selected by the user in the pop up
-
setSelectedMutations
(mutations)¶ Set the mutations that should be selected.
Parameters: mutations (set of str) – The mutations selected by the user in the pop up
-
-
class
schrodinger.ui.residueselector.
MutationSelectorFrame
(parent=None)¶ Bases:
PyQt5.QtWidgets.QFrame
This frame contains widgets for selecting one or more residue type (e.g. ALA, VAL, and GLY). The editor has a checkbox for each residue, along with convenience checkboxes that allow the user to toggle multiple residues that match a description (e.g., polar).
This frame is intended to be embedded in a layout. For using as a pop-up, see MutationSelectorPopUp.
-
applyGroupSelections
()¶ Examines the relevant group checkboxes to determine which residues should be selected and selects them.
Our groups obey the following rules:
- no residues in a group selected -> group deselected
- some but not all residues in a group selected -> group partially selected
- all residues in a group selected -> group selected
- a user selects a group -> group selected
- a user deselects a group -> group deselected
In other words, for users, the groups function as dual state, but in terms of display, the groups are tristate.
Note that this function can only be called as a signal, because it needs to call self.sender()
-
clear
()¶ De-select all residues.
-
dataChanged
¶
-
deselectAll
()¶ Deselects all the residue checkboxes if the None convenience checkbox has been selected
Parameters: checked (bool) – Whether the None checkbox is checked
-
disableResidue
(res_name, tooltip=None)¶ Disable the given residue checkbox in the pop-up dialog.
-
disableResidues
(disable_residues)¶ Parameters: disable_residues (List of (str, str) tuples.) – List of residues to disable. Each item is a tuple of (res_name, tooltip).
-
getResidueCheckbox
(residue_name)¶ Return the checkbox for the residue or residue group.
Parameters: residue_name (str) – The name of the residue
-
getResidueGroups
()¶
-
selectAll
()¶ Selects every enabled residue checkbox in the pop up
-
selectResidueCheckbox
(residue_name, check=True)¶ Selects (or deselects, if False) a single residue checkbox
Parameters: - residue_name (str) – The name of the residue corresponding to the checkbox
- check (bool) – Whether to check or uncheck the checkbox
-
setSelectedMutations
(residues)¶ Parameters: residues (set of str) – The residues selected by the user Checks the checkboxes corresponding to the given set of residue strings, and unchecks the other checkboxes. Connect to the dataChanged signal to get updates on the selected mutations.
-
setupCheckboxes
()¶ Populate the std residues, custom residues, and groups layouts with checkboxes based on the current residue groups. Can be called to re-populate the pop-up widget if the return value of getResidueGroups() of the subclass has changed.
-
updateSelections
()¶ Collect checked residues and then add any residues selected via the group checkboxes. Emits a set of selected residues.
-
-
class
schrodinger.ui.residueselector.
MutationSelectorLineEdit
(parent, pop_up_class=<class 'schrodinger.ui.residueselector.MutationSelectorPopUp'>)¶ Bases:
schrodinger.ui.qt.pop_up_widgets.LineEditWithPopUp
This line edit will show a residue type selection pop-up box when clicked. It can be used in a Qt table by defining a custom Delegate, for example:
- class MutationSelectorDelegate(pop_up_widgets.PopUpDelegate):
- def _createEditor(self, parent, option, index):
- return MutationSelectorLineEdit(parent)
- def setModelData(self, editor, model, index):
- mutations = editor.getSelectedMutations() model.setData(index, mutations)
-
disableResidues
(disable_residues)¶ Parameters: disable_residues (List of (str, str) tuples.) – List of residues to disable. Each item is a tuple of (res_name, tooltip).
-
getSelectedMutations
()¶ Get the mutations that have been selected by the user in the popup
Return type: set of str Returns: Set of strings representing the user’s residue mutation selections
-
popUpUpdated
(mutations)¶ Over-ride the popUpUpdated() method of MutationSelectorLineEdit. Callback that passes the selected mutations back to the line edit.
Parameters: mutations (set of str) – The mutations selected by the user in the pop up
-
setSelectedMutations
(mutations)¶ Set the mutations that should be selected.
Parameters: mutations (set of str) – The mutations selected by the user in the pop up
-
class
schrodinger.ui.residueselector.
MutationSelectorPopUp
(parent)¶ Bases:
schrodinger.ui.qt.pop_up_widgets.PopUp
,schrodinger.ui.residueselector.MutationSelectorFrame
A popup editor for selecting residue mutation targets. The editor has a checkbox for each residue, along with convenience checkboxes that allow the user to toggle multiple residues that match a description (e.g., polar).
This frame is intended to be added to a GUI layout. For using as a pop-up, see MutationSelectorPopUp.
-
dataChanged
¶
-
lineEditUpdated
(mutations_txt)¶
-
setup
()¶
-
-
class
schrodinger.ui.residueselector.
ResidueGroups
¶ Bases:
object
Class representing the residue “groups” that appear as mixed-state checkboxes in the residue selector pop-up. Basically a collection of multiple residue name tuples.
-
schrodinger.ui.residueselector.
clear_layout
(layout)¶ Remove all widgets from the layout and delete them.
-
schrodinger.ui.residueselector.
muts_str_to_list
(muts_str)¶ Convert the string of comma-separated residue names to a list. Strips spaces as needed, and properly handles an empty string.