Thanks for finding and diagnosing this bug. I have committed a fix to GitHub. Perhaps you can check it on your system.
Chris On 14/03/2013 18:46, baloo wrote: > It seems like obabel invoked with '--filter' option fails to parse filter > string properly. > I am running openbabel 2.3.2 compiled with gcc 4.6.3 on Ubuntu 12.04.2 LTS. > > My SDF file is: > > MySoft > Molecule1 > 5 4 0 0 0 0 0 0 0999 V2000 > 2.5369 0.1000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 3.0739 0.3100 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 > 2.0000 -0.3100 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 > 2.2269 0.5369 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 > 2.8469 -0.5369 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 > 1 2 1 0 0 0 0 > 1 3 1 0 0 0 0 > 1 4 1 0 0 0 0 > 1 5 1 0 0 0 0 > M END >> <MyProp> > -2.0 > > $$$$ > > MySoft > Molecule2 > 5 4 0 0 0 0 0 0 0999 V2000 > 2.5369 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > 3.0739 0.3100 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 > 2.0000 -0.3100 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 > 2.2269 0.5369 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 > 2.8469 -0.5369 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 > 1 2 1 0 0 0 0 > 1 3 1 0 0 0 0 > 1 4 1 0 0 0 0 > 1 5 1 0 0 0 0 > M END >> <MyProp> > -3.0 > > $$$$ > > When I filter it by property MyProp with a command: > obabel -isdf test.sdf -osdf --filter "MyProp<-1" > it works fine (i.e. both molecules are converted). > > However, invoking obabel with command: > obabel -isdf test.sdf -osdf --filter "(MyProp<-1)" > gives 0 molecules. > > Having investigated the source code and done some debugging stuff, I suggest > that any filter condition other than in the very end of the filter line (so > that the next symbol is EOF) leads to it's misparsing. In the last given > example, "-1" is identified as string, not float. This is caused by broken > code in OBDescriptor::ParsePredicate. As a result, any filter string other > than a single condition without any parentheses fails to work properly. > > Please try to reproduce the bug and correct me if I am wrong. > > Regards, > Oleksii Balinskyi ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ OpenBabel-Devel mailing list OpenBabel-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-devel