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 = '_-()[]'
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