stk icon indicating copy to clipboard operation
stk copied to clipboard

Add mutation function which substitutes terminal atomic groups.

Open lukasturcani opened this issue 5 years ago • 1 comments

It would be nice to add a mutation function which allows the user to specify a query molecule, and a replacement molecule and replace the substructure matched by the query molecule the replacement molecule.

Something like the following code but implemented as a mutation function in stk.

    helicene = rdkit.MolFromMolFile('h_oh.mol', removeHs=False, sanitize=False)
    query = rdkit.MolFromSmarts('[C][H]')
    replacement = rdkit.MolFromSmiles('[N]')
    rdkit.EmbedMolecule(replacement, rdkit.ETKDGv2())
    new_mols = rdkit.ReplaceSubstructs(helicene, query, replacement)
    for i, new_mol in enumerate(new_mols):
        rdkit.SanitizeMol(new_mol)
        rdkit.UFFOptimizeMolecule(new_mol)
        rdkit.MolToMolFile(new_mol, f'new_mol_{i}.mol')

lukasturcani avatar Jun 05 '19 18:06 lukasturcani

I will be looking into

asantanabo avatar Jun 06 '19 11:06 asantanabo