User e469f67125
12-01-2011 15:54:37
Dear ChemAxon,
It appears that MolSearch can be broken after atoms are removed. The attached example program is designed to remove all non-ring chain atoms. As designed, with an input molecule of all ring atoms, none are removed:
$ java test_dynosearch "N1CC1"
JChem version: 5.4.0.0
DEBUG: n_del = 0
But, when a chain atoms,
$ java test_dynosearch "OCCN1CC1"
JChem version: 5.4.0.0
DEBUG: mol: OCCN1CC1
DEBUG: matchA = 0,1
DEBUG: atom: O nbr: C
DEBUG: mol: CCN1CC1
DEBUG: matchA = 0,1
DEBUG: atom: C nbr: C
DEBUG: mol: CN1CC1
DEBUG: matchA = 0,1
DEBUG: atom: C nbr: N
DEBUG: mol: C1CN1
DEBUG: matchA = 0,1
DEBUG: atom: N nbr: C
DEBUG: mol: CC
DEBUG: matchA = 0,1
DEBUG: atom: C nbr: C
DEBUG: mol: C
DEBUG: matchA = 0,1
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
at chemaxon.struc.MoleculeGraph.getAtom(Unknown Source)
at test_dynosearch.main(test_dynosearch.java:29)
The smarts used is "[D1&!R]-*" which seems to work correctly for a molecule until atoms are removed. But above it is matching even when all are ring-atoms.
Perhaps the molecule or search needs to be "re-rationalized"? But I don't see a method for that. The example program uses findFirst() but I have tried findNext() and findAll() with the same result.
Thanks,
Jeremy