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=False)

Bases: schrodinger.application.matsci.rdpattern.Pattern, schrodinger.ui.qt.widgetmixins.basicmixins.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.

PROTECTED_PATTERN_BIT = ['D', 'R', 'r', 'v', 'x', 'X', 'H']
__init__(struct, *, implicitH=False, is_cg=None, sanitize=True, include_stereo=True, fall_back=False)

Initiate Pattern class

Parameters
  • struct (schrodinger.structure.Structure) – Structure for which patterns need to be selected

  • implicitH (bool) – Should hydrogens be listed implicitly? If False, hydrogens will be included in the connectivity graph, and 3D coordinates and properties of the hydrogens will be translated. Some pattern matching in RDKit requires implicit hydrogens, however.

  • is_cg (bool or None) – Whether structure is CG. If None, perform a check

  • sanitize (bool) – Whether RDKit sanitization should be performed. This option is not applicable for coarsegrained structures.

  • include_stereo (bool) – Whether the stereochemistry of the structure should be translated into the RDKit mol. Setting to False can speed this up substantially.

  • fall_back (bool) – Ignored if sanitize=False. If sanitize=True, will fall back to using a non-sanitized structure if sanitization fails.

clearCache()

Clear cache

error(*args, **kwargs)

Shows a popup error message box. For parameter documentation see messagebox.MessageBox.

evaluateSmiles(**kwargs)
forgetMessageBoxResponse(key)

Forgets any previously saved response that was stored via a save_response_key.

Parameters

key – the key for the response to forget

getDetailedAtomSmarts(**kwargs)
getMoleculeSmarts()

Get SMARTS for each molecule in the structure

Returns

The dictionary where the key is the molecule number and the value is the corresponding SMARTS pattern

Return type

dict

getMoleculeSmiles()

Get SMILES for each molecule in the structure

Returns

The dictionary where the key is the molecule number and the value is the corresponding SMILES pattern

Return type

dict

getPattern(atom_ids=None, is_smiles_requested=False, isomeric=True)

Get SMILES/SMARTS for full structure or for substructure of given atom ids.

Parameters
  • atom_ids (list) – list of atom indices

  • is_smiles_requested (bool) – return Smiles pattern if True else Smarts

  • isomeric (bool) – include information about stereochemistry in the SMILES/SMARTS

Return type

str

Returns

SMILES pattern for the atom ids provided

getUniqueMolNums(use_smarts=False)

Get the unique representative molecules in the structure. This function can be upto 50 times slower than extracting molecules individually for small molecules like water.

Parameters

use_smarts (bool) – If true the unique molecules will share the same SMARTS pattern. If false the unique molecules will share the same SMILES pattern.

Return type

list

Returns

list of molecule numbers that are unique

info(*args, **kwargs)

Shows a popup information message box. For parameter documentation see messagebox.MessageBox.

loadMol()

Load rdkit mol in the pattern

particleNameToProxy(smarts)

If the structure is a coarse grain structure convert the SMARTS pattern of coarse grain particle name to proxy element name. Does nothing for atomistic structures

Parameters

smarts (str) – The SMARTS pattern

Returns

The translated SMARTS pattern

Return type

str

static patternTranslate(s_pattern, mapper)

Replace passed SMARTS/SMILES such that the mapper key values are replaced by

Parameters
  • s_pattern (str) – The SMARTS/SMILES pattern to change

  • mapper (dictionary where the key is the element name to find in the pattern and value is the name to replace it with) – The mapper used to convert the SMARTS/SMILES pattern

Returns

the converted SMARTS/SMILES pattern

Return type

str

proxyToParticleName(smarts)

If the structure is a coarse-grained structure convert the SMARTS pattern of proxy elements to coarse grain particle name. Does nothing for atomistic structures

Parameters

smarts (str) – The SMARTS pattern

Returns

The translated SMARTS pattern

Return type

str

question(*args, **kwargs)

Shows a popup question message box. For parameter documentation see messagebox.QuestionMessageBox.

property sanitized

Get whether the structure was sanitized or not

Returns

sanitization status of the structure

Return type

bool

showMessageBox(*args, **kwargs)

Shows a popup message box. For parameter documentation see messagebox.MessageBox.

property smarts

Get the SMARTS for the passed structure

Returns

SMARTS pattern for the passed structure

Return type

str

property smiles

Get the SMILES for the passed structure

Returns

SMILES pattern for the passed structure

Return type

str

toRdIndices(particle_indices)

Convert list of Schrodinger structure particle indices to RDMol atom indices

Parameters

particle_indices (tuple) – tuple of Schrodinger structure particle indices

Return type

list

Returns

list of RDMol atom indices

toSmarts(**kwargs)
toSmiles(**kwargs)
toStIndices(particle_indices)

Convert list of RDMol atom indices to Schrodinger structure particle indices

Parameters

particle_indices (tuple) – tuple of RDMol atom indices

Return type

list

Returns

list of Schrodinger structure particle indices

validateSmarts(smarts)

Validate the passed smarts pattern

Parameters

smarts (str) – SMARTS to validate

Return type

str or None

Returns

Error message on error, None if SMARTS is valid

warning(*args, **kwargs)

Shows a popup warning message box. For parameter documentation see messagebox.MessageBox.