schrodinger.application.jaguar.gui.input_tab_widgets_pka module

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.AtomType

Bases: Enum

Hydrogen = 1
NonHydrogen = 2
NonAtom = 3
schrodinger.application.jaguar.gui.input_tab_widgets_pka.filter_hydrogen_from_list(atom_list, return_h)

Filter a given atom_list to return only hydrogen atoms or only non-hydrogen atoms.

Parameters:
  • atom_list (list or None) – a list of workspace atoms represented as strings (e.g. [“H1”, “O2”, “N3”]) that can contain both hydrogen and non-hydrogen atoms.

  • return_h (bool) – Whether or not to return only hydrogen atoms. If True, only hydrogen atoms are returned. If False, only non-hydrogen atoms are returned.

Returns:

A filtered list of atoms represented as strings with either all hydrogen atoms removed or only hydrogen atoms remaining. Returns None if the filtered list is empty. Also returns None if the supplied atom_list is empty or is None.

Return type:

list(str) or NoneType

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.ProjEntryTuplePka(entry_id, struc, charge, spin_mult, pka_atom)

Bases: tuple

charge

Alias for field number 2

entry_id

Alias for field number 0

pka_atom

Alias for field number 4

spin_mult

Alias for field number 3

struc

Alias for field number 1

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.ProjEntryTupleMacroPka(entry_id, struc, range_min, range_max, pka_indexes)

Bases: tuple

entry_id

Alias for field number 0

pka_indexes

Alias for field number 4

range_max

Alias for field number 3

range_min

Alias for field number 2

struc

Alias for field number 1

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.InputEntriesColumnsPka

Bases: object

Column constants for the pKa selected entries table

HEADERS = ['ID', 'In', 'Entry Title', 'Charge', 'Spin Mult.', 'pKa Atom (Add H⁺)', 'pKa Atom (Remove H⁺)']
NUM_COLS = 7
ID = 0
INCLUSION = 1
TITLE = 2
CHARGE = 3
SPIN_MULT = 4
PKA_ATOM_ADD = 5
PKA_ATOM_REMOVE = 6
BASIS = -1
THEORY = -1
class schrodinger.application.jaguar.gui.input_tab_widgets_pka.InputEntriesColumnsMacroPkaByPka

Bases: object

Column constants for the Macro pKa selected entries table with pKa range

HEADERS = ['ID', 'In', 'Entry Title', 'Min pKa', 'Max pKa', 'Active Atoms']
NUM_COLS = 6
ID = 0
INCLUSION = 1
TITLE = 2
MIN_COL = 3
MAX_COL = 4
ACTIVE = 5
RANGE_COLUMNS = (3, 4)
BASIS = -1
THEORY = -1
class schrodinger.application.jaguar.gui.input_tab_widgets_pka.InputEntriesColumnsMacroPkaByCharge

Bases: InputEntriesColumnsMacroPkaByPka

Column constants for the Macro pKa selected entries table with charge range

HEADERS = ['ID', 'In', 'Entry Title', 'Min Relative Charge', 'Max Relative Charge', 'Active Atoms']
class schrodinger.application.jaguar.gui.input_tab_widgets_pka.ProjEntryPka(row=None)

Bases: ProjEntry

Builds upon ProjEntry by introducing support for storing data for the “Add H+” and “Remove H+” pKa columns.

PKA_ATOM_PROP = 's_m_pKa_atom'
PKA_VALID = 0
PKA_INVALID = 1
PKA_MISSING = 2
PKA_COLUMN_INVALID = 3
COLUMN

alias of InputEntriesColumnsPka

__init__(row=None)

Instantiate a new object

Parameters:

row (schrodinger.project.ProjectRow or NoneType) – The project row. If not provided, no data will be loaded.

update(row)

Builds upon ProjEntryPka.update() to update the pKa atom data if there are no pka atoms at all.

getStructureWithJagNames()

Return the entry structure with jaguar atom naming applied

Returns:

The structure with jaguar atom naming applied

Return type:

schrodinger.structure.Structure

reset()

Reset any user-specified settings

getPkaAtom(col_num)

Get either pka_atom_add or pka_atom_remove given the supplied column. Raise an error if supplied table column is not one of the two pKa atom columns.

Parameters:

col_num (int) – The table column number for which to return a pKa_atom list.

Returns:

A list of pKa atoms or None if there are no pKa atoms in the corresponding pka_atom attribute.

Return type:

list(str) or None

getPkaAtoms()

Get a combined list of all atoms in pka_atom_add and pka_atom_remove.

Returns:

A list of pKa atoms or None if there are no pKa atoms in either pka_atom attribute.

Return type:

list(str) or None

checkPkaAtom(col_num)

Make sure that a valid pKa atom(s) is specified in the given pKa atom column.

Parameters:

col_num (int) – The table column number to display pKa data for.

Returns:

PKA_VALID if all valid pKa atoms are specified, PKA_INVALID if any invalid pKa atom is specified, and PKA_MISSING if no pKa atom is specified.

Return type:

int

Raises:

ValueError – if the column number passed into getPkaAtom() corresponds to neither the “Add H+” nor the “Remove H+” column.

checkPkaAtoms()

Aggregate the results of checkPkaAtom() on both pKa atom columns.

Returns:

PKA_VALID if all pKa atoms in this project entry are valid, PKA_INVALID if any invalid pKa atom is specified anywhere, and PKA_MISSING if no pKa atom is specified.

getPkaAtomObjs()

Get a list of currently selected pKa atom(s) object(s) from both pKa columns.

Returns:

If the currently selected pKa atom(s) is valid, returns the list of atoms itself. Otherwise, returns None.

Return type:

list(_StructureAtom) or NoneType

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.PickingModes

Bases: Enum

MANUAL = 1
AUTO = 2
SMARTS = 3
class schrodinger.application.jaguar.gui.input_tab_widgets_pka.InputEntriesModelPka(parent)

Bases: InputEntriesModel

The data model for the pKa selected entries table. There are two columns that hold pKa atom values, “pKa Atom (Add H+)” and “pKa Atom (Remove H+)”. The idea being that only non H-atoms can be in the “Add H+” column and only H-atoms can be in the “Remove H+ column.

Variables:
  • set_pka_marker (PyQt5.QtCore.pyqtSignal) –

    A signal emitted when a new pKa atom should be marked in the workspace. Emitted with two arguments:

    • The entry id of the structure to be marked (str)

    • The atom to be marked (schrodinger.structure._StructureAtom)

  • projUpdated – A signal emitted when the project changes which should trigger a SMARTS search again if picking mode is SMARTS

COLUMN

alias of InputEntriesColumnsPka

PKA_COLUMNS = (5, 6)
set_pka_marker

A pyqtSignal emitted by instances of the class.

projUpdated

A pyqtSignal emitted by instances of the class.

ROW_CLASS

alias of ProjEntryPka

__init__(parent)
setPickingMode(mode)

Set the picking mode. This impacts what is shown in the pKa atom columns.

Parameters:

mode (PickingModes) – the new picking mode

data(self, index: QModelIndex, role: int = Qt.DisplayRole) Any
headerData(section, orientation, role=ItemDataRole.DisplayRole)

Override InputEntriesModel to allow special coloring of the pKa column headers.

These colors are darker than the WS atom marker colors because they appear against a light background.

flags(index)

Enable or disable the pka column depending on whether manual editing is enabled or not

Parameters:

index (QtCore.QModelIndex) – The model index to get flags for.

setData(index, value, role=ItemDataRole.EditRole)

Set data for the specified index. The spin multiplicity tool tip will be shown if an invalid spin multiplicity is set, or if a charge is set that renders the spin multiplicity invalid. (The tool tip explains that the default spin multiplicity is being used because the user-specifed value is invalid.)

Parameters:
  • index (QtCore.QModelIndex) – The index to modify

  • value – The value to set

  • role (int) – The role to set data for. Must be Qt.EditRole or setting will fail.

Returns:

True if setting succeeded. False if it failed.

Return type:

bool

updatePkaAtomsFromSmarts(smarts_models)

Update pKa atoms of entry rows based on patterns given by a list of SMARTS patterns and atom positions.

Parameters:

smarts_models (list(SmartsPageModel)) – a list of smarts patterns to search for in each structure. The list may be empty.

projectUpdated()

Update the table when the project is updated

getStructures()

Get a list of all structures loaded into the table (i.e. all structures selected in the project table) and the associated settings.

Returns:

A list of ProjEntryTuple objects

Return type:

list

checkPkaAtoms()

Make sure that all structure have a valid pKa atom selected

Returns:

A tuple of - A list of structures with invalid pKa atoms - A list of structures with no pKa atom

Return type:

tuple

addPkaMarkers(index, start_row, end_row)

Add pKa workspace atom markers for the specified rows

Parameters:
  • index – Not used, but present for Qt compatability

  • start_row (int) – The first row to add a pKa marker to

  • end_row (int) – The last row to add a pKa marker to

reshowPkaMarkers()

Redisplay workspace markers in case they were turned off

removeAllPkaMarkers()

Remove all pKa markers for all rows

removePkaMarkers(index, start_row, end_row)

Remove the pKa workspace atom markers for the specified rows

Parameters:
  • index – Not used, but present for Qt compatibility

  • start_row (int) – The first row to add a pKa marker to

  • end_row (int) – The last row to add a pKa marker to

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.InputEntriesViewPka(parent=None, sample_data=None)

Bases: SampleDataTableViewMixin, InputEntriesView

The view for the pKa selected entries table. SampleDataTableViewMixin makes sure the default table width is large enough to make all columns visible.

Variables:

set_pka_marker (PyQt5.QtCore.pyqtSignal) –

A signal emitted when a new pKa atom should be marked in the workspace. Emitted with two arguments:

  • The entry id of the structure to be marked (str)

  • List of atoms (schrodinger.structure._StructureAtom) to be marked

COLUMN

alias of InputEntriesColumnsPka

MACRO_COLUMN

alias of InputEntriesColumnsMacroPkaByPka

set_pka_marker

A pyqtSignal emitted by instances of the class.

onStructureChanged()
setDelegates(editable=True, macro=False)

Add delegates to the appropriate columns

Parameters:
  • editable (bool) – Whether pKa atom columns are editable or not

  • macro (bool) – Whether this is for the macro (True) or micro (False) table

setEditablePkaAtomDelegate(editable)

Add the delegates to the pKa column

Parameters:

editable – Whether to set the editable default message delegate or to set the Qt default delegate

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.SmartsPageModel(*args, _param_type=<object object>, **kwargs)

Bases: CompoundParam

Model for a single page which contains the a single smarts string and single atom position index.

atom_pos: int

A parameter of the class.

smarts: str

A parameter of the class.

atom_posChanged

A pyqtSignal emitted by instances of the class.

atom_posReplaced

A pyqtSignal emitted by instances of the class.

smartsChanged

A pyqtSignal emitted by instances of the class.

smartsReplaced

A pyqtSignal emitted by instances of the class.

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.PkaPage(*args, **kwargs)

Bases: MapperMixin, BaseWidget

model_class

alias of SmartsPageModel

ui_module = <module 'schrodinger.application.jaguar.gui.ui.pka_smarts_page_ui' from '/scr/buildbot/builds/core-suite-build/core-suite-build/build/internal/lib/python3.11/site-packages/schrodinger/application/jaguar/gui/ui/pka_smarts_page_ui.py'>
initSetUp()

Creates widget from ui and stores it ui_widget.

Suggested subclass use: create and initialize subwidgets, and connect signals.

updateSpinBoxLimits()

Update limits of atom position spin box to reflect the number of atoms in the SMARTS string

defineMappings()

Override this in the subclass to define mappings. Should return a list of tuples [(<target>, <param>)]. Targets can be:

  1. a basic widget, like QLineEdit or QComboBox

  2. a custom object that inherits MapperMixin or TargetMixin

  3. a TargetSpec instance

  4. a slot

For common widgets, standard signals and getter/setter methods will be used, as defined in mappers._get_default_access_names().

For more fine-grained custom control, instantiate a TargetSpec object, which allows custom setters, getters, and signals to be specified.

Supplying a slot as the first element of the tuple is equivalent to providing TargetSpec(slot=my_slot).

Note that all target slots are triggered on setModel() as well as in response to the specified signal.

The param is an abstract param reference, e.g. MyModel.my_param.

Example:

def defineMappings(self):
    combo = self.style_combo
    return [(self.name_le, MyModel.name),
            (TargetSpec(combo,
                    getter=combo.currentText,
                    setter=combo.setCurrentText), MyModel.style),
            (self.coord_widget, MyModel.coord),
            (self._onASLTextChanged, MyModel.asl_text)]
getFromSelection()

Get smarts from selected atoms in workspace and add it to the current page

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.SmartsSelector(parent)

Bases: PopUp, BaseWidget

A popup widget that allows users to specify any number of SMARTS strings to specify pka atoms as well as an atom position which specifies the atom in the SMARTS

closed

A pyqtSignal emitted by instances of the class.

ui_module = <module 'schrodinger.application.jaguar.gui.ui.define_smarts_panel_ui' from '/scr/buildbot/builds/core-suite-build/core-suite-build/build/internal/lib/python3.11/site-packages/schrodinger/application/jaguar/gui/ui/define_smarts_panel_ui.py'>
setup()

Needs to be implemented for PopUp widgets

initSetUp()

Creates widget from ui and stores it ui_widget.

Suggested subclass use: create and initialize subwidgets, and connect signals.

addPage()

Add an additional page for specifying SMARTS

removeCurrentPage()

Remove the current page. If there was only one page before removing, add another after so there is always one page.

next()

Show next page of stacked widget

back()

Show previous page of stacked widget

updatePagination()

Enable or disable forward and back button based on current page index and number of pages and update label indicating current page

getModels()

Get the models for the Smarts Pages

Returns:

A list of the models

Return type:

list(SmartsPageModel)

closeEvent(self, a0: Optional[QCloseEvent])
class schrodinger.application.jaguar.gui.input_tab_widgets_pka.SmartsSelectorButton(parent)

Bases: ToolButtonWithPopUp

A tool button that opens the Smarts Selector when pressed

__init__(parent)
Parameters:

parent (PyQt5.QtWidgets.QWidget) – The Qt parent widget

getModels()

Get the list of models for each SMARTS page

Returns:

The list of moels for each SMARTS page

Return type:

list(SmartsPageModel)

showSmartsSelector()

Show the popup. This gets called by the input tab to manually show the popup

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.AtomSelectionDelegate(parent)

Bases: CommitMultipleDelegate, DefaultMessageDelegate

A delegate for selecting a pKa atom. The atom name can either be typed into the line edit or selected from the workspace. A tool tip containing instructions will appear when the editor is first open and any time the user hovers their mouse over the editor. If the user clicks on an atom from the wrong structure, the atom will be ignored and a tool tip warning will appear. Clicking on an atom does not close the editor so that the user can immediately pick a different atom if desired. Valid atoms will be immediately added to the model upon clicking.

Variables:

set_pka_marker (PyQt5.QtCore.pyqtSignal) –

A signal emitted when a new pKa atom should be marked in the workspace. Emitted with two arguments:

  • The entry id of the structure to be marked (str)

  • List of atoms (schrodinger.structure._StructureAtom) to be marked

MAESTRO_BANNER_REMOVE_H = 'Pick protons to be removed'
MAESTRO_BANNER_ADD_H = 'Pick atoms to add a proton to'
TOOL_TIP_INSTRUCTIONS = 'Click an atom in the workspace to\nset it as the pKa atom or type the\natom name here.'
TOOL_TIP_WRONG_EID = 'The atom you selected is not\npart of this structure.'
set_pka_marker

A pyqtSignal emitted by instances of the class.

__init__(parent)
resetEditor()
createEditor(self, parent: Optional[QWidget], option: QStyleOptionViewItem, index: QModelIndex) Optional[QWidget]
pickingMessage(index)

Get the message to display in the WS banner when picking

Parameters:

index (QtCore.QModelIndex) – the index for the active table cell

Return type:

str or None

Returns:

The message to display, or None if index is not from a picking column

setEditorData(self, editor: Optional[QWidget], index: QModelIndex)
setModelData(editor, model, index)

Set the model data at the appropriate index according to the atoms currently present in the editor. Gets called every time a valid atom is clicked as well as when the delegate is closed (i.e. can only delete atoms upon closing the delegate).

An editor may only add/remove atoms that belong in its own column. I.e. the “Add H+” editor can only add/remove non-hydrogen atoms to the model. Conversely, the “Remove H+” editor may only add/remove hydrogen atoms to the model.

Parameters:
  • editor (PyQt5.QtWidgets.QLineEdit) – The line edit to enter the atom name into

  • model (InputEntriesModelPka) – The table model to edit at the given index.

  • index (PyQt5.QtCore.QModelIndex) – The index of the table cell being edited

validateAtom(index, model, atom)

Verify that the picked atom is valid

Parameters:
  • index (QtCore.QModelIndex) – The index for the cell the atom will get added to

  • model (InputEntriesModelPka) – the model the data will get added to

  • atom (structure._StructureAtom) – The picked atom

Return type:

bool

Returns:

Whether the atom is valid for the cell at the given index

eventFilter(editor, event)

Make sure that the editor doesn’t close when the user clicks on another window since that will prevent the user from being able to click on an atom.

Parameters:
  • editor (PyQt5.QtWidgets.QWidget) – The pKa atom line edit

  • event – A Qt event

  • event – PyQt5.QtCore.QEvent

Note:

We don’t need to worry about the case where the user clicks on a different widget in the pKa panel after selecting an atom. Since the editor was the last widget with focus in the pKa panel, it will receive another FocusOut event when the other widget receives focus, and that FocusOut event will cause the editor to close.

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.MacroAtomSelectionDelegate(parent)

Bases: AtomSelectionDelegate

The delegate for the Macro pKa column that picks active atoms

MAESTRO_BANNER = 'Pick active pKa atoms'
pickingMessage(index)

Get the message to display in the WS banner when picking

Parameters:

index (QtCore.QModelIndex) – the index for the active table cell

Return type:

str or None

Returns:

The message to display, or None if index is not from a picking column

validateAtom(index, model, atom)

Verify that the picked atom is valid

Parameters:
  • index (QtCore.QModelIndex) – The index for the cell the atom will get added to

  • model (InputEntriesModelPka) – the model the data will get added to

  • atom (structure._StructureAtom) – The picked atom

Return type:

bool

Returns:

Whether the atom is valid for the cell at the given index

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.ProjEntryMacroPkaByPka(*args, **kwargs)

Bases: ProjEntryPka

A project entry class for the macro pKa table when using pKa

COLUMN

alias of InputEntriesColumnsMacroPkaByPka

__init__(*args, **kwargs)

Instantiate a new object

Parameters:

row (schrodinger.project.ProjectRow or NoneType) – The project row. If not provided, no data will be loaded.

update(row)

Builds upon ProjEntryPka.update() to update the pKa atom data if there are no pka atoms at all.

getPkaAtom(col_num)

Get the atoms currently set for the given column.

Parameters:

col_num (int) – The table column number for which to return a pKa_atom list.

Returns:

A list of pKa atoms or None if there are no pKa atoms in the corresponding pka_atom attribute.

Return type:

list(str) or None

Raises:

ValueError – If the column is not the active atom column

checkPkaAtoms()

Check if the pKa active atoms are populated and valid

Returns:

PKA_VALID if all pKa atoms in this project entry are valid, PKA_INVALID if any invalid pKa atom is specified anywhere, and PKA_MISSING if no pKa atom is specified.

getStrucEid()

Get the entry ID and structure for this row

Return type:

(str, structure.Structure)

Returns:

The entry ID and structure

reset()

Reset user-specified data for this row

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.ProjEntryMacroPkaByCharge(*args, **kwargs)

Bases: ProjEntryMacroPkaByPka

A project entry class for the macro pKa tables when using charge

COLUMN

alias of InputEntriesColumnsMacroPkaByCharge

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.InputEntriesModelMacroPkaByPka(*args, **kwargs)

Bases: InputEntriesModelPka

The data model for the macro pKa selected entries table when using pKa

COLUMN

alias of InputEntriesColumnsMacroPkaByPka

ROW_CLASS

alias of ProjEntryMacroPkaByPka

DEFAULT_RANGE = (2.0, 12.0)
RANGE_LIMITS = {260: -100, 261: 100}
MIN_MAX_DELTA = 1.0
PKA_COLUMNS = (5,)
__init__(*args, **kwargs)
headerData(section, orientation, role=ItemDataRole.DisplayRole)

Override InputEntriesModel to allow special coloring of the pKa column headers.

These colors are darker than the WS atom marker colors because they appear against a light background.

setPkaAtomsForEid(eid, indexes)

Set the active pKa atoms for the structure with the given entry id

Parameters:
  • eid (str) – The entry ID to set the indexes for

  • indexes (list) – Each item is the atom index of an active pKa atom

Raises:

ValueError – If eid is not found in the current table rows

setBoxes(boxes)

Set the spinboxes that will determine the default min/max range

Parameters:

boxes (tuple) – A tuple of (min_spinbox, max_spinbox)

limitModified()

React to one or both of the range limits getting modified

setData(index, value, role=ItemDataRole.EditRole)

Set data for the specified index.

Parameters:
  • index (QtCore.QModelIndex) – The index to modify

  • value – The value to set

  • role (int) – The role to set data for. Must be Qt.EditRole or setting will fail.

Returns:

True if setting succeeded. False if it failed.

Return type:

bool

setDefaultRangeLimit(column, value)

Set a new default range limit

Parameters:
  • column (int) – The column the limit is being set for. Must be one of the columns in COLUMN.RANGE_COLUMNS

  • value (int) – The new limit

getStructures()

Get a list of data for all structures loaded into the table (i.e. all structures selected in the project table) and the associated settings.

Returns:

A list of ProjEntryTupleMacroPka objects

Return type:

list

getRangeLimit(proj_row, col)

Get the current limit for the given row and column. The current limit can either be set specifically for this row or taken from the default for this model if it is not set for this row.

Parameters:
Returns:

The int is the range limit for the given row and column, the bool is True if this limit was set specifically for this column, False if it was taken from the model default

Return type:

int, bool

flags(index)

Get the QItemFlags for the cell with this index

Parameters:

index (QtCore.QModelIndex) – The index to get the flags for

Returns:

The flags for this cell

Return type:

QtCore.QItemFlags

reset()

Reset all settings

class schrodinger.application.jaguar.gui.input_tab_widgets_pka.InputEntriesModelMacroPkaByCharge(*args, **kwargs)

Bases: InputEntriesModelMacroPkaByPka

The data model for the macro pKa selected entries table when using charge

COLUMN

alias of InputEntriesColumnsMacroPkaByCharge

ROW_CLASS

alias of ProjEntryMacroPkaByCharge

DEFAULT_RANGE = (0, 1)
RANGE_LIMITS = {260: -10, 261: 10}
MIN_MAX_DELTA = 1