schrodinger.application.matsci.smartsutilsgui module

GUI elements for working with SMARTS patterns

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.smartsutilsgui.SMARTSNameValidator(*args, **kwargs)

Bases: schrodinger.application.matsci.atomicsymbolsgui.AtomNameLabelValidator

Ensures that the line edit contains only valid SMARTS name characters

VALID_LABEL_PUNCTUATION = '_-()[]'
Acceptable = 2
Intermediate = 1
Invalid = 0
class State(value)

Bases: enum.Enum

An enumeration.

Invalid = 0
Intermediate = 1
Acceptable = 2
__init__(*args, **kwargs)

Overwrite parent to set the valid label characters dictionary on creation

blockSignals(self, bool) bool
changed

changed(self) [signal]

childEvent(self, QChildEvent)
children(self) List[QObject]
connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(QMetaObject.Connection) bool
disconnect(self) None
disconnectNotify(self, QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) List[QByteArray]
event(self, QEvent) bool
eventFilter(self, QObject, QEvent) bool
findChild(self, type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChild(self, Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) QObject
findChildren(self, type, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, name: str = '', options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, type, QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
findChildren(self, Tuple, QRegularExpression, options: Qt.FindChildOption = Qt.FindChildrenRecursively) List[QObject]
fixup(self, str) str
inherits(self, str) bool
installEventFilter(self, QObject)
isSignalConnected(self, QMetaMethod) bool
isWidgetType(self) bool
isWindowType(self) bool
killTimer(self, int)
locale(self) QLocale
metaObject(self) QMetaObject
moveToThread(self, QThread)
objectName(self) str
objectNameChanged

objectNameChanged(self, str) [signal]

parent(self) QObject
property(self, str) Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) int
removeEventFilter(self, QObject)
restoreLastValidValue(edit)

Restores edit to the last valid value validated by this Validator

Parameters

edit (QLineEdit) – The QLineEdit to restore the value to

sender(self) QObject
senderSignalIndex(self) int
setLocale(self, QLocale)
setObjectName(self, str)
setParent(self, QObject)
setProperty(self, str, Any) bool
signalsBlocked(self) bool
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) int
staticMetaObject = <PyQt6.QtCore.QMetaObject object>
thread(self) QThread
timerEvent(self, QTimerEvent)
tr(str, disambiguation: str = None, n: int = - 1) str
validate(value, position)

See PyQt documentation for arguments and return values.

schrodinger.application.matsci.smartsutilsgui.populate_smarts_edit(smarts_edit, maestro, warning, append=False, delim=' ', canvas_api=False, use_rdkit=False, fall_back=False, check_connectivity=True, allow_intermolecular=False)

Populates the smarts edit with smarts pattern grabbed from WS. If append is true then the smarts pattern is appended to smarts_edit with delim (space as default) as delimiter else smarts_edit is replaced with the given smarts pattern.

Parameters
  • smarts_edit (swidgets.SMARTSEdit) – The smarts edit on which population of smarts pattern is to be done

  • maestro (schrodinger.maestro.maestro) – maestro provides structure and selected atom index

  • warning (function) – prints warning message

  • append (bool) – If flag is true then smarts is appended to smarts_edit with delim as delimiter else smarts_edit is replaced with smarts

  • delim (str) – The delimiter used when append is true.

  • canvas_api (bool) – whether to use analyze.generate_smarts or analyze.generate_smarts_canvas

  • use_rdkit (bool) – Whether to use rdkit

  • fall_back (bool) – whether to fall back on using analyze.generate_smarts if canvas/rdkit fails, used only if canvas_api is True

  • check_connectivity (bool) – If True, check for whether the atoms given are connected and raise a ValueError if they are not. SMARTS generation will give bogus results for unconnected atoms.

  • allow_intermolecular (bool) – If check_connectivity is False this controls whether matches must be intramolecular or allowed to be intermolecular

schrodinger.application.matsci.smartsutilsgui.get_smarts_from_ws(maestro, warning, canvas_api=False, use_rdkit=False, fall_back=False, check_connectivity=True, allow_intermolecular=False)

Get the SMARTS pattern for the selected atoms in the workspace and insert it into the SMARTS entry

Parameters
  • maestro (schrodinger.maestro.maestro) – maestro provides structure and selected atom index

  • warning (function) – prints warning message

  • canvas_api (bool) – whether to use analyze.generate_smarts or analyze.generate_smarts_canvas

  • use_rdkit (bool) – Whether to use rdkit

  • fall_back (bool) – whether to fall back on using analyze.generate_smarts if canvas/rdkit fails, used only if canvas_api is True

  • check_connectivity (bool) – If True, check for whether the atoms given are connected and raise a ValueError if they are not. SMARTS generation will give bogus results for unconnected atoms.

  • allow_intermolecular (bool) – if check_connectivity is False this controls whether matches must be intramolecular or allowed to be intermolecular

Return type

str or None

Returns

smarts pattern selected from workspace or None if any of the validation fails