[Rdkit-discuss] Chem.AddHs() doesn't care about compound layout
Hello, Imagine I have a compound with some 2D coordinates I really like: mol Now I would like to add hydrogens to it: mol = Chem.AddHs(mol) The problem is, all new hydrogen atoms will have (0,0,0) coordinates, which doesn't look to good... I could force recomputing 2D coords for the whole compound: AllChem.Compute2dCoords(mol) But this will ruin my beautiful layout of the original, non-hydrogen part... Is it possible to layout hydrogens around my compound after I add them? Regards, Michał Nowotka -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] Chem.AddHs() doesn't care about compound layout
Dear Michal, Chem.AddHs() has the option “addCoords” which is normally set to False. So, using mol = Chem.AddHs(mol, addCoords=True) should solve your problem. Best, Sereina On 20 Aug 2014, at 19:07, Michał Nowotka mmm...@gmail.com wrote: Hello, Imagine I have a compound with some 2D coordinates I really like: mol Now I would like to add hydrogens to it: mol = Chem.AddHs(mol) The problem is, all new hydrogen atoms will have (0,0,0) coordinates, which doesn't look to good... I could force recomputing 2D coords for the whole compound: AllChem.Compute2dCoords(mol) But this will ruin my beautiful layout of the original, non-hydrogen part... Is it possible to layout hydrogens around my compound after I add them? Regards, Michał Nowotka -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] Chem.AddHs() doesn't care about compound layout
Perfect, thank you! On Wed, Aug 20, 2014 at 6:13 PM, Sereina sereina.rini...@gmail.com wrote: Dear Michal, Chem.AddHs() has the option “addCoords” which is normally set to False. So, using mol = Chem.AddHs(mol, addCoords=True) should solve your problem. Best, Sereina On 20 Aug 2014, at 19:07, Michał Nowotka mmm...@gmail.com wrote: Hello, Imagine I have a compound with some 2D coordinates I really like: mol Now I would like to add hydrogens to it: mol = Chem.AddHs(mol) The problem is, all new hydrogen atoms will have (0,0,0) coordinates, which doesn't look to good... I could force recomputing 2D coords for the whole compound: AllChem.Compute2dCoords(mol) But this will ruin my beautiful layout of the original, non-hydrogen part... Is it possible to layout hydrogens around my compound after I add them? Regards, Michał Nowotka -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] Chem.AddHs() doesn't care about compound layout
Hmm, I've just checked and actually adding this flag doesn't solve my problem. It seems that adding this flag actually calls Compute2dCoords (at least this is how it looks like), because all coordinates are computed from scratch, for example if my compound was translated by some vector on 2D plane, after executing addHs it will be centered, if the compound had one atom dragged unusually, it will be aligned back. The only difference between this flag and calling Compute2dCoords is that H bonds are longer, which actually looks worse... Cheers, Michał On Wed, Aug 20, 2014 at 6:14 PM, Michał Nowotka mmm...@gmail.com wrote: Perfect, thank you! On Wed, Aug 20, 2014 at 6:13 PM, Sereina sereina.rini...@gmail.com wrote: Dear Michal, Chem.AddHs() has the option “addCoords” which is normally set to False. So, using mol = Chem.AddHs(mol, addCoords=True) should solve your problem. Best, Sereina On 20 Aug 2014, at 19:07, Michał Nowotka mmm...@gmail.com wrote: Hello, Imagine I have a compound with some 2D coordinates I really like: mol Now I would like to add hydrogens to it: mol = Chem.AddHs(mol) The problem is, all new hydrogen atoms will have (0,0,0) coordinates, which doesn't look to good... I could force recomputing 2D coords for the whole compound: AllChem.Compute2dCoords(mol) But this will ruin my beautiful layout of the original, non-hydrogen part... Is it possible to layout hydrogens around my compound after I add them? Regards, Michał Nowotka -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] Chem.AddHs() doesn't care about compound layout
On Wednesday, August 20, 2014, Michał Nowotka mmm...@gmail.com wrote: I've just checked and actually adding this flag doesn't solve my problem. It seems that adding this flag actually calls Compute2dCoords (at least this is how it looks like), because all coordinates are computed from scratch, for example if my compound was translated by some vector on 2D plane, after executing addHs it will be centered, if the compound had one atom dragged unusually, it will be aligned back. The only difference between this flag and calling Compute2dCoords is that H bonds are longer, which actually looks worse... Hmmm, that doesn't sound like what is supposed to happen. I think that it should just add coords for the Hs that it adds. I will take a look tomorrow morning to see what is going on. There may be something odd for 2d conformers, but I really don't think it should redo the whole coordinate generation. -greg -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] Chem.AddHs() doesn't care about compound layout
On 08/20/2014 12:34 PM, Greg Landrum wrote: On Wednesday, August 20, 2014, Michał Nowotka mmm...@gmail.com wrote: It seems that adding this flag actually calls Compute2dCoords (at least this is how it looks like), because all coordinates are computed from scratch, Hmmm, that doesn't sound like what is supposed to happen. I think that it should just add coords for the Hs that it adds. Unless your backbone is laid out so there's room around it for all those protons, expect the result to not look good. -- Dimitri Maziuk Programmer/sysadmin BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu signature.asc Description: OpenPGP digital signature -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] Chem.AddHs() doesn't care about compound layout
I can't seem to reproduce the problem. Here's an example showing that the original atom coordinates are preserved when Chem.AddHs is called with the addCoords argument: # In [9]: mb= ...: Mrv0541 08211405312D ...: ...: 6 6 0 0 0 0999 V2000 ...:-3.55780.82500. C 0 0 0 0 0 0 0 0 0 0 0 0 ...:-4.27230.41250. C 0 0 0 0 0 0 0 0 0 0 0 0 ...:-4.2723 -0.41250. C 0 0 0 0 0 0 0 0 0 0 0 0 ...:-3.5578 -0.82500. C 0 0 0 0 0 0 0 0 0 0 0 0 ...:-1.8268 -0.72190. C 0 0 0 0 0 0 0 0 0 0 0 0 ...:-2.84330.41250. C 0 0 0 0 0 0 0 0 0 0 0 0 ...: 1 2 1 0 0 0 0 ...: 1 6 2 0 0 0 0 ...: 2 3 2 0 0 0 0 ...: 3 4 1 0 0 0 0 ...: 4 5 2 0 0 0 0 ...: 5 6 1 0 0 0 0 ...: M END ...: In [10]: m = Chem.MolFromMolBlock(mb) In [11]: nm = Chem.AddHs(m,addCoords=True) In [12]: print Chem.MolToMolBlock(nm) RDKit 2D 12 12 0 0 0 0 0 0 0 0999 V2000 -3.55780.82500. C 0 0 0 0 0 0 0 0 0 0 0 0 -4.27230.41250. C 0 0 0 0 0 0 0 0 0 0 0 0 -4.2723 -0.41250. C 0 0 0 0 0 0 0 0 0 0 0 0 -3.5578 -0.82500. C 0 0 0 0 0 0 0 0 0 0 0 0 -1.8268 -0.72190. C 0 0 0 0 0 0 0 0 0 0 0 0 -2.84330.41250. C 0 0 0 0 0 0 0 0 0 0 0 0 -3.55781.92500. H 0 0 0 0 0 1 0 0 0 0 0 0 -5.22490.96250. H 0 0 0 0 0 1 0 0 0 0 0 0 -5.2249 -0.96250. H 0 0 0 0 0 1 0 0 0 0 0 0 -3.8108 -1.89550. H 0 0 0 0 0 1 0 0 0 0 0 0 -0.8095 -1.14040. H 0 0 0 0 0 1 0 0 0 0 0 0 -2.15001.26650. H 0 0 0 0 0 1 0 0 0 0 0 0 1 2 2 0 1 6 1 0 2 3 1 0 3 4 2 0 4 5 1 0 5 6 2 0 1 7 1 0 2 8 1 0 3 9 1 0 4 10 1 0 5 11 1 0 6 12 1 0 M END # Note that addCoords does add the Hs in 3D: # In [5]: print Chem.MolToMolBlock(m) RDKit 2D 2 1 0 0 0 0 0 0 0 0999 V2000 -0.75000.0. C 0 0 0 0 0 0 0 0 0 0 0 0 0.7500 -0.0. C 0 0 0 0 0 0 0 0 0 0 0 0 1 2 1 0 M END In [7]: nm=Chem.AddHs(m,addCoords=True) In [8]: print Chem.MolToMolBlock(nm) RDKit 2D 8 7 0 0 0 0 0 0 0 0999 V2000 -0.75000.0. C 0 0 0 0 0 0 0 0 0 0 0 0 0.7500 -0.0. C 0 0 0 0 0 0 0 0 0 0 0 0 -1.11670.1.0371 H 0 0 0 0 0 1 0 0 0 0 0 0 -1.11670.8981 -0.5185 H 0 0 0 0 0 1 0 0 0 0 0 0 -1.1167 -0.8981 -0.5185 H 0 0 0 0 0 1 0 0 0 0 0 0 1.1167 -0.1.0371 H 0 0 0 0 0 1 0 0 0 0 0 0 1.1167 -0.8981 -0.5185 H 0 0 0 0 0 1 0 0 0 0 0 0 1.11670.8981 -0.5185 H 0 0 0 0 0 1 0 0 0 0 0 0 1 2 1 0 1 3 1 0 1 4 1 0 1 5 1 0 2 6 1 0 2 7 1 0 2 8 1 0 M END # It is probably feasible to modify the code to add Hs in 2D when the conformer is 2D, but it's likely a non-trivial amount of work and, as Dimitri pointed out, there are many situations where the results aren't going to look particularly good. -greg On Wed, Aug 20, 2014 at 7:34 PM, Greg Landrum greg.land...@gmail.com wrote: On Wednesday, August 20, 2014, Michał Nowotka mmm...@gmail.com wrote: I've just checked and actually adding this flag doesn't solve my problem. It seems that adding this flag actually calls Compute2dCoords (at least this is how it looks like), because all coordinates are computed from scratch, for example if my compound was translated by some vector on 2D plane, after executing addHs it will be centered, if the compound had one atom dragged unusually, it will be aligned back. The only difference between this flag and calling Compute2dCoords is that H bonds are longer, which actually looks worse... Hmmm, that doesn't sound like what is supposed to happen. I think that it should just add coords for the Hs that it adds. I will take a look tomorrow morning to see what is going on. There may be something odd for 2d conformers, but I really don't think it should redo the whole coordinate generation. -greg -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss