schrodinger.structutils.markush_enumerate module¶
Support for “R-group” enumeration as in ENUM-108.
-
class
schrodinger.structutils.markush_enumerate.PlaceHolder(group_id, atom, bonds)¶ 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.structutils.markush_enumerate'¶
-
__mul__¶ Return self*value.n
-
__ne__¶ Return self!=value.
-
static
__new__(_cls, group_id, atom, bonds)¶ Create new instance of PlaceHolder(group_id, atom, bonds)
-
__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).
-
atom¶ Alias for field number 1
-
bonds¶ Alias for field number 2
-
count(value) → integer -- return number of occurrences of value¶
-
group_id¶ Alias for field number 0
-
index(value[, start[, stop]]) → integer -- return first index of value.¶ Raises ValueError if the value is not present.
-
-
schrodinger.structutils.markush_enumerate.get_placeholders(st, groups=None)¶ Gathers placeholders metadata.
Parameters: - st (
schrodinger.structure.Structure) – Structure. - groups – Dictionary that maps placeholder atom indices onto
their group IDs. If
None, regard atoms that carry the “GROUP_ID_PROP” property as “placeholders”.
Returns: List of the placeholders records.
Return type: list(PlaceHolder)
Raises: ValueError if something about
stlooks not right.- st (
-
schrodinger.structutils.markush_enumerate.get_attachment_points(st)¶ Returns ordered list of attachment points in
st. The order is either based upon atom labels (“ATTACHMENT_PROP”, if available) or decided by the bond order and the peer atom atomic number.Returns: List of atoms. Return type: list(int)
-
class
schrodinger.structutils.markush_enumerate.Scaffold(st, groups=None)¶ Bases:
objectHolds reference to the “scaffold” structure. Knows how to join R-groups to the core.
-
__init__(st, groups=None)¶ Parameters: groups (dict(int, int) or None) – Dictionary that maps atom indices onto “group IDs”. If None, use “GROUP_ID_PROP” to identify the “placeholder” atoms.
-
fragmentIDs¶ Returns set of fragment IDs.
-
populate(fragments)¶ Replaces placeholders with fragments.
Parameters: fragments (dict(int, schrodinger.structure.Structure)) – Indexable that maps fragment IDs onto structures.
-
__class__¶ alias of
builtins.type
-
__delattr__¶ Implement delattr(self, name).
-
__dict__= mappingproxy({'__module__': 'schrodinger.structutils.markush_enumerate', '__doc__': '\n Holds reference to the "scaffold" structure. Knows how to join\n R-groups to the core.\n ', '__init__': <function Scaffold.__init__>, 'fragmentIDs': <property object>, 'populate': <function Scaffold.populate>, '__dict__': <attribute '__dict__' of 'Scaffold' objects>, '__weakref__': <attribute '__weakref__' of 'Scaffold' 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_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.structutils.markush_enumerate'¶
-
__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).
-
__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).
-
__weakref__¶ list of weak references to the object (if defined)
-
-
schrodinger.structutils.markush_enumerate.validate_fragment(st)¶ Parameters: st ( schrodinger.structure.Structure) – Structure.Raises: ValueError if there is no attachment points.
-
schrodinger.structutils.markush_enumerate.validate_scaffold(st)¶ Parameters: st ( schrodinger.structure.Structure) – Structure.Raises: ValueError if there is no placeholders.
-
schrodinger.structutils.markush_enumerate.convert_fragment_from_v3000(st)¶ Converts fragment metadata from MDL V3000 conventions to the ones expected by this module.
Parameters: st ( schrodinger.structure.Structure) – Structure.Raises: ValueError if something goes wrong.
-
schrodinger.structutils.markush_enumerate.convert_scaffold_from_v3000(st)¶ Converts scaffold metadata from MDL V3000 conventions to the ones expected by this module.
Parameters: st ( schrodinger.structure.Structure) – Structure.
-
class
schrodinger.structutils.markush_enumerate.FragmentReader(filename, logger=None)¶ Bases:
objectReads structures from file, skips “invalid” (in context of ENUM-108) fragments.
-
__init__(filename, logger=None)¶ Initialize self. See help(type(self)) for accurate signature.
-
__iter__()¶
-
__next__()¶
-
__class__¶ alias of
builtins.type
-
__delattr__¶ Implement delattr(self, name).
-
__dict__= mappingproxy({'__module__': 'schrodinger.structutils.markush_enumerate', '__doc__': '\n Reads structures from file, skips "invalid"\n (in context of ENUM-108) fragments.\n ', '__init__': <function FragmentReader.__init__>, '__iter__': <function FragmentReader.__iter__>, '__next__': <function FragmentReader.__next__>, '__dict__': <attribute '__dict__' of 'FragmentReader' objects>, '__weakref__': <attribute '__weakref__' of 'FragmentReader' 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_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.structutils.markush_enumerate'¶
-
__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).
-
__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).
-
__weakref__¶ list of weak references to the object (if defined)
-
-
schrodinger.structutils.markush_enumerate.read_scaffold(filename)¶ Reads scaffold from file.
Parameters: filename (str) – File name. Returns: Scaffold instance. Return type: ScaffoldRaises: ValueError on errors.
-
class
schrodinger.structutils.markush_enumerate.FragmentsIterator(sources, random=None)¶ Bases:
objectIterator over Cartesian product of fragment collections.
-
__init__(sources, random=None)¶ Parameters: - sources (list of list) – List of [iterable over fragments, id1, id2, …] lists
(see
r_group_enumerate.parse_rgroups). - random (None or int) – If None, enumerate sequentially. If integer, enumerate
randomly using
randomas a seed.
- sources (list of list) – List of [iterable over fragments, id1, id2, …] lists
(see
-
__iter__()¶
-
__next__()¶ Returns: Dictionary that maps fragment IDs onto structures.
-
__class__¶ alias of
builtins.type
-
__delattr__¶ Implement delattr(self, name).
-
__dict__= mappingproxy({'__module__': 'schrodinger.structutils.markush_enumerate', '__doc__': '\n Iterator over Cartesian product of fragment collections.\n ', '__init__': <function FragmentsIterator.__init__>, '__iter__': <function FragmentsIterator.__iter__>, '__next__': <function FragmentsIterator.__next__>, '__dict__': <attribute '__dict__' of 'FragmentsIterator' objects>, '__weakref__': <attribute '__weakref__' of 'FragmentsIterator' 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_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.structutils.markush_enumerate'¶
-
__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).
-
__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).
-
__weakref__¶ list of weak references to the object (if defined)
-
-
class
schrodinger.structutils.markush_enumerate.VirtualLibrary(scaffold, sources, random=None, logger=None)¶ Bases:
objectImplements common intended use case logic.
-
__init__(scaffold, sources, random=None, logger=None)¶ Parameters: - scaffold (
Scaffold) – Scaffold. - sources (list of list) – List of [iterable over fragments, id1, id2, …] lists
(see
r_group_enumerate.parse_rgroups). Or list of [filename, id1, id2, …] lists. - random (None or int) – If None, enumerate sequentially. If integer, enumerate
randomly using
randomas a seed.
- scaffold (
-
__class__¶ alias of
builtins.type
-
__delattr__¶ Implement delattr(self, name).
-
__dict__= mappingproxy({'__module__': 'schrodinger.structutils.markush_enumerate', '__doc__': '\n Implements common intended use case logic.\n ', '__init__': <function VirtualLibrary.__init__>, '__iter__': <function VirtualLibrary.__iter__>, '__next__': <function VirtualLibrary.__next__>, '__dict__': <attribute '__dict__' of 'VirtualLibrary' objects>, '__weakref__': <attribute '__weakref__' of 'VirtualLibrary' 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_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.structutils.markush_enumerate'¶
-
__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).
-
__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).
-
__weakref__¶ list of weak references to the object (if defined)
-
__iter__()¶
-
__next__()¶
-