I think you misunderstood something in my previous answer.
I'll try to be more complete:
When you want to align two molecules, the RDKit needs to know the atom
mapping between them.
If you don't provide an atom mapping, the code tries to generate one by
doing a substructure match between the reference and the probe and then it
uses that atom map to do the alignment.
In your case this automatic mapping fails because there is no substructure
match between the reference and the probe. Benzene is not a substructure of
phenol if the molecules have Hs added to them.
Fortunately, it's easy to generate your own mapping and use that; here's a
short notebook that shows how:
https://gist.github.com/greglandrum/643c1bffdf559610f53c88d40373044d




On Tue, Jul 31, 2018 at 11:33 PM Phuong Chau <[email protected]> wrote:

> Hello everyone,
>
> I will repeat the problem here:
> Input: SMILES string of Chemical A ('c1ccccc1') an its calculated 3D
> coordinates from rdkit and SMILES of Chemical B ('Oc1ccccc1')
>
> Ouput: 3D coordinates of chem B that aligns with Chemical A
>
> After looking at a few example, I came up with this code:
> prbChem = Chem.MolToSmiles(Chem.MolFromSmiles('Oc1ccccc1'))
> prbMol = Chem.MolFromSmiles(prbChem)
> prbMolwithH = Chem.AddHs(prbMol)
> ##Molecule used as reference fr the alignment
> refChem = Chem.MolToSmiles(Chem.MolFromSmiles('c1ccccc1'))
> refMol = Chem.MolFromSmiles(refChem)
> refMolwithH = Chem.AddHs(refMol)
>
> MolChemwithHs = [prbMolwithH, refMolwithH]
>
> for x in MolChemwithHs:
> rdDistGeom.EmbedMolecule(x)
> for x in MolChemwithHs:
> AllChem.UFFOptimizeMolecule(x)
>
> tform = rdMolAlign.GetAlignmentTransform(prbMolwithH, refMolwithH)
>
> *Is it true that if I can find tform, I can convert the coordinates of
> chemical B using AllChem.TransformMol(probMol, tform) ? *
>
> *Also, with the code, I got the error of *
> Traceback (most recent call last):
>   File "3DAlignment.py", line 27, in <module>
>     tform = rdMolAlign.GetAlignmentTransform(prbMolwithH, refMolwithH)
> RuntimeError: std::exception
>
> Would you please help me with this error?
>
> Thank you so much for your help :)
>
> --
> Phuong Chau
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to