assert type(to_mol('CCC')) == Chem.Mol
assert type(to_smile(Chem.MolFromSmiles('CCC'))) == str
assert type(smart_to_mol('[#6]')) == Chem.Mol
Chem
RDKit i/o
Functions for converting between SMILES strings and RDKit mol objects
filter_valid_smiles
filter_valid_smiles (smiles:list[str])
given a list of SMILES, filters list for SMILES that resolve to a valid molecule
Type | Details | |
---|---|---|
smiles | list | input list of SMILES strings |
Returns | list | output list of valid SMILES strings |
remove_stereo_smile
remove_stereo_smile (smile:str)
removes stereochemistry from SMILES string
Type | Details | |
---|---|---|
smile | str | input SMILES string |
Returns | str | output SMILES string |
remove_stereo
remove_stereo (mol:rdkit.Chem.rdchem.Mol)
removes stereochemistry from rdkit Mol
Type | Details | |
---|---|---|
mol | Mol | input rdkit Mol |
Returns | Mol | output rdkit Mol |
canon_smile
canon_smile (smile:str)
attempts to canonicalize SMILES string. returns empty string if canonicalization fails
Type | Details | |
---|---|---|
smile | str | input SMILES string |
Returns | str | canonicalized SMILES string |
to_kekule
to_kekule (smile:str)
converts SMILES string to kekule form
Type | Details | |
---|---|---|
smile | str | input SMILES string |
Returns | str | output kekule SMILES string |
to_smile
to_smile (mol:rdkit.Chem.rdchem.Mol)
converts Mol to SMILES string
Type | Details | |
---|---|---|
mol | Mol | input rdkit mol |
Returns | str | output SMILES string |
smart_to_mol
smart_to_mol (smart:str)
convertes smarts to Mol. returns None
if mol creation fails
Type | Details | |
---|---|---|
smart | str | input SMARTS string |
Returns | typing.Optional[rdkit.Chem.rdchem.Mol] | output rdkit mol |
to_mol
to_mol (smile:str)
convertes smile to Mol. returns None
if mol creation fails
Type | Details | |
---|---|---|
smile | str | input SMILES string |
Returns | typing.Optional[rdkit.Chem.rdchem.Mol] | output rdkit mol |
Molecule
Molecule (smile:str, data:Optional[dict]=None)
Initialize self. See help(type(self)) for accurate signature.
Type | Default | Details | |
---|---|---|---|
smile | str | SMILES string | |
data | typing.Optional[dict] | None | dictionary of molecule data |
smile_func_wrapper
smile_func_wrapper (func:Callable[[str],Any])
takes a function with a SMILES string input and returns a wrapped version that accepts a Molecule as input
Type | Details | |
---|---|---|
func | typing.Callable[[str], typing.Any] | function that takes SMILES string as input |
Returns | typing.Callable[[main.Molecule], typing.Any] | function that takes Molecule as input |
mol_func_wrapper
mol_func_wrapper (func:Callable[[rdkit.Chem.rdchem.Mol],Any])
takes a function with a Chem.Mol input and returns a wrapped version that accepts a Molecule as input
Type | Details | |
---|---|---|
func | typing.Callable[[rdkit.Chem.rdchem.Mol], typing.Any] | function that takes rdkit Mol as input |
Returns | typing.Callable[[main.Molecule], typing.Any] | function that takes Molecule as input |
= rdMolDescriptors.CalcExactMolWt
rdkit_function
= 'CCCCCC'
smile = to_mol(smile)
mol = Molecule(smile)
molecule
= mol_func_wrapper(rdkit_function)
wrapped_function
assert rdkit_function(mol) == wrapped_function(molecule)
Catalog
Catalog (catalog:rdkit.Chem.rdfiltercatalog.FilterCatalog)
Initialize self. See help(type(self)) for accurate signature.
Type | Details | |
---|---|---|
catalog | FilterCatalog | input filter catalog |
= [
smarts '[*]-[#6]1:[#6]:[#6](-[#0]):[#6]:[#6](-[*]):[#6]:1',
'[*]-[#6]1:[#6]:[#6](-[*]):[#6]:[#6]:[#6]:1',
'[*]-[#6]1:[#6]:[#6]:[#6]:[#6]:[#6]:1',
'[*]-[#6]1:[#6]:[#6](-[#7]-[*]):[#6]:[#6]:[#6]:1',
'[#6]1:[#6]:[#7]:[#6]:[#6]:[#6]:1'
]
= Catalog.from_smarts(smarts)
catalog
= [
smiles 'c1ccccc1',
'Cc1cccc(NCc2ccccc2)c1'
]
= [Molecule(i) for i in smiles]
molecules
assert not catalog.has_match(molecules[0])
assert catalog.has_match(molecules[1])