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

Attachment: smarts2smiles.pl
Description: Perl program

------------------------------------------------------------------------------
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
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to