Re: [Rdkit-discuss] Using DrawAttachmentLine for bidentate ligands

2022-08-14 Thread Geoffrey Hutchison
 Yep, I’m aware .. but it wouldn’t take too much work to at least ignore
“<“ and “>” in the Open Babel parser. 

In the meantime, my Python scripts will strip them from the SMILES strings
before passing them to Open Babel.

-Geoff

On Aug 14, 2022 at 4:42:25 AM, David Cosgrove 
wrote:

> Hi Geoff,
> You should bear in mind that the dative bond syntax is an RDKIt extension
> to SMILES so is not guaranteed to be parsed correctly by other
> cheminformatics toolkits.
> Dave
>
>
> On Sun, 14 Aug 2022 at 00:42, Geoffrey Hutchison <
> geoff.hutchi...@gmail.com> wrote:
>
>> mol = Chem.MolFromSmiles("C12=CC=CC=[N]1->[*]<-[N]3=C2C=CC=C3")
>>
>>
>> Hmm. I forgot the SMILES syntax of dative bonds. That's a nice idea.
>>
>> I actually decided to use the noFreeType=True option, add a highlight as
>> the "metal" and remove the * from the depiction.
>>
>> The initial set is at:
>> https://github.com/OpenChemistry/fragments/tree/main/ligands
>>
>> Thanks!
>> -Geoff
>>
>>
>>
>>
>> ___
>> Rdkit-discuss mailing list
>> Rdkit-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
> --
> David Cosgrove
> Freelance computational chemistry and chemoinformatics developer
> http://cozchemix.co.uk
>
>
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Using DrawAttachmentLine for bidentate ligands

2022-08-14 Thread David Cosgrove
Hi Geoff,
You should bear in mind that the dative bond syntax is an RDKIt extension
to SMILES so is not guaranteed to be parsed correctly by other
cheminformatics toolkits.
Dave


On Sun, 14 Aug 2022 at 00:42, Geoffrey Hutchison 
wrote:

> mol = Chem.MolFromSmiles("C12=CC=CC=[N]1->[*]<-[N]3=C2C=CC=C3")
>
>
> Hmm. I forgot the SMILES syntax of dative bonds. That's a nice idea.
>
> I actually decided to use the noFreeType=True option, add a highlight as
> the "metal" and remove the * from the depiction.
>
> The initial set is at:
> https://github.com/OpenChemistry/fragments/tree/main/ligands
>
> Thanks!
> -Geoff
>
>
>
>
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
-- 
David Cosgrove
Freelance computational chemistry and chemoinformatics developer
http://cozchemix.co.uk
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Using DrawAttachmentLine for bidentate ligands

2022-08-13 Thread Geoffrey Hutchison
> mol = Chem.MolFromSmiles("C12=CC=CC=[N]1->[*]<-[N]3=C2C=CC=C3")

Hmm. I forgot the SMILES syntax of dative bonds. That's a nice idea.

I actually decided to use the noFreeType=True option, add a highlight as the 
"metal" and remove the * from the depiction.

The initial set is at: 
https://github.com/OpenChemistry/fragments/tree/main/ligands 


Thanks!
-Geoff




___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Using DrawAttachmentLine for bidentate ligands

2022-08-11 Thread Paolo Tosco
Hi Geoff,

you can indeed use DrawWavyLine() coupled to some basic 2D geometry as in
the example below:

from rdkit import Chem
from rdkit.Geometry import Point3D, Point2D
from rdkit.Chem.Draw import rdDepictor, rdMolDraw2D
from IPython.display import SVG

mol = Chem.MolFromSmiles("C12=CC=CC=[N]1->[*]<-[N]3=C2C=CC=C3")

rdDepictor.Compute2DCoords(mol)
0

dative_bonds = [b for b in mol.GetBonds() if b.GetBondType() ==
Chem.BondType.DATIVE]

def draw_attachment_line(mol, drawer, bond, wavy_color=(0.0, 0.0, 0.0),
n_segments=12, offset=0.07, wavy_len=0.8):
bi = bond.GetBeginAtomIdx()
ei = bond.GetEndAtomIdx()
bc = mol.GetConformer().GetAtomPosition(bi)
ec = mol.GetConformer().GetAtomPosition(ei)
bv = bc - ec
bv.Normalize()
midpoint = (bc + ec) * 0.5
ba = midpoint + Point3D(bv.y, -bv.x, 0.0) * (wavy_len * 0.5)
ea = midpoint + Point3D(-bv.y, bv.x, 0.0) * (wavy_len * 0.5)
drawer.DrawWavyLine(Point2D(ba.x, ba.y), Point2D(ea.x, ea.y),
wavy_color, wavy_color, n_segments, offset)

drawer = rdMolDraw2D.MolDraw2DSVG(500, 300)
drawer.DrawMolecule(mol)
for bond in dative_bonds:
draw_attachment_line(mol, drawer, bond)
drawer.FinishDrawing()
SVG(drawer.GetDrawingText())
[image: image.png]

You can tweak the default offset of waves, the number of waves and the
length of the wavy bond through the relevant parameters in
draw_attachment_line().

Cheers,
p.

On Wed, Aug 10, 2022 at 5:22 PM Geoffrey Hutchison <
geoff.hutchi...@gmail.com> wrote:

> I've been using RDKit for depicting sets of ligands from SMILES, which has
> been great.
>
> I'd like to add some bidentate and tridentate ligands. Let's stick to
> bipyridine at first (see image)
>
>
> I have the appropriate SMILES, leaving * as part of a 5 atom ring
> involving the nitrogen atoms (and sanitize = False)
> C12=CC=CC=[N]1[*][N]3=C2C=CC=C3
>
> The resulting depiction is great .. except I'd like to add the attachment
> "squiggles" across the N-* bonds.
>
> I see there are DrawAttachmentLine and DrawWavyLine methods, but I'd need
> to get the positions of the N and * atoms.
>
> What's the best way to do that and / or automate adding wavy lines across
> arbitrary bonds?
>
> Thanks,
> -Geoff
>
> ___
> 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


Re: [Rdkit-discuss] Using DrawAttachmentLine for bidentate ligands

2022-08-11 Thread David Cosgrove
Hi Geoff,
The drawer has the GetDrawCoords() method.  There are 2 overloads, one
takes a Point2D, the other an atom index, and both return the coordinates
in the drawers reference frame.  Assuming you're working in Python.  In
C++, they're getDrawCoords().
https://www.rdkit.org/docs/source/rdkit.Chem.Draw.rdMolDraw2D.html

Dave


On Wed, Aug 10, 2022 at 4:22 PM Geoffrey Hutchison <
geoff.hutchi...@gmail.com> wrote:

> I've been using RDKit for depicting sets of ligands from SMILES, which has
> been great.
>
> I'd like to add some bidentate and tridentate ligands. Let's stick to
> bipyridine at first (see image)
>
>
> I have the appropriate SMILES, leaving * as part of a 5 atom ring
> involving the nitrogen atoms (and sanitize = False)
> C12=CC=CC=[N]1[*][N]3=C2C=CC=C3
>
> The resulting depiction is great .. except I'd like to add the attachment
> "squiggles" across the N-* bonds.
>
> I see there are DrawAttachmentLine and DrawWavyLine methods, but I'd need
> to get the positions of the N and * atoms.
>
> What's the best way to do that and / or automate adding wavy lines across
> arbitrary bonds?
>
> Thanks,
> -Geoff
>
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>


-- 
David Cosgrove
Freelance computational chemistry and chemoinformatics developer
http://cozchemix.co.uk
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Using DrawAttachmentLine for bidentate ligands

2022-08-10 Thread Geoffrey Hutchison
I've been using RDKit for depicting sets of ligands from SMILES, which has been 
great.

I'd like to add some bidentate and tridentate ligands. Let's stick to 
bipyridine at first (see image)



I have the appropriate SMILES, leaving * as part of a 5 atom ring involving the 
nitrogen atoms (and sanitize = False)
C12=CC=CC=[N]1[*][N]3=C2C=CC=C3

The resulting depiction is great .. except I'd like to add the attachment 
"squiggles" across the N-* bonds.

I see there are DrawAttachmentLine and DrawWavyLine methods, but I'd need to 
get the positions of the N and * atoms.

What's the best way to do that and / or automate adding wavy lines across 
arbitrary bonds?

Thanks,
-Geoff

___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss