schrodinger.application.matsci.smartsutils module¶
Utilities for working with SMARTS patterns
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.application.matsci.smartsutils.SMARTSGroupData(number, name, pattern, indexes)¶ Bases:
tuple-
__add__¶ Return self+value.
-
__class__¶ alias of
builtins.type
-
__contains__¶ Return key in self.
-
__delattr__¶ Implement delattr(self, name).
-
__dir__() → list¶ default dir() implementation
-
__eq__¶ Return self==value.
-
__format__()¶ default object formatter
-
__ge__¶ Return self>=value.
-
__getattribute__¶ Return getattr(self, name).
-
__getitem__¶ Return self[key].
-
__getnewargs__()¶ Return self as a plain tuple. Used by copy and pickle.
-
__gt__¶ Return self>value.
-
__hash__¶ Return hash(self).
-
__init__¶ Initialize self. See help(type(self)) for accurate signature.
-
__init_subclass__()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__iter__¶ Implement iter(self).
-
__le__¶ Return self<=value.
-
__len__¶ Return len(self).
-
__lt__¶ Return self<value.
-
__module__= 'schrodinger.application.matsci.smartsutils'¶
-
__mul__¶ Return self*value.n
-
__ne__¶ Return self!=value.
-
static
__new__(_cls, number, name, pattern, indexes)¶ Create new instance of SMARTSGroupData(number, name, pattern, indexes)
-
__reduce__()¶ helper for pickle
-
__reduce_ex__()¶ helper for pickle
-
__repr__()¶ Return a nicely formatted representation string
-
__rmul__¶ Return self*value.
-
__setattr__¶ Implement setattr(self, name, value).
-
__sizeof__() → int¶ size of object in memory, in bytes
-
__slots__= ()¶
-
__str__¶ Return str(self).
-
__subclasshook__()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
count(value) → integer -- return number of occurrences of value¶
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
indexes¶ Alias for field number 3
-
name¶ Alias for field number 1
-
number¶ Alias for field number 0
-
pattern¶ Alias for field number 2
-
-
schrodinger.application.matsci.smartsutils.validate_name(name)¶ Make sure name has the correct set of characters
Parameters: name (str) – The string to check Return type: bool Returns: True if name has no invalid characters, False if any characters are invalid
-
exception
schrodinger.application.matsci.smartsutils.SMARTSGroupError¶ Bases:
ExceptionClass for exceptions related to SMARTS group finding
-
__cause__¶ exception cause
-
__class__¶ alias of
builtins.type
-
__context__¶ exception context
-
__delattr__¶ Implement delattr(self, name).
-
__dict__= mappingproxy({'__module__': 'schrodinger.application.matsci.smartsutils', '__doc__': ' Class for exceptions related to SMARTS group finding ', '__weakref__': <attribute '__weakref__' of 'SMARTSGroupError' objects>})¶
-
__dir__() → list¶ default dir() implementation
-
__eq__¶ Return self==value.
-
__format__()¶ default object formatter
-
__ge__¶ Return self>=value.
-
__getattribute__¶ Return getattr(self, name).
-
__gt__¶ Return self>value.
-
__hash__¶ Return hash(self).
-
__init__¶ Initialize self. See help(type(self)) for accurate signature.
-
__init_subclass__()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__¶ Return self<=value.
-
__lt__¶ Return self<value.
-
__module__= 'schrodinger.application.matsci.smartsutils'¶
-
__ne__¶ Return self!=value.
-
__new__()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__()¶ helper for pickle
-
__reduce_ex__()¶ helper for pickle
-
__repr__¶ Return repr(self).
-
__setattr__¶ Implement setattr(self, name, value).
-
__setstate__()¶
-
__sizeof__() → int¶ size of object in memory, in bytes
-
__str__¶ Return str(self).
-
__subclasshook__()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__suppress_context__¶
-
__traceback__¶
-
__weakref__¶ list of weak references to the object (if defined)
-
args¶
-
with_traceback()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
schrodinger.application.matsci.smartsutils.delete_group_properties(struct)¶ Delete all SMARTS group properties (structure and atom) from the structure
Parameters: struct ( schrodinger.structure.Structure) – The structure to delete properties from
-
schrodinger.application.matsci.smartsutils.find_group_data(struct)¶ Find an SMARTS group data on the structure
Parameters: struct ( schrodinger.structure.Structure) – The structure to find groups onReturn type: dict Returns: A dictionary. Keys are smarts group numbers, values are SMARTSGroupDatanamed tuples for the SMARTS group with that numberRaises: SMARTSGroupError – If something in the data is not consistent
-
schrodinger.application.matsci.smartsutils.get_rdkit_atoms(smarts)¶ Return a collection of rdkit atoms for the given SMARTS. The return value has the length of a potential match group, for example for ‘cc’ this length is 2, for ‘[$([NH]([CH2])[CH2])]C’ it is 2, for [n-0X2].[n-0X2] it is 2, etc., even though there might be any number of matches if the pattern was matched.
Parameters: smarts (str) – the SMARTS pattern Raises: RuntimeError – if rdkit has a problem with the SMARTS Return type: rdkit.Chem.rdchem._ROAtomSeq Returns: the rdkit atoms
-
schrodinger.application.matsci.smartsutils.is_smarts_bonding_pair(smarts)¶ Return True if the given SMARTS would match a bonding pair, False otherwise.
Parameters: smarts (str) – the SMARTS pattern Return type: bool Returns: True if the SMARTS would match a bonding pair, False otherwise