schrodinger.structutils.rgroup_enumerate module¶
Module for R-group enumeration.
-
class
schrodinger.structutils.rgroup_enumerate.
RGroup
(atom_index, source_index, leaving_atoms, staying_atom)¶ Bases:
tuple
-
atom_index
¶ Alias for field number 0
-
leaving_atoms
¶ Alias for field number 2
-
source_index
¶ Alias for field number 1
-
staying_atom
¶ Alias for field number 3
-
-
class
schrodinger.structutils.rgroup_enumerate.
RgroupEnumerator
(core_st, sources, optimize_sidechains=True, start=0, stop=None)¶ Bases:
object
Enumerate a structure using R-group sources.
A source is a sequence with an iterable of Structure as its first element, followed by one or more core atom atom indices where the side chains from the source should be inserted.
RgroupEnumerator objects are iterable. Example:
sources = [ (StructureReader('r1.maegz'), 4, 12), (StructureReader('r2.maegz'), 8), ] for prod_st in RgroupEnumerator(core_st, sources): ...
will use the first reader to replace atoms 4 and 12 in an homo fashion (meaning that for a given product, the groups attached to atoms 4 and 12 are always the same), in combination with the structures for the second reader for atom 8.
The generated structures have the title of the core structure with an index appended after a dot (e.g, “core_title.1”).
The structures in each R-group source should each have one dummy atom (symbol ‘’, atomic number zero).
The user of the class can request only a slice of the full set of combinations to be yielded, by providing the optional ‘start’ and ‘stop’ constructor arguments. These follow the standard Python slicing convention.
-
attachSidechains
(sidechains)¶ Attach the sidechains to the core structure and return the resulting structure.
Parameters: sidechains (list of schrodinger.structure.Structure
) – list of sidechains. Should have the same length as the number of attachment atoms in the core.Returns: product structure. Return type: schrodinger.structure.Structure
-
-
exception
schrodinger.structutils.rgroup_enumerate.
RgroupError
¶ Bases:
exceptions.Exception
Exception class for errors specific to this module, which the caller may want to present to the user as a simple error message, as opposed to a traceback. This is meant for “user errors”, as opposed to bugs; for example, when an input structure doesn’t fulfill the requirements.
-
schrodinger.structutils.rgroup_enumerate.
find_rgroup_from_smarts
(st, smarts, leaving_atom_pos, staying_atom_pos)¶ Find the various ways in which a structure can be split into “R-group” and “functional group” using a SMARTS pattern.
The SMARTS pattern must consist of at least two atoms. Two of the atoms, identified by their position in the SMARTS string, are used to define the bond to be broken between the R group and the “leaving group”. If the two atoms are not directly connected, the bond leading to from the leaving atom to the staying atom is broken.
For example, consider the structure c1ccccc1cC(=O)O and the SMARTS pattern C(=O)O. With leaving_atom_pos=2, staying_atom_pos=1, the entire carboxylate is removed, producing the R-group c1ccccc1. With leaving_atom_pos=4, staying_atom_pos=2, only the terminal O is removed, leading to the R-group c1ccccc1C(=O)*. (The asterisks are shown here only to highlight the bond that was broken.)
The return value is a list of tuples, where the first element is the attachment atom index and the second is a list of the indexes of the atoms comprising the R-group. In the first example above, if we pretend there are no hydrogens, the return value might be [(7, [1,2,3,4,5,6])].
Notes: 1) ring bonds can’t be broken because they don’t split the structure in two. 2) non-single bonds can’t be broken because the R-group enumerator currently only works across single bonds. Matches that would require breaking any of these bonds are silently skipped.
Parameters: - st (
schrodinger.structure.Structure
) – structure to analyze - smarts (str) – SMARTS pattern describing the functional group
- leaving_atom_pos (index) – position of the leaving atom in the SMARTS pattern (1-based)
- staying_atom_pos (index) – position of the attachment atom in the SMARTS pattern (1-based)
Returns: list of tuples (attachment atom, list of R-group atom indexes). If no matches satisfied all the requirements, the list may be empty.
Return type: list
- st (
-
schrodinger.structutils.rgroup_enumerate.
find_staying_atom
(st, leaving_atom)¶ Given a picked “leaving” atom, determine which of the atoms it is bonded to is part of the larger molecule - the “staying” atom. All other atoms bound to the leaving atom are considered to be part of the leaving group.
Parameters: leaving_atom ( schrodinger.structure._StructureAtom
) – atom which defines the start of the leaving groupReturns: “staying atom”: the core atom bound to the leaving atom Rtype leaving_atom: schrodinger.structure._StructureAtom