SMARTS to SMILES

8 messages Options
Embed this post
Permalink
Vinay M-2

SMARTS to SMILES

Reply Threaded More More options
Print post
Permalink
Hi
   Can anyone help to know, how to convert from SMARTS to SMILES.

Thanks 
With Warm Regards
Vinay


Yahoo! Canada Toolbar : Search from anywhere on the web and bookmark your favourite sites. Download it now!


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Craig A. James-3

Re: SMARTS to SMILES

Reply Threaded More More options
Print post
Permalink
Vinay M wrote:
>  Can anyone help to know, how to convert from SMARTS to SMILES.

You can't. SMARTS is a superset of SMILES, and most SMARTS are not valid SMILES.

Perhaps if you explain why you need to do this, we might be able to suggest a solution.

Craig

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Vinay M-2

SMARTS to SMILES

Reply Threaded More More options
Print post
Permalink

Hi
    Craig,
              Thanks for your reply, i was using smiles to view the structure, so few are in smarts. I just wanted to convert smiles to smarts and smarts to smiles.
Thanks
Kindly help
 With Warm regards
Vinay
  
--- On Tue, 11/10/09, Craig A. James <[hidden email]> wrote:

From: Craig A. James <[hidden email]>
Subject: Re: [Open Babel] SMARTS to SMILES
To: "Vinay M" <[hidden email]>, [hidden email]
Received: Tuesday, November 10, 2009, 7:29 PM

Vinay M wrote:
>  Can anyone help to know, how to convert from SMARTS to SMILES.

You can't. SMARTS is a superset of SMILES, and most SMARTS are not valid SMILES.

Perhaps if you explain why you need to do this, we might be able to suggest a solution.

Craig


Make your browsing faster, safer, and easier with the new Internet Explorer® 8. Optimized for Yahoo! Get it Now for Free!
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Geoffrey Hutchison-2

Re: SMARTS to SMILES

Reply Threaded More More options
Print post
Permalink
>               Thanks for your reply, i was using smiles to view the structure, so few are in smarts. I just wanted to convert smiles to smarts and smarts to smiles.

SMILES is a subset of SMARTS, so any SMILES string can be used as a SMARTS. The reverse is not true. I can design many SMARTS, which are not valid SMILES. For example [*] matches any atom.

So no, as Craig said, you cannot interconvert them.
-Geoff
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Vinay M-2

Re: SMARTS to SMILES

Reply Threaded More More options
Print post
Permalink
Hi
   Thanks a lot for your reply. I then use smiles for SMARTS.

Vinay

--- On Tue, 11/10/09, Geoffrey Hutchison <[hidden email]> wrote:

From: Geoffrey Hutchison <[hidden email]>
Subject: Re: [Open Babel] SMARTS to SMILES
To: "Vinay M" <[hidden email]>
Cc: "babel" <[hidden email]>
Received: Tuesday, November 10, 2009, 8:55 PM

>               Thanks for your reply, i was using smiles to view the structure, so few are in smarts. I just wanted to convert smiles to smarts and smarts to smiles.

SMILES is a subset of SMARTS, so any SMILES string can be used as a SMARTS. The reverse is not true. I can design many SMARTS, which are not valid SMILES. For example [*] matches any atom.

So no, as Craig said, you cannot interconvert them.
-Geoff


All new Yahoo! Mail - Get a sneak peak at messages with a handy reading pane.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Craig A. James-3

Re: SMARTS to SMILES

Reply Threaded More More options
Print post
Permalink
In reply to this post by Vinay M-2
Vinay,

>               Thanks for your reply, i was using smiles to view the
> structure, so few are in smarts. I just wanted to convert smiles to
> smarts and smarts to smiles.

Ok, now that I know what you're doing, I can suggest a possible way to do it, but it's not easy.  Attached is a little Perl program that might work for 95% of the SMARTS you will encounter.  With a bit of work, you might be able to improve it even more.  (If you need this in C or C++, it's a lot harder.)  You should be able to modify this example to suit your needs.

This will parse a SMARTS, and also knows what symbols are valid for SMILES atoms and bonds.  Any time it encounters a SMARTS atom that's not a valid SMILES atom, it is replaced it with '*'.

  C1[C,N]CCCC1  ==> C1*CCCC1

  CC-=CC  ==> CC-CC

It's made more difficult by aromatic structures, for example, c1[n,c]cccc1 becomes c1*cccc1, which in theory is a valid aromatic SMILES, but in practice some interpreters don't consider it aromatic.

It doesn't try to deal with bonds, and there are probably SMARTS that it doesn't get right, I just spent a few minutes on it.

Craig


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

smarts2smiles.pl (1K) Download Attachment
Vinay M-2

SMARTS to SMILES

Reply Threaded More More options
Print post
Permalink
Hi Craig,
             Thanks a lot, could you please send me the C or C++ code, since it deal with it a lot. I will follow those in perl and try. Thanks a lot.


Instant message from any web browser! Try the new Yahoo! Canada Messenger for the Web BETA
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
Craig A. James-3

Re: SMARTS to SMILES

Reply Threaded More More options
Print post
Permalink
Vinay,

>              Thanks a lot, could you please send me the C or C++ code,
> since it deal with it a lot. I will follow those in perl and try. Thanks
> a lot.

You're welcome, but I can't do it in C or C++.  It would take days to do the same thing.  Perl has very powerful string-handling functions, which is the only reason I could write the program so quickly.  That's why we use Perl so much.  You should try to find a way to incorporate a Perl program into your system. If you rewrite this in C or C++, it will be very difficult.

Craig

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
OpenBabel-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss