schrodinger.application.matsci.rdpattern_gui module

GUI elements to generate and evaluate Smiles/SMARTS pattern for both CG and all atomic structure using RDKIT

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.rdpattern_gui.GuiPattern(struct, *, implicitH=False, is_cg=None, sanitize=True, include_stereo=True, fall_back=True)

Bases: Pattern, MessageBoxMixin

This class describes a pattern that can be used by graphical user interface.

evaluateSmarts(smarts, **kwargs)

Overwrite parent class to reload rdmol to obey stereochemistry in case smarts has stereo and current rdmol does not.

class schrodinger.application.matsci.rdpattern_gui.SMARTSFrame(parent=None, layout=None, tag=None, empty_ok=True, label='', indicator=True, indicator_state=1, indicator_tips=True, manage=True, show_clear=False, **kwargs)

Bases: SFrame, MessageBoxMixin

A composite widget class that contains the RDPatternSMARTSEdit, ‘Use Workspace Selection’ button and SavedSMARTSManager toolbutton

BUTTON_TEXT = 'Use Workspace Selection'
__init__(parent=None, layout=None, tag=None, empty_ok=True, label='', indicator=True, indicator_state=1, indicator_tips=True, manage=True, show_clear=False, **kwargs)
Parameters:
  • parent (QWidget) – Parent widget

  • layout (QLayout) – If supplied, this widget will be added to the layout

  • tag (str) – A string that defines the edit for use in warning messages. ex. “No valid SMARTS pattern for ‘tag’”. If not supplied, a generic message will be used.

  • empty_ok (bool) – Whether an empty edit is considered VALID or INTERMEDIATE

  • label (str) – The label preceeding the QLineEdit

  • indicator (bool) – True if a valid/invalid indicator should be appended

  • indicator_state (int) – The default state of the indicator (INDICATOR_VALID, INDICATOR_INVALID or INDICATOR_INTERMEDIATE)

  • indicator_tips (bool) – Whether to show the tooltips for the different states of the indicator

  • manage (bool) – Whether to add the SavedItemsManager toolbutton

  • show_clear (bool) – Whether to show a clear button in the line edit

getSMARTSSettings()

Return the SMARTS read from the smarts_edit widget

Returns:

SMARTS

Return type:

str

setSMARTSSettings(smarts_settings)

Set the SMARTS to the smarts_edit widget

Parameters:

smarts_settings (str or dict) – SMARTS as simple string or as dict

isValid()

Return True if valid, False otherwise.

Returns:

True if valid

Return type:

bool

reset()

Reset the SMARTS edit widget

class schrodinger.application.matsci.rdpattern_gui.RDPatternSMARTSEdit(*args, **kwargs)

Bases: SMARTSEdit

__init__(*args, **kwargs)

Override parent method to add a SMARTS logic-graph visualizer button next to the validity indicator.

addVisualizerButton()

Create and append the visualizer button to the widget layout.

The button is enabled only when the SMARTS is valid.

onSMARTSTextChanged()

Disable the visualizer button while the user is mid-edit.

onValidSMARTS()

Enable the visualizer button once a valid SMARTS has been confirmed.

showVisualizerDialog()

Open the SMARTS logic-graph dialog and apply its final pattern.