[Rdkit-discuss] Mapping of atom numbering, naming and coordinates for different conformers

2017-07-18 Thread Max Pillong

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)


confs.sdf
Description: Binary data


out.pdb
Description: Binary data


ref.pdb
Description: Binary data
--
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


Re: [Rdkit-discuss] Mapping of atom numbering, naming and coordinates for different conformers

2017-07-18 Thread Max Pillong

I see, I assumed it worked similarly to PyMol/OpenBabel, but oh well, I can just pass the SMILES along with it just as well. Perfect, that does the trick, thanks Maciek!

 

Cheers,

M

 

Gesendet: Dienstag, 18. Juli 2017 um 16:26 Uhr
Von: "Maciek Wójcikowski" <mac...@wojcikowski.pl>
An: "Max Pillong" <max.pill...@gmx.net>
Betreff: Re: Re: [Rdkit-discuss] Mapping of atom numbering, naming and coordinates for different conformers


If you read the PDBfile RDKit does not guess the atom types, hence the AssignBondOrdersFromTemplate function. If you have SMILES for that PDB, assign bond orders acording to smi and then do the match. If the default one does not work for you there is a PR with extended version of this function [https://github.com/rdkit/rdkit/pull/886], you could try this as last resort.

 

When bonds' orders are matching, then the match will probably be succesfull (try it both ways, mol1 > mol2 and mol2 > mol1).


 


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

 

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




Hi Maciek,

 

had that idea as well but merely received an empty tuple as a result (Figured this would be the result for completely equal molecule graphs). After your suggestion and rerunning the example with some dummy molecules now though makes me assume it's rather a problem with the atom typing in my initial PDB file that I receive from amber.

 

Thanks for the reassuring input :D

 

Best,

Max

 

Gesendet: Dienstag, 18. Juli 2017 um 15:16 Uhr
Von: "Maciek Wójcikowski" <mac...@wojcikowski.pl>
An: "Max Pillong" <max.pill...@gmx.net>
Cc: "RDKit Mailing List" <rdkit-discuss@lists.sourceforge.net>
Betreff: Re: [Rdkit-discuss] Mapping of atom numbering, naming and coordinates for different conformers




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