Craig, Craig A. James wrote on 11/17/2009 04:47 PM: > One last thing to beware of. The recursive match is truly recursive, > which means that only the "head" atom of the recursive expression is > marked as "used" once the recursion finishes. For example, the smarts > "C[$(CO)]O" would match the molecule "CCO". The recursive "CO" > expression would match the center carbon, because it does in fact have > an attached oxygen. But then the final "O" in the SMARTS would *also* > match that same oxygen, because once match for [$(CO)] finished, the > pattern matcher "forgot" about the oxygen, leaving only the central "C" > is marked as the matched atom.
This is an important point. I want to find CCO | O and not CCO I found two ways to deal with it. The first enforces a certain degree on the center node where the branch starts, like so: C[$(CD3O)]O, for our toy example. If you have more than one branch on the second C you will have to increase to D4 and so on. This leads to a disjunction of node degrees like C[$(CD3,D4O),$(CD3,D4O)]O if you also want to detect O | CCO | O with either one or both of the branches attached. It would be much cleaner if it was possible to specify a minimum degree instead of exact degrees. A more elegant solution that achieves this is to enforce a certain environment around the node, like this: C[C;$(C(O)*)]O. It specifies a degree of at least 3 for the second C because '*' must match something different than the branch to O. Do you agree? Best regards Andreas -- http://www.maunz.de OpenPGP key: http://www.maunz.de/[email protected]_pub.asc Real programmers don't document. If it was hard to write, it should be hard to understand. ------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
