search error

User 870ab5b546

01-07-2008 21:57:06

We're using JChem 3.2.12. The code:





Code:
    public static boolean matchAtLeast_Map(Molecule respMol,


                Molecule authMol) throws VerifyException {


        try {


            MolSearch mySearch = new MolSearch();


            mySearch.setTarget(respMol);


            mySearch.setQuery(authMol);


            mySearch.setSearchType(SearchConstants.EXACT);


            mySearch.setStereoSearch(true);


            mySearch.setExactBondMatching(true);


            mySearch.setOrderSensitiveSearch(true); // want multiple results


            mySearch.setSubgraphSearch(false); // full match desired


            mySearch.setOption(SearchConstants.OPTION_STEREO_MODEL,


                    SearchConstants.STEREO_MODEL_GLOBAL); // JChem 3.2.2


            mySearch.setOption(SearchConstants.OPTION_CHARGE_MATCHING,


                    SearchConstants.CHARGE_MATCHING_EXACT);


            mySearch.setOption(SearchConstants.OPTION_ISOTOPE_MATCHING,


                    SearchConstants.ISOTOPE_MATCHING_EXACT);


            mySearch.setOption(SearchConstants.OPTION_RADICAL_MATCHING,


                    SearchConstants.RADICAL_MATCHING_EXACT);


            mySearch.setOption(SearchConstants.OPTION_VAGUE_BOND,


                    SearchConstants.VAGUE_BOND_OFF);


            debugPrint("matchAtLeast_Map: respMol:\n" + respMol.toFormat("mrv")


                    + "matchAtLeast_Map: authMol:\n" + authMol.toFormat("mrv"));


            int ct = 1;


            int[] isomorphism = mySearch.findFirst();


            boolean first = true;


            while (isomorphism != null) { // check one isomorphism


                debugPrint("matchAtLeast_Map: isomorphism " + ct


                        + " has " + isomorphism.length + " members.");


                if (goodIsomorphism(respMol,


                        authMol, isomorphism, first)) {


                    debugPrint("matchAtLeast_Map: isomorphism found ");


                    return true;


                }


                isomorphism = mySearch.findNext();


                ct++;


                first = false;


            } // check one isomorphism


            debugPrint("matchAtLeast_Map: no more isomorphisms found ");


            return false;       // not a single isomorphism worked


        } catch (Exception e1) {


            e1.printStackTrace();


            throw new VerifyException("internal error in matchAtLeast_Map");


        }


    } // matchAtLeast_Map(Molecule, Molecule)






The target:





Code:
<?xml version="1.0" ?>


<MDocument>


  <MChemicalStruct>


    <molecule molID="m1">


      <atomArray


          atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23 a24 a25 a26 a27"


          elementType="C C C C C C C C C R O O C C C C C C C C O O H R C C C"


          mrvMap="6 7 2 5 1 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"


          sgroupRef="0 0 0 0 0 0 0 0 0 sg1 0 0 0 0 0 0 0 0 0 0 0 0 0 sg2 0 0 0"


          x3="-17.801633855590822 -17.119740522257487 -15.828263321533203 -16.35403385559082 -16.223180522257486 -14.439580522257486 -14.990433855590823 -17.588401890031633 -14.859757720419317 -13.350636079230203 -13.350636079230203 -14.220433855590823 -14.73931887850592 -0.9601248056888583 0.4367751943111422 0.9327018884181975 -0.10939811158180213 -1.5062981115818026 -2.002224805688858 -1.178598224384662 0.15341185202598595 -1.8202660434440436 0.9327018884181975 2.420227660903363 -0.9146931917667391 -2.1772846808831945 1.8805251370906833"


          y3="16.875655052693684 18.10858838602702 18.852713092651367 17.604215052693686 20.47104171936035 18.080401719360353 16.912988386027017 21.284944421043384 21.187057266277982 16.99145727633307 19.169346162387637 15.579309264198981 19.94165753567865 18.211075228881835 17.955675228881837 19.322591247558595 19.165891247558594 19.421291247558592 18.054375228881838 16.74857400473652 16.789904660034182 15.581643377428836 20.412591247558595 18.92400991810071 20.264291247558592 16.892276202114317 18.051925762939455"


          z3="0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.4073 0.8864 -0.32209999999999994 -1.4073 -0.8864 0.32210000000000005 0.32210000000000005 0.8864 0.32210000000000005 -0.32209999999999994 -0.32209999999999994 1.4073 1.4073 0.8864"


          />


      <bondArray>


        <bond atomRefs2="a1 a2" order="1" />


        <bond atomRefs2="a2 a3" order="1" />


        <bond atomRefs2="a1 a4" order="1" />


        <bond atomRefs2="a4 a5" order="1" />


        <bond atomRefs2="a5 a3" order="1" />


        <bond atomRefs2="a3 a6" order="1" />


        <bond atomRefs2="a6 a7" order="1" />


        <bond atomRefs2="a7 a4" order="1" />


        <bond atomRefs2="a5 a8" order="1" />


        <bond atomRefs2="a5 a9" order="1" />


        <bond atomRefs2="a6 a11" order="1" />


        <bond atomRefs2="a7 a12" order="2" />


        <bond atomRefs2="a3 a13" order="1" />


        <bond atomRefs2="a14 a15" order="1" />


        <bond atomRefs2="a14 a19" order="1" />


        <bond atomRefs2="a15 a16" order="1" />


        <bond atomRefs2="a16 a17" order="1" />


        <bond atomRefs2="a17 a18" order="1" />


        <bond atomRefs2="a18 a19" order="1" />


        <bond atomRefs2="a19 a20" order="1" />


        <bond atomRefs2="a15 a21" order="1" />


        <bond atomRefs2="a20 a21" order="1" />


        <bond atomRefs2="a20 a22" order="2" />


        <bond atomRefs2="a16 a23" order="1" />


        <bond atomRefs2="a14 a25" order="1" />


        <bond atomRefs2="a14 a26" order="1" />


        <bond atomRefs2="a15 a27" order="1" />


        <bond atomRefs2="a16 a24" order="1" />


        <bond atomRefs2="a6 a10" order="1" />


      </bondArray>


      <molecule id="sg1" role="SuperatomSgroup" title="Ph" molID="m2">


        <atomArray


            atomID="a28 a29 a30 a31 a32 a33"


            elementType="C C C C C C"


            attachmentPoint="1 0 0 0 0 0"


            x3="-13.282499313354492 -11.948820191526455 -11.948820191526455 -13.28249931335449 -14.616178435182526 -14.616178435182526"


            y3="15.351874313354493 16.121874313354493 17.66187431335449 18.43187431335449 17.66187431335449 16.121874313354493"


            z3="0.0 0.0 0.0 0.0 0.0 0.0"


            />


        <bondArray>


          <bond atomRefs2="a28 a29" order="2" />


          <bond atomRefs2="a28 a33" order="1" />


          <bond atomRefs2="a29 a30" order="1" />


          <bond atomRefs2="a30 a31" order="2" />


          <bond atomRefs2="a31 a32" order="1" />


          <bond atomRefs2="a32 a33" order="2" />


        </bondArray>


      </molecule>


      <molecule id="sg2" role="SuperatomSgroup" title="Ph" molID="m3">


        <atomArray


            atomID="a34 a35 a36 a37 a38 a39"


            elementType="C C C C C C"


            attachmentPoint="1 0 0 0 0 0"


            x3="2.6496003453925656 3.3714904316467207 4.785624909308046 5.507238982533522 4.785624909308044 3.3714904316467207"


            y3="21.309493829307847 20.09819516551877 20.096462546104462 21.30949382930785 22.52252511251124 22.52079249309693"


            z3="-3.6316335236080717E-10 4.4656358679551396E-10 -5.259824087052672E-11 -1.3512910359108159E-10 5.476814756506433E-10 -1.462726068336113E-9"


            />


        <bondArray>


          <bond atomRefs2="a34 a35" order="2">


            <bondStereo>C</bondStereo>


          </bond>


          <bond atomRefs2="a34 a39" order="1" />


          <bond atomRefs2="a35 a36" order="1" />


          <bond atomRefs2="a36 a37" order="2">


            <bondStereo>C</bondStereo>


          </bond>


          <bond atomRefs2="a37 a38" order="1" />


          <bond atomRefs2="a38 a39" order="2">


            <bondStereo>C</bondStereo>


          </bond>


        </bondArray>


      </molecule>


    </molecule>


  </MChemicalStruct>


</MDocument>






The query:





Code:
<?xml version="1.0" ?>


<MDocument>


  <MChemicalStruct>


    <molecule molID="m1">


      <atomArray


          atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23 a24 a25 a26 a27"


          elementType="C C C C C C C C C R O O C C C C C C C C O O H R C C C"


          mrvMap="6 7 2 5 1 3 4 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0"


          sgroupRef="0 0 0 0 0 0 0 0 0 sg1 0 0 0 0 0 0 0 0 0 0 0 0 0 sg2 0 0 0"


          x3="-18.774792851747844 -18.09289951841451 -16.801422317690225 -17.327192851747842 -17.196339518414508 -15.412739518414508 -15.963592851747844 -18.561560886188655 -15.832916716576339 -14.323795075387228 -14.323795075387224 -15.193592851747844 -15.712477874662941 -1.9332838018458807 -0.5363838018458802 -0.04045710773882494 -1.0825571077388245 -2.479457107738825 -2.9753838018458802 -2.1517572205416844 -0.8197471441310364 -2.793425039601066 -0.04045710773882494 1.44706866474634 -1.8878521879237615 -3.150443677040217 0.9073661409336609"


          y3="17.232299911108697 18.465233244442032 19.20935795106638 17.9608599111087 20.827686577775363 18.437046577775366 17.26963324444203 21.641589279458397 21.543702124692995 17.34810213474808 19.52599102080265 15.935954122613994 20.298302394093664 18.56772008729685 18.31232008729685 19.679236105973608 19.522536105973607 19.777936105973605 18.41102008729685 17.10521886315153 17.146549518449195 15.93828823584385 20.769236105973608 19.280654776515725 20.620936105973605 17.24892106052933 18.408570621354468"


          z3="0.08944694691560619 0.08944694691560619 0.08944694691560619 0.08944694691560619 0.08944694691560619 0.08944694691560619 0.08944694691560619 0.08944694691560619 0.08944694691560619 0.08944694691560619 0.08944694691560619 0.08944694691560619 0.08944694691560619 1.4967469469156063 0.9758469469156061 -0.23265305308439377 -1.3178530530843937 -0.7969530530843938 0.4115469469156062 0.4115469469156062 0.9758469469156061 0.4115469469156062 -0.23265305308439377 -0.23265305308439377 1.4967469469156063 1.4967469469156063 0.9758469469156061"


          />


      <bondArray>


        <bond atomRefs2="a1 a2" order="1" />


        <bond atomRefs2="a2 a3" order="1" />


        <bond atomRefs2="a1 a4" order="1" />


        <bond atomRefs2="a4 a5" order="1" />


        <bond atomRefs2="a5 a3" order="1" />


        <bond atomRefs2="a3 a6" order="1" />


        <bond atomRefs2="a6 a7" order="1" />


        <bond atomRefs2="a7 a4" order="1" />


        <bond atomRefs2="a5 a8" order="1" />


        <bond atomRefs2="a5 a9" order="1" />


        <bond atomRefs2="a6 a11" order="1" />


        <bond atomRefs2="a7 a12" order="2" />


        <bond atomRefs2="a3 a13" order="1" />


        <bond atomRefs2="a14 a15" order="1" />


        <bond atomRefs2="a14 a19" order="1" />


        <bond atomRefs2="a15 a16" order="1" />


        <bond atomRefs2="a16 a17" order="1" />


        <bond atomRefs2="a17 a18" order="1" />


        <bond atomRefs2="a18 a19" order="1" />


        <bond atomRefs2="a19 a20" order="1" />


        <bond atomRefs2="a15 a21" order="1" />


        <bond atomRefs2="a20 a21" order="1" />


        <bond atomRefs2="a20 a22" order="2" />


        <bond atomRefs2="a16 a23" order="1" />


        <bond atomRefs2="a14 a25" order="1" />


        <bond atomRefs2="a14 a26" order="1" />


        <bond atomRefs2="a15 a27" order="1" />


        <bond atomRefs2="a16 a24" order="1" />


        <bond atomRefs2="a6 a10" order="1" />


      </bondArray>


      <molecule id="sg1" role="SuperatomSgroup" title="Ph" molID="m2">


        <atomArray


            atomID="a28 a29 a30 a31 a32 a33"


            elementType="C C C C C C"


            attachmentPoint="1 0 0 0 0 0"


            x3="-14.386513006190915 -13.664622919936761 -12.250488442275435 -11.528874369049959 -12.250488442275437 -13.664622919936761"


            y3="19.58817653804808 18.376877874259005 18.375145254844696 19.588176538048085 20.801207821251474 20.799475201837165"


            z3="-3.631633523608078E-10 4.4656358679551396E-10 -5.25982408705269E-11 -1.351291035910818E-10 5.476814756506428E-10 -1.4627260683361136E-9"


            />


        <bondArray>


          <bond atomRefs2="a28 a29" order="2" />


          <bond atomRefs2="a28 a33" order="1" />


          <bond atomRefs2="a29 a30" order="1" />


          <bond atomRefs2="a30 a31" order="2" />


          <bond atomRefs2="a31 a32" order="1" />


          <bond atomRefs2="a32 a33" order="2" />


        </bondArray>


      </molecule>


      <molecule id="sg2" role="SuperatomSgroup" title="Ph" molID="m3">


        <atomArray


            atomID="a34 a35 a36 a37 a38 a39"


            elementType="C C C C C C"


            attachmentPoint="1 0 0 0 0 0"


            x3="1.4466124658778714 2.1685025521320265 3.582637029793352 4.304251103018828 3.58263702979335 2.1685025521320265"


            y3="21.753801156578355 20.54250249278928 20.54076987337497 21.75380115657836 22.966832439781747 22.96509982036744"


            z3="-3.631633523608078E-10 4.4656358679551396E-10 -5.25982408705269E-11 -1.351291035910818E-10 5.476814756506428E-10 -1.4627260683361136E-9"


            />


        <bondArray>


          <bond atomRefs2="a34 a35" order="2" />


          <bond atomRefs2="a34 a39" order="1" />


          <bond atomRefs2="a35 a36" order="1" />


          <bond atomRefs2="a36 a37" order="2" />


          <bond atomRefs2="a37 a38" order="1" />


          <bond atomRefs2="a38 a39" order="2" />


        </bondArray>


      </molecule>


    </molecule>


  </MChemicalStruct>


</MDocument>






The error:





Code:
matchAtLeast_Map: isomorphism 1 has 37 members.


java.lang.ArrayIndexOutOfBoundsException: 5776


        at chemaxon.sss.search.StructureSearch.getMap(StructureSearch.java:4585)


        at chemaxon.sss.search.StructureSearch.clearRowColumn(StructureSearch.java:3050)


        at chemaxon.sss.search.StructureSearch.switchToExhaustiveMode(StructureSearch.java:5571)


        at chemaxon.sss.search.StructureSearch.findNext0(StructureSearch.java:5355)


        at chemaxon.sss.search.StructureSearch.findNext(StructureSearch.java:5318)


        at chemaxon.sss.search.MolSearch.findNextEnumerated(MolSearch.java:1117)


        at chemaxon.sss.search.MolSearch.findNextFiltered(MolSearch.java:1004)


        at chemaxon.sss.search.MolSearch.findNext(MolSearch.java:928)


        at com.prenhall.epoch.evals.impl.MapProperty.matchAtLeast_Map(MapProperty.java:332)






Note that the error occurs in the MolSearch.findNext() command. It's already gone through the findFirst() command without any problem.





However, if we ungroup the Ph groups in the query, no error is thrown, and we get four isomorphisms, as we ought.





Can you reproduce this error? Does it occur in more recent versions of JChem? Is there a workaround available in JChem 3.2.12?

User 870ab5b546

01-07-2008 22:15:25

After further investigation, I find that the error appears to go away if I comment out the command,





Code:
 mySearch.setSearchType(SearchConstants.EXACT);






Any ideas why?





This is the default value, anyway, isn't it, so do I even need to state it?

User 870ab5b546

01-07-2008 22:27:04

And two more bits of information. Firs, this code, with a PERFECT search, elicits the error, too:





Code:
    public static boolean matchAtLeast_Map(Molecule respMol,


                Molecule authMol) throws VerifyException {


        try {


            MolSearch mySearch = new MolSearch();


            mySearch.setTarget(respMol);


            mySearch.setQuery(authMol);


            mySearch.setSearchType(SearchConstants.PERFECT);


            mySearch.setOrderSensitiveSearch(true); // want multiple results


            debugPrint("matchAtLeast_Map: respMol:\n" + respMol.toFormat("mrv")


                    + "matchAtLeast_Map: authMol:\n" + authMol.toFormat("mrv"));


            int ct = 1;


            int[] isomorphism = mySearch.findFirst();


            boolean first = true;


            while (isomorphism != null) { // check one isomorphism


                debugPrint("matchAtLeast_Map: isomorphism " + ct


                        + " has " + isomorphism.length + " members.");


                if (goodIsomorphism(respMol,


                        authMol, isomorphism, first)) {


                    debugPrint("matchAtLeast_Map: isomorphism found.");


                    return true;


                }   


                isomorphism = mySearch.findNext();


                ct++;   


                first = false;


            } // check one isomorphism


            debugPrint("matchAtLeast_Map: no more isomorphisms found ");


            return false;       // not a single isomorphism worked


        } catch (Exception e1) {


            e1.printStackTrace();


            throw new VerifyException("internal error in matchAtLeast_Map");


        }           


    } // matchAtLeast_Map(Molecule, Molecule)






Second, replace the Ph shortcut group with an Et shortcut group, and the error is NOT elicited.

ChemAxon 42004978e8

02-07-2008 12:25:38

Hi Bob,





The search doesn't work with the current version either. With the modifications you've done, it works.


We are investigating the problem.


Thanks for your patience,





Robert

ChemAxon a9ded07333

03-07-2008 15:28:23

Hi Bob,





Congratulations, you made a great work as a tester! There are more roots of this problem that interefere in this example. Without going into details, the main problem is that





- there are explicit hydrogens in query and target


AND


- the molecules contain a highly symmetric group (Ph)


AND


- it is an exact search (by the way, default is substructure search)





The search initializes all hydrogens, implicits as well, and in case of these molecules it leads to a kind of overflow in search.





As a workaround you may remove explicit hydrogens from molecules (3.2.12), or from 5.0 you could use the
Code:
SearchOptions.setImplicitHMatching(IMPLICIT_H_MATCHING_DISABLED);





option that prevents initializing implicit hydrogens.





Regards,





Tamás

User 870ab5b546

03-07-2008 15:44:00

Your username is "Cheese"? Wouldn't that be more appropriate for Csizi?





Anyway, you can't blame this find on me ;-) . Some ACE users at University of Illinois found it.





So from what you say, it's an algorithmic inefficiency, not a bug per se?





Regarding workarounds, unfortunately, I can't remove explicit H atoms. However, I've written some code that converts shortcut groups into pseudoatoms before doing the search.





Code:
    // converts shortcut groups in a Molecule to pseudoatoms; needed to avoid a


    // bug in JChem when doing searches and query has a shortcut group


    public static void sGroupsToPseudoatoms(Molecule mol) {


        Sgroup[] sgroups = mol.getSgroupArray();


        int numSgroups = sgroups.length;


        for (int grpNum = 0; grpNum < numSgroups; grpNum++) {


            SuperatomSgroup sgroup = (SuperatomSgroup) sgroups[grpNum];


            SgroupAtom superatom = sgroup.getSuperAtom();


            String symb = superatom.getSymbol();


            MolAtom attachPt = sgroup.findAttachAtom();


            for (int grpAtNum = sgroup.getAtomCount() - 1; grpAtNum >= 0; grpAtNum--) {


                MolAtom grpAtom = sgroup.getAtom(grpAtNum);


                if (grpAtom != attachPt) {


                    mol.removeNode(grpAtom);


                }


            }


            mol.ungroupSgroup(sgroup);


            attachPt.setAtno(MolAtom.PSEUDO);


            attachPt.setAliasstr(symb);


        }


    } // sGroupsToPseudoatoms(Molecule)






Do you think this workaround will solve the problem? Your characterization of the problem did not mention shortcut groups, but I found that ungrouping the Ph group solved the problem, which is why I thought converting it to a pseudoatom would help, too.





Will you be able to fix this inefficiency in future versions of JChem?

ChemAxon a9ded07333

08-07-2008 09:26:37

Hi Bob,
Quote:
Will you be able to fix this inefficiency in future versions of JChem?
We think we can solve the optimization of search in 5.1.1 (from 5.0 I offer - as a workaround - the implicitHMatching option)
Quote:
Do you think this workaround will solve the problem? Your characterization of the problem did not mention shortcut groups, but I found that ungrouping the Ph group solved the problem, which is why I thought converting it to a pseudoatom would help, too.
Using your code I haven't found isomorphisms (I havent' investigated it much but it may have changed stereo?). However, changing the code in the body of sGroupsToPseudoatoms() simply to


Code:
mol.ungroupSgroups();
works fine.
Quote:
Your username is "Cheese"? Wouldn't that be more appropriate for Csizi?
Indeed, choosing username was a problem when I started to work here.


1) Our names differ in only one character: Csizmadia / Csizmazia


2) Our nickname was the same (Csizi) + I am the younger ...


--> my username could not be 'Csizi'


At least I wanted to preserve something from my personality :)





All the best,





Tamás

User 870ab5b546

10-07-2008 14:23:51

Oh, you're not Tamas Vertse. Got it.





I can't use mol.ungroupSgroups(). We may have mapped some of the shortcut groups, and the map number will go away if we ungroup the groups.





Though I guess, instead of replacing the shortcut group with a pseudoatom, I could ungroup the group and then map the former attachment point. That might be a less radical way of handling the problem. I'll look into it.

ChemAxon 42004978e8

11-07-2008 17:16:55

We made a more efficient implementation of the search for all isomers in case of explicit query side hydrogens. This modification will appear in version 5.1.1. scheduled around mid-august.


We will notify you when the improvement appears.





Thanks for your patience.


Robert

User 870ab5b546

20-07-2008 20:33:10

bobgr wrote:
Though I guess, instead of replacing the shortcut group with a pseudoatom, I could ungroup the group and then map the former attachment point. That might be a less radical way of handling the problem. I'll look into it.
That idea doesn't work as well; the bug is still tickled. The most efficient thing to do is to remove all atoms from contracted shortcut groups except the attachment points, change the attachment points to pseudoatoms with the name of the shortcut group, transfer the map numbers to the pseudoatoms, and ungroup the shortcut groups. This procedure gives the search algorithm fewer atoms to sort through, but the shortcut groups will still have to match with one another. The incorrect geometry changes I mentioned here don't occur when all the shortcut groups are ungrouped at once.





Code:
    public static void sGroupsToPseudoatoms(Molecule mol) {


        Sgroup[] sgroups = mol.getSgroupArray();


        int numSgroups = sgroups.length;


        for (int grpNum = 0; grpNum < numSgroups; grpNum++) {


            SuperatomSgroup sgroup = (SuperatomSgroup) sgroups[grpNum];


            SgroupAtom superatom = sgroup.getSuperAtom();


            String symb = superatom.getSymbol();


            int mapNum = superatom.getAtomMap();


            MolAtom attachPt = sgroup.findAttachAtom();


            MolAtom[] sgAtoms = sgroup.getAtomArray();


            int numSgAtoms = sgAtoms.length;


            for (int sgAtomNum = numSgAtoms - 1; sgAtomNum >= 0; sgAtomNum--) {


                MolAtom sgAtom = sgAtoms[sgAtomNum];


                if (sgAtom != attachPt) {


                    mol.removeNode(sgAtom);


                } else {


                    sgAtom.setAtno(MolAtom.PSEUDO);


                    sgAtom.setAliasstr(symb);


                    if (mapNum > 0) {


                        sgAtom.setAtomMap(mapNum);


                    }


                } // if sgroup atom is attachment point


            } // for each atom in sgroup


        } // for each shortcut group


        mol.ungroupSgroups();


    } // sGroupsToPseudoatoms(Molecule)

ChemAxon 42004978e8

22-07-2008 15:39:18

The work-around with pseudo atoms is a good solution if you are interested in hits where the contracted group matches only the same contracted group. However if you run exact search with all hits and with explicit hydrogens in the query you can still run in to low performance problems.


Is an upgrade to a newer version a suitable solution for you? The improved algorithm will appear in version 5.1. or 5.1.1, We will notify you when it's released.

User 870ab5b546

22-07-2008 16:09:13

We will eventually upgrade to a newer version of JChem, but we were looking for an interim solution. It may be another year before we can move to JChem 5 in production, though we will soon move to JChem 5 in our development environment.

ChemAxon 42004978e8

12-08-2008 10:25:39

Hi Bob,





Jchem 5.1 has been released including the speed-up of the search. (expl. Hs, allhits....)


Robert

User 3898c01b63

11-09-2008 14:58:01

Dear All,





I upgraded JChem 5.1.01 for development (OS: XP; Server: Tomcat 5.5.9). The code can do 'EXACT' search, but not for 'SIMILARITY' or 'SUBSTRUCTURE' search.





--Partial Codes BEGIN--


ConnectionHandler conHandler = new ConnectionHandler();


conHandler.setUrl(URL);


conHandler.setDriver(driver);


conHandler.setLoginName(dbLogin);


conHandler.setPassword(dbPassword);


conHandler.connect();


JChemSearch searcher = new JChemSearch();// Create searcher object





searcher.setQueryStructure(smilesStr);


searcher.setConnectionHandler(conHandler);


if (str_array.length == 2) {


searcher.setFilterQuery(str_array[ 1 ]);


}


searcher.setStructureTable("BIND_2000_05.MONOMER_STRUCT");





JChemSearchOptions searchOptions = new JChemSearchOptions();





switch (option) {


case 2:


searchOptions.setSearchType( chemaxon.sss.SearchConstants.SUBSTRUCTURE );


break;


case 3:


searchOptions.setSearchType( chemaxon.sss.SearchConstants.SIMILARITY );


searchOptions.setDissimilarityThreshold(ft_Similarity);


break;


case 4:


searchOptions.setSearchType(chemaxon.sss.SearchConstants.EXACT);


default:


searchOptions.setSearchType(JChemSearch.PERFECT);


break;


}





searcher.setSearchOptions(searchOptions);


searcher.setRunMode(JChemSearch.RUN_MODE_SYNCH_COMPLETE);





int count=0;





try {


searcher.run();


count=searcher.getResultCount();


} catch (chemaxon.formats.MolFormatException mfe) {


mfe.printStackTrace();


int imfe = 1;


} catch (chemaxon.jchem.db.DatabaseSearchException dse) {


dse.printStackTrace();


} catch (IOException ioe) {


ioe.printStackTrace();


} catch (chemaxon.jchem.db.PropertyNotSetException pnse) {


pnse.printStackTrace();


} catch (Exception e) {


e.printStackTrace();


}





--Partial Codes END--


--Partial Exception BEGIN--


java.sql.SQLException: ORA-00942: table or view does not exist





at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)


at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)


--Partial Exception END--





It is an oracle problem. The table is verified in DB. But why does it work for 'EXACT' search?





Your instruction is highly appreciated.





Tiqing Liu from www.bindingdb.org

ChemAxon 9c0afc9aaf

11-09-2008 15:33:48

Hi,





Please


- start a new topic in the future for a new problem


- provide the full stack trace if possible, the few lines provided are not very informative





Let's clarify what is your problem


- is it a problem the search does not work for the mentioned modes


or


- is it a problem that it works for EXACT search while it should not due to database restrictions ?





Please note that fingerprints and structural information are stored in the structure cache. This cache is common for the JVM (not dependent on the JDBC connection). Depending on certain circumstances the search process may or may not have to access some tables in the database.





Best regards,





Szilard

User 3898c01b63

11-09-2008 15:50:52

Hi,





Next time I will start a new topic.





---Stack trace begin---


java.sql.SQLException: ORA-00942: table or view does not exist





at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)


at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)


at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)


at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)


at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:830)


at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2391)


at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2672)


at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:572)


at chemaxon.jchem.db.StructureCache.getCurrentUpdateCounter(StructureCache.java:1339)


at chemaxon.jchem.db.StructureCache.load(StructureCache.java:223)


at chemaxon.jchem.db.StructureCache.loadIfNeeded(StructureCache.java:847)


at chemaxon.jchem.db.JChemSearch.loadCacheIfNeeded(JChemSearch.java:2755)


at chemaxon.jchem.db.JChemSearch.search1(JChemSearch.java:2494)


at chemaxon.jchem.db.JChemSearch.search(JChemSearch.java:2336)


at chemaxon.jchem.db.JChemSearch.setRunning(JChemSearch.java:2172)


at chemaxon.jchem.db.JChemSearch.run(JChemSearch.java:2199)


at bind.BDB_functions.ChemSearchSmiles(BDB_functions.java:394)


at org.apache.jsp.bind.chemsearch.marvin.SearchCategory_jsp._jspService(org.apache.jsp.bind.chemsearch.marvin.SearchCategory_jsp:498)


at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)


at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)


at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)


at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)


at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)


at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)


at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)


at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)


at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)


at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)


at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:526)


at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)


at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)


at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)


at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)


at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)


at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)


at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)


at java.lang.Thread.run(Unknown Source)


---Stack trace end---





Let's clarify what is your problem


- is it a problem the search does not work for the mentioned modes


or


- is it a problem that it works for EXACT search while it should not due to database restrictions ?






It works for EXACT mode, so I don't think that the non-functioning for "SIMILARITY" or "SUBSTRUCTURE" is caused by database restriction. But I am not sure.





Please note that fingerprints and structural information are stored in the structure cache. This cache is common for the JVM (not dependent on the JDBC connection). Depending on certain circumstances the search process may or may not have to access some tables in the database.





Is there anything I can do to avoid such pitfalls?





Best regards,





Tiqing

ChemAxon 9c0afc9aaf

11-09-2008 16:21:57

Hi,





Thank you for the full stack trace.


Now it's clear, that JChem tries to access the update log table ("<table_name>_UL"), but cannot find it.





This table is automatically created when you create a JChem table via our API, maybe you have deleted it, or migrated the database and forgot about these tables.





In any case it's fairly easy to re-create them if they are missing. Start JChemManager and connect to this database. It will detect the absence of these tables and create them again.





(Alternatively these tables may exist but just might not have the access rights)





The explanation why EXACT worked:





A break is missing from your code after the line :





Code:
searchOptions.setSearchType(chemaxon.sss.SearchConstants.EXACT);






So instead of EXACT you have run PERFECT search.





PERFECT search does not use the cache, so it does not have to access the _UL table.





Best regards,





Szilard

User 3898c01b63

11-09-2008 16:39:13

Hi,





Thank you for the instructions.





Table MONOMERTSTRUCT was made with JChem 5.1 API, populated, and renamed to MONOMER_STRUCT. However, that the hidden Table MONOMERTSTRUCT_UL was not renamed to MONOMER_STRUCT_UL at the same time caused "java.sql.SQLException: ORA-00942: table or view does not exist".





Best regards,





Tiqing