Hi Libby,

There's not currently anything directly available to do this, but some
pieces that might help are sort of there.

You could imagine getting drawings of the reactions as SVG and then adding
the arrows that indicate the mechanism to that.
In order to do this, you'd likely want to be able to figure out where the
atoms are in the SVG. This is mostly possible, if in an ugly way.

Here's an example, which I'll explain below:

In [6]: rxn =
AllChem.ReactionFromSmarts('C=CCBr.[I-]>>C=CCI.[Br-]',useSmiles=True)

In [12]: canv = rdMolDraw2D.MolDraw2DSVG(300,300)

In [13]: canv.drawOptions().includeAtomTags = True

In [14]: canv.DrawReaction(rxn)

In [15]: canv.FinishDrawing()

In [16]: print(canv.GetDrawingText())
<?xml version='1.0' encoding='iso-8859-1'?>
<svg:svg version='1.1' baseProfile='full'
              xmlns:svg='http://www.w3.org/2000/svg'
                      xmlns:rdkit='http://www.rdkit.org/xml'
                      xmlns:xlink='http://www.w3.org/1999/xlink'
                  xml:space='preserve'
width='300px' height='300px' >
<svg:rect style='opacity:1.0;fill:#FFFFFF;stroke:none' width='300'
height='300' x='0' y='0'> </svg:rect>
<rdkit:atom idx="1" x="13.6364" y="151.983" />
<rdkit:atom idx="2" x="33.6927" y="143.449" />
<rdkit:atom idx="3" x="51.1119" y="156.551" />
<rdkit:atom idx="4" label="Br" x="71.1682" y="148.017" />
<rdkit:atom idx="5" label="I<sup>-</sup>" x="100.23" y="150" />
<rdkit:atom idx="6" x="194.682" y="151.983" />
<rdkit:atom idx="7" x="214.739" y="143.449" />
<rdkit:atom idx="8" x="232.158" y="156.551" />
<rdkit:atom idx="9" label="I" x="252.214" y="148.017" />
<rdkit:atom idx="10" label="Br<sup>-</sup>" x="281.276" y="150" />
<svg:path d='M 14.4898,153.989 34.5461,145.455'
style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1'
/>

 ... SNIP ...


<svg:path d='M 169.98,148.063 172.886,150'
style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1'
/>
</svg:svg>


Notice the rdkit:atom properties there. Those are the positions of the
corresponding atoms in the output SVG.
The ugliness comes due to the fact that, currently at least, you get these
in increasing order with no indication of whether they belong to an
reactant (and if so, which reactant) or a product (and if so, which
product). You are safe assuming that the reactants are output in order,
followed by the products, and that the atoms within each are output in
order. So atom idx 1 above is atom 0 in the first reactant, atom idx 5 is
atom 0 in the second reactant, atom idx 7 is atom 1 in the first product,
etc.
I'm going to think about ways to make this output a bit easier to handle
for reactions (suggestions appreciated), but that's what is currently there.

It's also worth thinking about what the API would look like to add the
arrows directly

Apologies that this isn't straightforward, but this may be enough to get a
start?

-greg





On Tue, Dec 5, 2017 at 4:27 PM, Phipps, Elizabeth C <ephip...@tulane.edu>
wrote:

> Hi,
>
> The goal is to help students visualize reactions and to do so we have been
> working to figure out how to get reaction arrows in the reaction output. We
> cannot seem to find much information as to whether it is possible to have
> the output (a visual organic reaction) contain reaction arrows using RDKit
> with SMILES and SMIRKS even though some examples have arrows.
> I am wondering if there is any further information as to whether it is
> possible to show reaction arrows.
>
> For example:
>
> Thanks,
> Libby
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to