Your input molfile lacks the 2D on line 2, e.g.
RDKit 2D
Pat
On Thu, Aug 21, 2014 at 5:34 AM, Michał Nowotka <[email protected]> wrote:
> OK, I'm closer to finding bug in my code. So I have this ctab:
>
> >>> print ctab
>
> Converted by chembl_beaker ver. 0.5.20
>
> 10 11 0 0 0 0 1 V2000
> -0.7367 1.8295 0.0000 C 0 0
> -1.4511 1.4170 0.0000 C 0 0
> -1.4511 0.5919 0.0000 C 0 0
> -0.7367 0.1794 0.0000 C 0 0
> -0.0222 0.5919 0.0000 C 0 0
> -0.0222 1.4170 0.0000 C 0 0
> -0.7367 -0.6457 0.0000 C 0 0
> -0.0223 -1.0582 0.0000 C 0 0
> 0.6922 -0.6458 0.0000 C 0 0
> 0.6923 0.1793 0.0000 C 0 0
> 1 2 2 0
> 2 3 1 0
> 3 4 2 0
> 4 5 1 0
> 5 6 2 0
> 6 1 1 0
> 7 8 2 0
> 8 9 1 0
> 9 10 2 0
> 10 5 1 0
> 4 7 1 0
> M END
>
>
> I read it into rdkit:
>
> mol = Chem.MolFromMolBlock(ctab)
>
> >>> print Chem.MolToMolBlock(mol)
>
> RDKit 3D
>
> 10 11 0 0 0 0 0 0 0 0999 V2000
> -0.7367 1.8295 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> -1.4511 1.4170 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> -1.4511 0.5919 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> -0.7367 0.1794 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> -0.0222 0.5919 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> -0.0222 1.4170 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> -0.7367 -0.6457 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> -0.0223 -1.0582 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> 0.6922 -0.6458 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> 0.6923 0.1793 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> 1 2 2 0
> 2 3 1 0
> 3 4 2 0
> 4 5 1 0
> 5 6 2 0
> 6 1 1 0
> 7 8 2 0
> 8 9 1 0
> 9 10 2 0
> 10 5 1 0
> 4 7 1 0
> M END
>
> >>> mol.GetConformer().Is3D()
> True
>
> Can you tell my why RDKit thinks this is 3D? The column with z
> coordinates is all zeros. How can I build my input ctab in such a way
> to clearly indicate that this is 2D depiction?
>
>
> On Thu, Aug 21, 2014 at 8:16 AM, Michał Nowotka <[email protected]> wrote:
> > Thank you Greg. I have to verify your example with my instance of
> > RDKit, maybe my old version behaves differently.
> > Which part of the code (C++ or Python part) is responsible for
> > calculating coordinates?
> >
> > On Thu, Aug 21, 2014 at 4:40 AM, Greg Landrum <[email protected]>
> wrote:
> >> 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 0 999 V2000
> >> ...: -3.5578 0.8250 0.0000 C 0 0 0 0 0 0 0 0 0
> 0 0
> >> 0
> >> ...: -4.2723 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0
> 0 0
> >> 0
> >> ...: -4.2723 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0
> 0 0
> >> 0
> >> ...: -3.5578 -0.8250 0.0000 C 0 0 0 0 0 0 0 0 0
> 0 0
> >> 0
> >> ...: -1.8268 -0.7219 0.0000 C 0 0 0 0 0 0 0 0 0
> 0 0
> >> 0
> >> ...: -2.8433 0.4125 0.0000 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.5578 0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> >> -4.2723 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> >> -4.2723 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> >> -3.5578 -0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> >> -1.8268 -0.7219 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> >> -2.8433 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> >> -3.5578 1.9250 0.0000 H 0 0 0 0 0 1 0 0 0 0 0 0
> >> -5.2249 0.9625 0.0000 H 0 0 0 0 0 1 0 0 0 0 0 0
> >> -5.2249 -0.9625 0.0000 H 0 0 0 0 0 1 0 0 0 0 0 0
> >> -3.8108 -1.8955 0.0000 H 0 0 0 0 0 1 0 0 0 0 0 0
> >> -0.8095 -1.1404 0.0000 H 0 0 0 0 0 1 0 0 0 0 0 0
> >> -2.1500 1.2665 0.0000 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.7500 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> >> 0.7500 -0.0000 0.0000 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.7500 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> >> 0.7500 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
> >> -1.1167 0.0000 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.1167 -0.8981 -0.5185 H 0 0 0 0 0 1 0 0 0 0 0 0
> >> 1.1167 -0.0000 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.1167 0.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 <[email protected]>
> >> wrote:
> >>>
> >>>
> >>>
> >>> On Wednesday, August 20, 2014, Michał Nowotka <[email protected]>
> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss