Thanks for that answer Lukas.

This is something that's come up before (here's a relatively recent one:
https://sourceforge.net/p/rdkit/mailman/message/35376573/) and it would
probably be worth making this easier.

rdDepictor.Compute2DCoords takes an optional bondLength argument that
allows you to change the default bond length. We should probably add this
to GenerateDepictionMAtching2DStructure() too. Or would it be more useful
for that that have some (optional) logic that determines the average bond
length in the reference structure and uses that as the default?

-greg

On Thu, May 23, 2019 at 3:04 PM Lukas Pravda <lpra...@ebi.ac.uk> wrote:

> Hi Pat,
>
>
>
> From my experience rdkit uses more or less 1.5 units bond length for 2D
> depictions. So it makes sense if you rescale your template so that the bond
> length is 1.5.
>
>
>
> This is the code snippet I use for the same thing to upscale template with
> bond lengths 1.0 to 1.5
>
>
>
> import numpy
>
>
>
> factor = 1.5
>
>
>
> mol = Chem.MolFromMolFile(src, sanitize=True)
>
> matrix = numpy.zeros((4, 4), numpy.float)
>
>
>
> for i in range(3):
>
>     matrix[i, i] = factor
>
>     matrix[3, 3] = 1
>
>
>
> AllChem.TransformMol(mol, matrix)
>
> Chem.MolToMolFile(mol, dst)
>
>
>
> Let me know if this is what you were looking for.
>
>
>
> Lukas
>
> *From: *Patrick Walters <wpwalt...@gmail.com>
> *Date: *Thursday, 23 May 2019 at 13:22
> *To: *RDKIT mailing list <rdkit-discuss@lists.sourceforge.net>
> *Subject: *[Rdkit-discuss] GenerateDepictionMatching2DStructure question
>
>
>
> Hi All,
>
>
>
> I'm trying to align a set of structures to a template that I have as
> molfile.  When I call GenerateDepictionMatching2DStructure it appears that
> the coordinate for the template are directly copied.  This results in a
> structure like the one below, where the bond lengths for the template are
> different from those in the rest of the molecule.
>
>
>
> [image: image.png]
>
> Is there a way around this so that all of the bond lengths will be the
> same?
>
>
>
> My code is below, thanks in advance,
>
>
>
> Pat
>
>
>
> from rdkit import Chem
> from rdkit.Chem import rdDepictor
>
>
>
> mb = """
>      RDKit          2D
>
>   9 10  0  0  0  0  0  0  0  0999 V2000
>     2.1845    0.2000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     1.4701   -0.2125    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     1.4701   -1.0375    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     2.1845   -1.4500    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
>     2.8990   -1.0375    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     2.8990   -0.2125    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     3.6836    0.0425    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
>     3.6836   -1.2924    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
>     4.1685   -0.6250    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
>   5  6  1  0
>   7  9  1  0
>   6  7  2  0
>   8  9  1  0
>   1  6  1  0
>   1  2  2  0
>   2  3  1  0
>   3  4  2  0
>   4  5  1  0
>   5  8  2  0
> M  END"""
>
>
> tmplt = Chem.MolFromMolBlock(mb)
>
> smiles = "FC(F)(F)Oc1cccc(-n2nnc3ccc(NC4CCOCC4)nc32)c1"
> mol = Chem.MolFromSmiles(smiles)
> rdDepictor.GenerateDepictionMatching2DStructure(mol, tmplt)
>
>
>
> _______________________________________________ Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to