On Nov 12, 2009, at 4:40 AM, Mark Rijnbeek wrote: >>>>> >>>>> Not sure I can... those lines were actually added by Rajarshi: >>>>> >>>>> Updated code to handle the * SMARTS pattern so that it ignores >>>>> H's >>>>> unless they have an isotopic mass specification. This means * no >>>>> longe... >>>> Aah, indeed. I think this was based on some discussion on the >>>> OpenBabel or BO lists regarding interpretation of SMARTS matching >>>> for H's. I know that h<n> was deprecated in favor of H<n> and >>>> this maybe related to that. >>>> One general solution might be to have 2 modes, like daylight: >>>> normal matching (ignore H's) and explicit H matching >>> >>> The problem seems to me that the hydrogen in for example [H] >>> [C@@]1(CCC(C)=CC1=O)C(C)=C isn't "ignored". Method >>> HydrogenAtom.match() returns false, and that makes the match >>> false. Perhaps I don't get it, but I'd say to ignore would mean to >>> return true. >> Aah, indeed. > > What do you think the best patch would be? I'm a bit lost, because I > don't know what was discussed on the OpenBabel lists. > > Would this change tackle it ? > > if ( atom.getMassNumber() == null || > (atom.getMassNumber() != null && atom.getMassNumber() > 1)) { > return true; > } > > The match is then true for all these test cases > > test("[C@@]1(CCC(C)=CC1=O)C(C)=C[H]"); > test("[H][C@@]1(CCC(C)=CC1=O)C(C)=C"); > test("[H][H]"); > test("[2H]"); > test("[H]");
I think this is correct. Does this patch change the number of failures in SMARTSSearchTest? (There are currently 9 failures I think). If not, then this is likely OK. I wonder, wouldn't a simple patch just be: if atom symbol == 'H" return true? I don't remember the reason for the multiple conditions being checked for in HydrogenAtom.match() (which was written by Dazhi) ---------------------------------------------------- Rajarshi Guha | NIH Chemical Genomics Center http://www.rguha.net | http://ncgc.nih.gov ---------------------------------------------------- Nothing spoils fun like finding out it builds character" -Calvin ------------------------------------------------------------------------------ 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 _______________________________________________ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user