schrodinger.ui.residueselector module

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.

schrodinger.ui.residueselector.find_atom_with_pdb_name(res, pdb_name)

Finds atom in a residue with a given PDB name. Atom name should have no spaces. This way ‘OD1’ will match either ‘OD1 ‘ or ‘ OD1’ in a residue. If atom was not found returns None.

Parameters
  • res (structure._Residue) – residue object

  • pdb_name (str) – atom PDB name

Returns

matching PDB atom

Return type

structure._StructureAtom

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.

ALL_RESIDUES = ('ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'GLN', 'GLU', 'GLY', 'HIS', 'HIP', 'HID', 'HIE', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'SER', 'THR', 'TRP', 'TYR', 'VAL', 'ARN', 'ASH', 'GLH', 'LYN', 'CYM')
__init__()
updateAllResidues()

Restore all_residues to contain standard as well as custom residues.

validateResidueName(res_name)

Used to check whether a residue can be a mutated from or to.

Parameters

res_name (str) – The three letter name of the residue

Return type

tuple of (bool, str)

Returns

A tuple with a bool indicating validity and a string providing an explanation

getHistidineType(res)

Returns a HID/HIP/HIE string depending on the protonation of the HIS residue.

Note that this will not handle cases where the residue is missing some side chain atoms.

Parameters

res (schrodinger.structure._Residue) – The residue to assess

Return type

str

Returns

The three letter code for the residue

getLysineType(res)

Returns a LYS/LYN string depending on the protonation of the LYS residue.

Parameters

res (schrodinger.structure._Residue) – The residue to assess

Return type

str

Returns

The three letter code for the residue

getAspartateType(res)

Returns a ASP/ASH string depending on the protonation of the ASP residue.

Parameters

res (schrodinger.structure._Residue) – The residue to assess

Return type

str

Returns

The three letter code for the residue

getGlutamateType(res)

Returns a GLU/GLH string depending on the protonation of the GLU residue.

Parameters

res (schrodinger.structure._Residue) – The residue to assess

Return type

str

Returns

The three letter code for the residue

getArginineType(res)

Returns a ARG/ARN string depending on the protonation of the ARG residue.

Parameters

res (schrodinger.structure._Residue) – The residue to assess

Return type

str

Returns

The three letter code for the residue

getThreeLetterResidueCode(res)

Returns the three letter code for the residue, where the histidine type is determined based on its protonation state.

Parameters

res (schrodinger.structure._Residue) – The residue to assess

Return type

str

Returns

The three letter code for the residue

disallowedMutations(res_name)

Get all mutations that the residue is not allowed to mutate into.

Parameters

res_name (str) – The three letter name of the residue

Returns

A list of tuples with a residue name and a string providing an explanation as to why the mutation is not allowed

Return type

List[Tuple[str, str]]

updateNonStandardResidues()

Updated the internal state from the non-standard residue database.

class schrodinger.ui.residueselector.GridLayoutPopUp(parent)

Bases: schrodinger.ui.qt.pop_up_widgets.PopUp

Popup dialog with grid layout.

setup()

Subclass-specific initialization. Subclasses must implement this function.

class schrodinger.ui.residueselector.HyperlinkWithArrowWithPopUp(parent, pop_up_class=None)

Bases: schrodinger.ui.qt.pop_up_widgets._AbstractButtonWithPopUp, schrodinger.ui.qt.standard_widgets.hyperlink.ArrowLink

class schrodinger.ui.residueselector.CustomResidueMixin(*args, **kwargs)

Bases: object

Allow class to set custom residue, assign its own residue tooltip if no other tooltip is assigned.

Must be subclassed by a QWidget.

__init__(*args, **kwargs)
event(event)
setResidue(res)
Parameters

res (nonstandard_residues.AminoAcid) – non-standard amino acid (custom residue)

class schrodinger.ui.residueselector.CustomResidueCheckBox(*args, **kwargs)

Bases: schrodinger.ui.residueselector.CustomResidueMixin, PyQt6.QtWidgets.QCheckBox

class schrodinger.ui.residueselector.CustomResidueRadioButton(*args, **kwargs)

Bases: schrodinger.ui.residueselector.CustomResidueMixin, PyQt6.QtWidgets.QRadioButton

class schrodinger.ui.residueselector.MutationSelectorMixin(parent=None, single_mutation_only=False)

Bases: object

This mixin should be used with a QtWidgets.QFrame. It contains widgets for selecting residue type(s) (e.g. ALA, VAL, and GLY).

dataChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

ALT_CHARGED_RESIDUES = {'ARN', 'ASH', 'CYM', 'GLH', 'HID', 'HIE', 'HIP', 'LYN'}
getResidueGroups()
__init__(parent=None, single_mutation_only=False)
Parameters
  • parent (QtWidget.QWidget or NoneType) – the parent widget

  • single_mutation_only (bool) – whether only a single mutation is allowed.

setupToggles()

Populate the std residues, custom residues, and groups layouts with toggles 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.

setupToolTips()
getResidueToggle(residue_name)

Return the ui element for the residue or residue group.

Parameters

residue_name (str) – The name of the residue

Returns

the toggle for the residue

Return type

QtWidgets.QCheckBox or QtWidgets.QRadioButton

updateSelections()

Collect checked residues and then add any residues selected via the group checkboxes. Emits a set of selected residues.

getCheckedResidues()
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.

selectResidueToggle(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

selectAll()

Selects every enabled residue toggle in the pop up

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()

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.

clear()

De-select all residues.

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).

class schrodinger.ui.residueselector.MutationSelectorFrame(*args, widget_mode=False, **kwargs)

Bases: schrodinger.models.mappers.TargetMixin, schrodinger.ui.residueselector.MutationSelectorMixin, PyQt6.QtWidgets.QFrame

Simple mutation selector frame

__init__(*args, widget_mode=False, **kwargs)
targetSetValue(residues)
targetGetValue()
class schrodinger.ui.residueselector.MutationSelectorPopUp(parent=None, single_mutation_only=False)

Bases: schrodinger.ui.residueselector.MutationSelectorMixin, schrodinger.ui.qt.pop_up_widgets.PopUp

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).

dataChanged

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

setup()

Subclass-specific initialization. Subclasses must implement this function.

lineEditUpdated(mutations_txt)

Update this pop up in response to the user changing the line edit text. Note that, by default, this widget will not be able to send signals during execution of this method. This prevents an infinite loop of PopUp.lineEditUpdated and LineEditWithPopUp.popUpUpdated. To modify this behavior, subclass LineEditWithPopUp and reimplement LineEditWithPopUp.popUpUpdated.

Parameters

text (str) – The current text of the line edit

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)

__init__(parent, pop_up_class=<class 'schrodinger.ui.residueselector.MutationSelectorPopUp'>)
Parameters
  • parent (PyQt5.QtWidgets.QWidget) – The Qt parent widget

  • pop_up_class (type) – The class of the pop up widget. Should be a subclass of PopUp.

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

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

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).

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.

__init__(parent, pop_up_class=<class 'schrodinger.ui.residueselector.MutationSelectorPopUp'>)
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

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

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).

class schrodinger.ui.residueselector.CustomResMutationSelectorMixin(parent=None, single_mutation_only=False)

Bases: schrodinger.ui.residueselector.MutationSelectorMixin

A mutation selector mixin that allows custom residues.

setupToggles()

Populate the std residues, custom residues, and groups layouts with toggles 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.

class schrodinger.ui.residueselector.CustomResMutationSelectorFrame(parent=None, single_mutation_only=False)

Bases: schrodinger.ui.residueselector.CustomResMutationSelectorMixin, PyQt6.QtWidgets.QFrame

Mutation selector frame that allows custom residues.

Used in the “Residue Selection…” dialog and by CustomResMutationSelectorPopUp (the 2 other residue selectors).

class schrodinger.ui.residueselector.CustomResMutationSelectorPopUp(parent=None, single_mutation_only=False)

Bases: schrodinger.ui.residueselector.CustomResMutationSelectorMixin, schrodinger.ui.residueselector.MutationSelectorPopUp

Custom mutation pop up that allows custom residues.