Hi Greg,
thanks a lot.
That is exactly what I was looking for!
RDKit rules!
Kind regards,
Axel
On 19.09.2016 09:35, Greg Landrum wrote:
Hi Axel,
It's probably most straightforward to use the function
AllChem.TransformMol() to scale the coordinates.
Here's an example of applying the function to scale all the
coordinates by a factor of 2:
In [1]: from rdkit import Chem
In [2]: from rdkit.Chem import rdMolTransforms
In [5]: from rdkit.Chem import AllChem
In [6]: import numpy
In [7]: tm = numpy.zeros((4,4),numpy.double)
In [8]: for i in range(3): tm[i,i] = 2.
In [9]: tm[3,3] = 1.
In [10]: m = Chem.MolFromSmiles('C1CCC1')
In [11]: AllChem.Compute2DCoords(m)
Out[11]: 0
In [12]: print(Chem.MolToMolBlock(m))
RDKit 2D
4 4 0 0 0 0 0 0 0 0999 V2000
1.0607 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.0000 -1.0607 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.0607 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 1.0607 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0
2 3 1 0
3 4 1 0
4 1 1 0
M END
In [13]: AllChem.TransformMol(m,tm)
In [14]: print(Chem.MolToMolBlock(m))
RDKit 2D
4 4 0 0 0 0 0 0 0 0999 V2000
2.1213 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.0000 -2.1213 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-2.1213 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 2.1213 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0
2 3 1 0
3 4 1 0
4 1 1 0
M END
In your case, assuming that the bond length in the drawings is 1.0A,
you would use a scale factor of 1.5 (that's on line [8] above).
Best,
-greg
On Mon, Sep 19, 2016 at 8:41 AM, Axel Pahl <[email protected]
<mailto:[email protected]>> wrote:
Dear fellow RDKitters,
I have an SD file with 2D molecules generated by another
Cheminformatics
toolkit (yes, there are others! ;-) ).
When I depict them with RDKit (with Draw.MolToImage()) they look very
condensed with too short bonds and just appear not right.
When I re-generate the coordinates by using Compute2DCoord(), the
structure drawings do look great, but RDkit re-calculates all
coordinates and the orientation of the whole molecule is
completely changed.
Can I avoid this, keep the original orientation of the molecules and
just do something like "apply drawing settings" or "use standard bond
lengths" to a molecule?
Many thanks in advance.
Kind regards,
Axel
------------------------------------------------------------------------------
_______________________________________________
Rdkit-discuss mailing list
[email protected]
<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
<https://lists.sourceforge.net/lists/listinfo/rdkit-discuss>
------------------------------------------------------------------------------
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss