Hi Max,

Have you tried getting the atom map simplu by mathing those molecules?

mol2.GetSubstructMatch(mol1)


If your molecules dont match this way you can seek inspiration in
AssignBondsFromTemplate function here:
https://github.com/rdkit/rdkit/blob/83d62a71f28b96b29458bcda225374d7f07f9c82/rdkit/Chem/AllChem.py#L370

Then you can use Chem.RenumberAtoms to set the new order.


----
Pozdrawiam,  |  Best regards,
Maciek Wójcikowski
mac...@wojcikowski.pl

2017-07-18 14:31 GMT+02:00 Max Pillong <max.pill...@gmx.net>:

> Hi everyone,
>
> I am stuck on the following issue: I have two files of different
> conformers for the same molecule. One is an NMR generated reference PDB,
> the other one is an sdf with conformers generated in RDKit. I would now
> like to merge the two files into one PDB preserving the initial atom
> numbering and naming from the reference file. If I simply add the generated
> conformers to the reference molecule using AddConformer() everything seems
> fine in the beginning (even when looking at the generated PDB files, the
> atom numbering/naming seems to be in order), however it does not update the
> coordinates accordingly, resulting in wrong atom typings and connection
> issues in the outfile (see attached out.pdb).
>
> Is there a way to automatically generate an atom mapping between the two
> or update the coordinates accordingly? Or maybe someone can think of an
> overall better solution to the issue?
>
> Thanks and all the best!
> Max
>
> refFile="ref.pdb"
> confFile="confs.sdf"
> outfile="out.pdb"
>
> refMol=Chem.MolFromPDBFile(refFile, removeHs=False)
> confSupp=Chem.SDMolSupplier(confFile, removeHs=False)
>
> for m in confSupp:
>     refMol.AddConformer(m.GetConformer(0), assignId=True)
>
> writer=rdmolfiles.PDBWriter(outfile)
> for i in range(0,refMol.GetNumConformers()):
>     writer.write(refMol, confId=i)
>
> ------------------------------------------------------------
> ------------------
> 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
> Rdkit-discuss@lists.sourceforge.net
> 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
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to