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
- list of tuples (attachment atom, list of R-group atom indexes).
If no matches satisfied all the requirements, the list may be
empty.
|