Thanks for the replies. I guess it's time for a new query language with capabilities beyond SMARTS. I found at least a "workaround" with SMARTS: one can mandatory demand the part "before" the branching point and then attach two versions, with and without the branch using OR.
Consider these examples created with the ruby code by Rich (http://depth-first.com/articles/2006/10/31/obruby-a-ruby-interface-to-open-babel): 1) demand core structure "PCCC" and optional branch to "O" at position 2 (the 2nd "C"): Found 1 instances of the SMARTS pattern 'P-[$(C-C),$(C(-O)-C)]' in the SMILES string 'C-P-C(-O)-C-S'. Here are the atom indices: Hit 0: [ 2 3 ] 2) demand the same pattern for the reduced molecule without branch to "O": Found 1 instances of the SMARTS pattern 'P-[$(C-C),$(C(-O)-C)]' in the SMILES string 'C-P-C-C-S'. Here are the atom indices: Hit 0: [ 2 3 ] 3) also works on reduced mol with "exchanged" branches, i.e. core structure "PCO" and optional branch "CS" at position 2: Found 1 instances of the SMARTS pattern 'P-[$(C-O),$(C(-C)-O)]' in the SMILES string 'C-P-C(-C-S)-O'. Here are the atom indices: Hit 0: [ 2 3 ] The drawback is that it is necessary to specify both possibilities, with and without branch. On the positive side we save some space compared to writing out all combinations of ground patterns, but that hurts readability. Also OB returns only one match which consists of the part up to the branching position. Greetings Andreas SMARTS: "P-[$(C-C),$(C(-O)-C-C)]" <= either PCC or PC(O)C This matches on both "C-P-C(-O)-C-S" and "C-P-C-C-S". It makes the part up to the position where the branch to "O" is attached mandatory ("P-"), but not the part after the branch Rajarshi Guha wrote on 11/16/2009 03:10 PM: > On Mon, Nov 16, 2009 at 8:52 AM, Andrew Dalke > <da...@dalkescientific.com>wrote: > >> On Nov 16, 2009, at 1:46 PM, Andreas Maunz wrote: >> >>> Is there a way to combine s1 and s2 into a single SMARTS expression? >> Sadly, no. I seem to recall other molecular structure query languages >> which are a bit more capable and which might support this, but my >> recollection is they are a lot more verbose, and I can't think of any >> references off-hand. >> > > MQL (http://en.wikipedia.org/wiki/Molecular_Query_Language) might support > this, but as Andrew pointed out, it can be quite a bit more verbose than > SMARTS > > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > 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 -- http://www.maunz.de OpenPGP key: http://www.maunz.de/andr...@maunz.de_pub.asc I do know everything, just not all at once. It's a virtual memory problem. ------------------------------------------------------------------------------ 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