Thanks Greg - this is great!  I must confess, I was eager to try this out asap 
- but have not built rdkit before.  I did start having a go over the weekend on 
my home PC (Windows MCE2005) but ran into a couple of unexpected issues with 
the software installs that made me think I would wait and retry on my work PC.

[not really relevant, but for interest - I think the problems may have been 
related to the Visual Studio 2010 Express installation.  The result was an 
infuriating clicking in the audio when streaming live or recorded TV to an 
extender!!  Not an issue that I felt was easy to troubleshoot... I reinstalled 
my system from a drive image backup and the problem was gone... That's when I 
decided to leave well alone, as my family may not have seen the benefit of 
up-to-the-minute builds at home at the expense of TV enjoyment : ) ]

I will get my PC at work setup to build from SVN snapshots - but I was very 
pleased to see your post 
(http://www.mail-archive.com/rdkit-discuss@lists.sourceforge.net/msg01097.html) 
saying that Q2 binaries should be available next week - great news!

Kind regards

James

-----Original Message-----
From: Greg Landrum [mailto:greg.land...@gmail.com] 
Sent: 18 June 2010 06:08
To: rdkit-discuss@lists.sourceforge.net
Cc: James Davidson
Subject: Re: [Rdkit-discuss] A couple of questions regarding ReactionFromSmarts

Dear all,

A followup/update on a request from a couple weeks ago:

On Fri, Jun 4, 2010 at 6:13 AM, Greg Landrum <greg.land...@gmail.com> wrote:
> On Thu, Jun 3, 2010 at 7:51 PM, James Davidson <j.david...@vernalis.com> 
> wrote:
>>
>> (1)  I see that the reaction objects can be created from MDL Reaction 
>> Files/Blocks - is there a way to do the reverse, and save a reaction 
>> object in MDL .rxn format?  I tried using investigating the 
>> rxn.ToBinary() attribute, but didn't get very far...  The reason I 
>> wanted to do this, is that I was trying to figure-out how to generate 
>> a form of the reaction object (generated from reaction SMARTS) that 
>> was suitable for converting into a 2D depiction of the transformation.
>
> At the moment the reactions are essentially input-only. There's really 
> no way to get them out in any format that could be used elsewhere.
> This is a sadly missing feature: it would be really nice to be able to 
> generate either .rxn files (or at least reaction smarts) from 
> reactions. I will add a feature request for this, but it may take a 
> while to happen.[1]

I've added a partial solution to this that at least provides some help with 
visualizing reactions.

Here's my reaction:
[12]>>> rxn = 
AllChem.ReactionFromSmarts('[C:1](=[O:2])-[O;-,H].[N;!$(N-C=[O,N,S]);!$(N=*):3]>>[C:1](=[O:2])-[N:3]')


You can now output reaction smarts:
[13]>>> AllChem.ReactionToSmarts(rxn)
Out[13] 
'[C:1](=[O:2])-[O;-,H1].[N;!$(N-C=[O,N,S]);!$(N=*):3]>>[C:1](=[O:2])-[N:3]'

You can also generate coordinates for a reaction and the create an rxn file:
[14]>>> AllChem.Compute2DCoordsForReaction(rxn)
[15]>>> print AllChem.ReactionToRxnBlock(rxn)
------> print(AllChem.ReactionToRxnBlock(rxn))
$RXN

      RDKit

  2  1
$MOL

     RDKit          2D

  3  2  0  0  0  0  0  0  0  0999 V2000
   -0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  1  0  0
   -0.0000   -1.5000    0.0000 O   0  0  0  0  0  0  0  0  0  2  0  0
   -0.0000    1.5000    0.0000 *   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  2  0
  1  3  1  0
V    3 [O;-,H1]
M  END
$MOL

     RDKit          2D

  1  0  0  0  0  0  0  0  0  0999 V2000
    0.5000    0.0000    0.0000 *   0  0  0  0  0  0  0  0  0  3  0  0
V    1 [N;!$(N-C=[O,N,S]);!$(N=*):3]
M  END
$MOL

     RDKit          2D

  3  2  0  0  0  0  0  0  0  0999 V2000
    1.5000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  1  0  0
    1.5000   -1.5000    0.0000 O   0  0  0  0  0  0  0  0  0  2  0  0
    1.5000    1.5000    0.0000 N   0  0  0  0  0  0  0  0  0  3  0  0
  1  2  2  0
  1  3  1  0
M  END

#----------------------------------------

Notice that query features on atoms in the rxn blocks are not output as 
property ctab query features. Instead I use the atom-value feature of ctabs and 
output the SMARTS query for the atoms. This has the marked disadvantage that it 
won't actually generate reactions that do sensible things in other tools, but 
at least you can do some debugging of reactions. At some point in the future it 
would be nice to have ctab queries handled correctly, but this is at least 
something.

These changes are checked into subversion and will be in the next release.

Best Regards,
-greg

______________________________________________________________________
PLEASE READ: This email is confidential and may be privileged. It is intended 
for the named addressee(s) only and access to it by anyone else is 
unauthorised. If you are not an addressee, any disclosure or copying of the 
contents of this email or any action taken (or not taken) in reliance on it is 
unauthorised and may be unlawful. If you have received this email in error, 
please notify the sender or postmas...@vernalis.com. Email is not a secure 
method of communication and the Company cannot accept responsibility for the 
accuracy or completeness of this message or any attachment(s). Please check 
this email for virus infection for which the Company accepts no responsibility. 
If verification of this email is sought then please request a hard copy. Unless 
otherwise stated, any views or opinions presented are solely those of the 
author and do not represent those of the Company.

The Vernalis Group of Companies
Oakdene Court
613 Reading Road
Winnersh, Berkshire
RG41 5UA.
Tel: +44 118 977 3133

To access trading company registration and address details, please go to the 
Vernalis website at www.vernalis.com and click on the "Company address and 
registration details" link at the bottom of the page..
______________________________________________________________________

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to