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

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

atom

Alias for field number 1

bonds

Alias for field number 2

count(value, /)

Return number of occurrences of value.

group_id

Alias for field number 0

index(value, start=0, stop=9223372036854775807, /)

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 st looks not right.

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: object

Holds 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.

property 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.

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: object

Reads structures from file, skips “invalid” (in context of ENUM-108) fragments.

__init__(filename, logger=None)

Initialize self. See help(type(self)) for accurate signature.

schrodinger.structutils.markush_enumerate.read_scaffold(filename)

Reads scaffold from file.

Parameters

filename (str) – File name.

Returns

Scaffold instance.

Return type

Scaffold

Raises

ValueError on errors.

class schrodinger.structutils.markush_enumerate.FragmentsIterator(sources, random=None)

Bases: object

Iterator 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 random as a seed.

class schrodinger.structutils.markush_enumerate.VirtualLibrary(scaffold, sources, random=None, logger=None)

Bases: object

Implements 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 random as a seed.