Complete
API¶
rdworks.stereoisomers
¶
Functions¶
correct_wedged_bonds(rdmol)
¶
Corrects wedged bonds for chiral centers. Args: rdmol (Chem.Mol): input molecule.
- Clear all stereochemistry information
- Identify chiral centers and non-chiral atoms/bonds
- Reassign stereochemistry only where appropriate
- Return the modified molecule
enumerate_ring_bond_stereoisomers(rdmol, ring_bond_stereo_info, override=False)
¶
Enumerates unspecified double bond stereochemistry (cis/trans).
Small rings (< 8 atoms): RDKit does NOT enumerate E/Z stereochemistry for double bonds because the ring constraints make one configuration impossible
Macrocycles (≥ 8 atoms): RDKit CAN enumerate E/Z stereochemistry for double bonds since both configurations are geometrically feasible
Parameters:
-
rdmol(Mol) –input molecule.
-
ring_bond_stereo_info(List[Tuple]) –ring_bond_stereo_info will be set when .remove_stereo() is called. bond_stereo_info = [(bond_idx, bond_stereo_descriptor), ..] where bond_stereo_descriptor is
Chem.StereoDescriptor.Bond_CisorChem.StereoDescriptor.Bond_Trans, orChem.StereoDescriptor.NoValue. -
override(bool, default:False) –description. Defaults to False.
Returns:
-
list[Mol]–List[Chem.Mol]: list of enumerated stereoisomers.
enumerate_stereoisomers(rdmol)
¶
Returns enumerated stereoisomers.
Parameters:
-
rdmol(Mol) –input molecule.
Returns:
-
list[Mol]–List[Chem.Mol]: a list of enumerated stereoisomers.
rdworks.tautomerism
¶
Reference:
D. K. Dhaked, W.-D. Ihlenfeldt, H. Patel, V. Delannée, M. C. Nicklaus, Toward a Comprehensive Treatment of Tautomerism in Chemoinformatics Including in InChI V2. J. Chem. Inf. Model. (2020). https://doi.org/10.1021/acs.jcim.9b01080.
https://github.com/xundrug/moltaut
Classes¶
ComprehensiveTautomers
¶
Comprehensive tautomer enumeration based on MolTaut implementation D. K. Dhaked, W.-D. Ihlenfeldt, H. Patel, V. Delannée, M. C. Nicklaus, Toward a Comprehensive Treatment of Tautomerism in Chemoinformatics Including in InChI V2. J. Chem. Inf. Model. (2020). https://doi.org/10.1021/acs.jcim.9b01080.
Attributes¶
device = None
instance-attribute
¶
dict = {'self': [self.smiles]}
instance-attribute
¶
enumerated = []
instance-attribute
¶
forbidden = ['O=[N+]([O-])']
class-attribute
instance-attribute
¶
forbidden_patterns = [(Chem.MolFromSmarts(_)) for _ in forbidden]
class-attribute
instance-attribute
¶
imodel = None
instance-attribute
¶
microstates = []
instance-attribute
¶
nmodel = None
instance-attribute
¶
num_confs = None
instance-attribute
¶
optimizer = None
instance-attribute
¶
ordered = []
instance-attribute
¶
popular = []
instance-attribute
¶
ps = Chem.SmilesParserParams()
class-attribute
instance-attribute
¶
rdmol = Chem.MolFromSmiles(smiles)
instance-attribute
¶
revdict = defaultdict(list)
instance-attribute
¶
smiles = smiles
instance-attribute
¶
smirks = [(line.strip().split('\t')) for line in contents]
instance-attribute
¶
states = []
instance-attribute
¶
uncharger = rdMolStandardize.Uncharger()
class-attribute
instance-attribute
¶
Functions¶
enumerate()
¶
RdkTautomers
¶
RDKit built-in tautomer enumeration
M. Sitzmann, W.-D. Ihlenfeldt, M. C. Nicklaus, Tautomerism in large databases. J. Comput. Aided Mol. Des. 24, 521-551 (2010).
rdworks.std
¶
Functions¶
clean_2d(rdmol, reset_isotope=True, remove_H=True)
¶
Clean molecule for 2D depiction.
Parameters:
-
rdmol(Mol) –molecule (not to be modified)
-
reset_isotope(bool, default:True) –whether to reset isotope information. Defaults to True.
-
remove_H(bool, default:True) –whether to remove implicit hydrogens. Defaults to True.
Returns:
-
tuple[Mol, list[Mol]]–(cleaned copy of molecule, list of Chem.Mol.Conformers from molecule)
desalt_smiles(smiles)
¶
Remove salt(s) from SMILES.
Parameters:
-
smiles(str) –SMILES.
Returns:
-
tuple[str, Mol]–(desalted SMILES, desalted Chem.Mol)
generate_inchi_key(rdmol)
¶
Generate InChIKey.
Note
- An InChIKey is a 27-character string consisting of three parts:
- 14 characters: Derived from the connectivity layer of the InChI.
- Hyphen (-): Separates the first two blocks.
- 9 characters: Derived from the remaining InChI layers.
- A hyphen (-): Separates the second and third blocks.
- A final checksum character: Ensures the integrity of the key.
Parameters:
-
rdmol(Mol) –input molecule
Returns:
-
str(str) –27-character InChIKey
neutralize_atoms(rdmol)
¶
Neutralizes atoms.
It is adapted from Noel O'Boyle's nocharge code: rdkit cookbook, no charge. It is a neutralization by atom approach and neutralizes atoms with a +1 or -1 charge by removing or adding hydrogen where possible. The SMARTS pattern checks for a hydrogen in +1 charged atoms and checks for no neighbors with a negative charge (for +1 atoms) and no neighbors with a positive charge (for -1 atoms), this is to avoid altering molecules with charge separation (e.g., nitro groups).
The neutralize_atoms() function differs from the rdMolStandardize.Uncharger behavior. See the MolVS documentation for Uncharger.
This class uncharges molecules by adding and/or removing hydrogens. In cases where there is a positive charge that is not neutralizable, any corresponding negative charge is also preserved. As an example, rdMolStandardize.Uncharger will not change charges on CN+(C)CCC([O-])=O, as there is a positive charge that is not neutralizable. In contrast, the neutralize_atoms() function will attempt to neutralize any atoms it can (in this case to CN+(C)CCC(=O)O). That is, neutralize_atoms() ignores the overall charge on the molecule, and attempts to neutralize charges even if the neutralization introduces an overall formal charge on the molecule.
Parameters:
-
rdmol (Chem.Mol)–molecule (not to be modified).
Returns:
-
Mol–Chem.Mol: neutralized copy of molecule.
standardize(rdmol)
¶
Returns standardized rdkit.Chem.Mol object.
Parameters:
-
smiles(str) –input SMILES string.
Returns:
-
Mol–Chem.Mol: standardized rdkit.Chem.Mol object.
standardize_smiles(smiles)
¶
Returns standardized SMILES string.
The rdMolStandardize.StandardizeSmiles() function performs the following steps:
- mol = Chem.MolFromSmiles(sm)
- Chem.SanitizeMol(mol)
- mol = Chem.RemoveHs(mol)
- mol = rdMolStandardize.MetalDisconnector().Disconnect(mol)
- mol = rdMolStandardize.Normalize(mol)
- mol = rdMolStandardize.Reionize(mol)
- Chem.AssignStereochemistry(mol, force=True, cleanIt=True)
- Chem.MolToSmiles(mol)
See rdkit notebook and greg's notebook, and youtube video.
Parameters:
-
smiles(str) –input SMILES string.
Returns:
-
str(str) –standardized SMILES string.