severe JChem 3.2.1 matching bug

User 870ab5b546

01-12-2006 21:46:50

This 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"


          elementType="C C C C C C H H H H H C H H H C H H C C C H"


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


          x3="-1.5061099342936641 -0.46451036317815986 6.342874706506407E-4 -1.1590710641271649 -2.2006706352426693 -2.6658152858914796 -1.9140646108003474 -1.0222066517098714 0.40324335860945704 -0.9616968758311837 0.45567721294367924 0.8333627061071911 -0.7510719755782808 -1.6429299346687576 -1.7033956949498938 -3.4266125608256384 -3.1207697837247568 -3.255199613342566 0.3417055219983318 -4.043381810220351 -4.024973820317489 -4.109168297315815"


          y3="1.6017090815376878 0.624055293999942 -0.30794174065387536 -1.013207677353891 -0.035553889816144824 0.8964431448376723 2.0897509117876423 2.195487827930713 1.219910192050322 -0.001081421724779541 0.32241778414513844 -1.4044866345234617 -1.5013103272262027 -1.6070472433692733 0.5895519838154818 -0.877378562875833 0.26605277794556353 1.6725704200113745 -1.9206523607844206 -0.18154725685171025 -2.2677461906494063 -0.8411671352425891"


          z3="-0.5356898884610615 -0.03853902085132299 -1.1353615048337171 -1.803096329450538 -2.3002471970602762 -1.2034247130778821 0.3495142991943134 -1.31109726747971 0.24450540815783706 0.7031408685139242 -1.8993523853238716 -0.4456031438668886 -2.688180815209337 -1.0275692485353134 -3.0418920247966197 -2.7000142478859948 -0.4393987709588234 -1.6915579195763604 0.9081974198601568 -3.924705125845761 -2.429067735122608 -1.8509521776619606"


          />


      <bondArray>


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


      </bondArray>


    </molecule>


  </MChemicalStruct>


</MDocument>






matches to this query:





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


<MDocument>


  <MChemicalStruct>


    <molecule molID="m1">


      <atomArray>


        <atom id="a1" elementType="C"


              x2="-0.38490666666666673" y2="0.19245333333333337" />


        <atom id="a2" elementType="C"


              x2="-1.7186400000000002" y2="-0.5775466666666668" />


        <atom id="a3" elementType="C"


              x2="-1.7186400000000002" y2="-2.117546666666667" />


        <atom id="a4" elementType="C"


              x2="-0.38490666666666673" y2="-2.887546666666667" />


        <atom id="a5" elementType="C"


              x2="0.9486400000000001" y2="-2.117546666666667" />


        <atom id="a6" elementType="C"


              x2="0.9486400000000001" y2="-0.5775466666666668" />


        <atom id="a7" elementType="C"


              x2="2.2823733333333336" y2="0.19245333333333337" />


        <atom id="a8" elementType="C"


              x2="-3.0523733333333336" y2="0.19245333333333337" />


        <atom id="a9" elementType="C"


              x2="-4.3861066666666675" y2="-0.5775466666666668" />


        <atom id="a10" elementType="C"


              x2="2.2823733333333336" y2="1.7324533333333336" />


        <atom id="a11" elementType="C"


              x2="3.616106666666667" y2="-0.5775466666666668" />


      </atomArray>


      <bondArray>


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


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


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


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


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


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


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


          <bondStereo>W</bondStereo>


        </bond>


        <bond atomRefs2="a2 a8" order="1">


          <bondStereo>W</bondStereo>


        </bond>


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


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


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


      </bondArray>


    </molecule>


  </MChemicalStruct>


</MDocument>






However, if I remove just the H atom of the methine of the isopropyl group of the target, it inexplicably fails to match 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"


          elementType="C C C C C C H H H H H C H H H C H H C C C"


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


          x3="-1.5061099342936641 -0.46451036317815986 6.342874706506407E-4 -1.1590710641271649 -2.2006706352426693 -2.6658152858914796 -1.9140646108003474 -1.0222066517098714 0.40324335860945704 -0.9616968758311837 0.45567721294367924 0.8333627061071911 -0.7510719755782808 -1.6429299346687576 -1.7033956949498938 -3.4266125608256384 -3.1207697837247568 -3.255199613342566 0.3417055219983318 -4.043381810220351 -4.024973820317489"


          y3="1.6017090815376878 0.624055293999942 -0.30794174065387536 -1.013207677353891 -0.035553889816144824 0.8964431448376723 2.0897509117876423 2.195487827930713 1.219910192050322 -0.001081421724779541 0.32241778414513844 -1.4044866345234617 -1.5013103272262027 -1.6070472433692733 0.5895519838154818 -0.877378562875833 0.26605277794556353 1.6725704200113745 -1.9206523607844206 -0.18154725685171025 -2.2677461906494063"


          z3="-0.5356898884610615 -0.03853902085132299 -1.1353615048337171 -1.803096329450538 -2.3002471970602762 -1.2034247130778821 0.3495142991943134 -1.31109726747971 0.24450540815783706 0.7031408685139242 -1.8993523853238716 -0.4456031438668886 -2.688180815209337 -1.0275692485353134 -3.0418920247966197 -2.7000142478859948 -0.4393987709588234 -1.6915579195763604 0.9081974198601568 -3.924705125845761 -2.429067735122608"


          />


      <bondArray>


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


      </bondArray>


    </molecule>


  </MChemicalStruct>


</MDocument>






This appears to be a new bug in JChem 3.2.1, to which we just upgraded. I hadn't noticed such problems previously with JChem 3.2 alpha.





I tried to use your Substructure Search Demo page to confirm the behavior, but either the applets won't load completely, or the Search button doesn't work. In any case, there is no set of parameters that could legitimately produce the effect I describe.





Here is our code:





Code:
            MolSearch s1 = new MolSearch();


            s1.setSearchType(SearchConstants.EXACT);


            if (ignoreStereo) {


                s1.setStereoSearch(false);


            } else {


                s1.setStereoSearch(true);


                s1.setDoubleBondStereoMatchingMode(StereoConstants.DBS_ALL);


                /* the following is deprecated in JChem 2.2 */


                // s1.setStereoCareChecking(false);


            }


            // required for comparing nonaromatized aromatic rings


            s1.setOption(SearchConstants.OPTION_VAGUE_BOND,


                    SearchConstants.VAGUE_BOND_OFF);


            s1.setTarget(respMol);


            s1.setQuery(authMol);


            println("matchExact_JChem: Match exact resp "


                    + respMol.toFormat("mrv"));


            println("matchExact_JChem: Match exact struct "


                    + authMol.toFormat("mrv"));


            boolean res1 = s1.isMatching();


            println("matchExact_JChem: JChem search result is " + res1);


            return res1;








When the compound missing the methine H is submitted, the log returns,





Code:
matchExact_JChem: Match exact resp <?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"


          elementType="C C C C C C H H H H H C H H H C H H C C C"


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


          x3="-1.3933 0.0036 0.3178 -0.7243 -2.1212 -2.4354 -1.5942 -1.4204 0.6864 0.0168 0.2579 1.6342 -0.5233 -0.6971 -2.1343 -3.0858 -2.3754 -3.3671 1.8333 -4.2752 -3.0911"


          y3="0.1161 -0.1393 0.7144 0.5577 0.8131 -0.0406 -0.6664 1.1634 0.1817 -1.1733 1.7503 0.1684 1.3401 -0.4897 1.8471 0.3595 -1.0765 0.3458 -1.3486 1.3332 -0.55"


          z3="1.4073 0.8864 -0.3221 -1.4073 -0.8864 0.3221 2.1391 1.708 1.6731 0.5418 0.0117 -0.9057 -2.1391 -1.708 -0.5418 -1.9978 -0.0117 0.7352 -0.9057 -1.9567 -3.2377"


          />


      <bondArray>


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


      </bondArray>


    </molecule>


  </MChemicalStruct>


</MDocument>





matchExact_JChem: Match exact struct <?xml version="1.0" ?>


<MDocument>


  <MChemicalStruct>


    <molecule molID="m1">


      <atomArray>


        <atom id="a1" elementType="C"


              x2="-0.38490666666666673" y2="0.19245333333333337" />


        <atom id="a2" elementType="C"


              x2="-1.7186400000000002" y2="-0.5775466666666668" />


        <atom id="a3" elementType="C"


              x2="-1.7186400000000002" y2="-2.117546666666667" />


        <atom id="a4" elementType="C"


              x2="-0.38490666666666673" y2="-2.887546666666667" />


        <atom id="a5" elementType="C"


              x2="0.9486400000000001" y2="-2.117546666666667" />


        <atom id="a6" elementType="C"


              x2="0.9486400000000001" y2="-0.5775466666666668" />


        <atom id="a7" elementType="C"


              x2="2.2823733333333336" y2="0.19245333333333337" />


        <atom id="a8" elementType="C"


              x2="-3.0523733333333336" y2="0.19245333333333337" />


        <atom id="a9" elementType="C"


              x2="-4.3861066666666675" y2="-0.5775466666666668" />


        <atom id="a10" elementType="C"


              x2="2.2823733333333336" y2="1.7324533333333336" />


        <atom id="a11" elementType="C"


              x2="3.616106666666667" y2="-0.5775466666666668" />


      </atomArray>


      <bondArray>


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


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


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


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


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


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


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


          <bondStereo>W</bondStereo>


        </bond>


        <bond atomRefs2="a2 a8" order="1">


          <bondStereo>W</bondStereo>


        </bond>


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


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


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


      </bondArray>


    </molecule>


  </MChemicalStruct>


</MDocument>





matchExact_JChem: JChem search result is false


ChemAxon a3d59b832c

04-12-2006 09:16:18

Hi Bob,





I am examining the problem now, I could reproduce it here.





Thank you for the report about the SSS jsp page, it seems that there is a mayscript problem (javascript-java communication) on some client machines.


(We could reproduce it on one pc.)





Szabolcs

User 870ab5b546

04-12-2006 15:05:47

Szabolcs wrote:
Hi Bob,





I am examining the problem now, I could reproduce it here.


Thank goodness.





I found an ACE installation that is still using JChem 3.2 alpha (I think the 8-25 prerelease), and I can confirm that the problem does not exist there. It appears to be new to 3.2.1.
Quote:
Thank you for the report about the SSS jsp page, it seems that there is a mayscript problem (javascript-java communication) on some client machines.


(We could reproduce it on one pc.)
Of course, I am using a Mac, OS 10.3 or 10.4, and Safari.





The SSS jsp page would be another good place to use AJAX technology. See this post.

ChemAxon a3d59b832c

04-12-2006 15:17:23

This issue is related to the problems of symmetrical atoms vs local/global parity we discussed before. Furthermore, it seems that a recently fixed previous bug in 3D stereo perception hid this problem in previous versions.





I am now working on a general solution of all these symmetry issues.

User 870ab5b546

05-12-2006 16:30:52

How long do you think this effort will take?





Now that we have updated our tables to JChem 3.2.1 standards, can we back down to JChem 3.2?





How widespread will this bug manifest? Will it only occur when we have 3D structures, or may it occur in other places, too?

ChemAxon a3d59b832c

06-12-2006 09:00:50

bobgr wrote:
How long do you think this effort will take?
I try to deliver a solution for you this week. There will be a new option which allows you to use the "global" stereo model instead of the current "local" one. This model will use the global environment of atoms/bonds during stereo perception. As you always do exact searches and not substructure searches and there is often "superfluous" notation of stereo information, this approach would better suit you. This will solve several related problems we discussed recently, including these:





http://www.chemaxon.com/forum/ftopic1195.html


http://www.chemaxon.com/forum/viewtopic.php?p=8809#8809
width="90%" cellspacing="0" cellpadding="3" border="0" align="center"> bobgr wrote: Now that we have updated our tables to JChem 3.2.1 standards, can we back down to JChem 3.2? We generally do not support downgrade, but see this forum topic for more information:





http://www.chemaxon.com/forum/ftopic2278.html





(As far as I know, you don't use the JChem tables for searching, only for the storage of structures. In this case, you do not need to regenerate the tables, etc, just simply read the cd_structure column through jdbc.)
bobgr wrote:
How widespread will this bug manifest? Will it only occur when we have 3D structures, or may it occur in other places, too?
It is related to symmetrical structures, so it is independent of 3D structures. (See related problems above.)


The 3D connection is that until now, planar and nearly-planar atoms could have parity which allowed a match.

User 870ab5b546

06-12-2006 13:52:32

Szabolcs wrote:
There will be a new option which allows you to use the "global" stereo model instead of the current "local" one. This model will use the global environment of atoms/bonds during stereo perception. As you always do exact searches and not substructure searches and there is often "superfluous" notation of stereo information, this approach would better suit you.
We often do substructure searches, too, but I think we can set the option to global or local, depending on what kind of search we are doing. Besides, our substructure queries often do not include stereochemical information, so the bug would never arise.

ChemAxon a3d59b832c

06-12-2006 15:39:29

I see. Thank you for the information.





In the meantime, the guys here modified our SSS page. Now it should work for you as well.

User 870ab5b546

08-12-2006 14:54:36

Szabolcs wrote:
In the meantime, the guys here modified our SSS page. Now it should work for you as well.
It now works in Netscape, but still not in Safari. (In Safari, pressing the Search button has no effect.)





More bizarre behavior: When I paste my misbehaving target and query into your SSS page, I get no hits, but if I redraw the target, I do get a hit. Here's the redrawn structure:





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"


          elementType="C C C C C C H H C H H H H C H H H H C C C"


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


          x3="2.1747068922793384 1.837828450488859 0.386621585774118 -0.638426066753665 -0.30154764742851925 1.1496592345965566 3.1791872975114903 2.165227368782707 2.8276425726665124 1.9509371592209745 0.15874037823837606 0.3022997555322522 -0.6289018871609582 -2.054387761044115 -0.41412584600352464 -1.0037201519322483 1.2339810520110692 1.3775404367289978 -3.38806688287215 -3.38806688287215 3.226223902124394"


          y3="1.3544284366126347 0.5175411108528541 0.7866284652163442 0.5253032080318892 1.362190572863522 1.0931031635192365 1.103152813379392 2.4136963660286277 0.8642093362179245 -0.5470428585163074 0.1440209515690659 1.8271360372569951 -0.5389559645955879 0.879512870734275 2.4217816372110095 1.1162646889953052 0.05259561004533886 1.735710675758066 1.6495128707342754 0.10951287073427474 -0.623316436267241"


          z3="0.006876550566821349 1.2700912963025768 1.750889304951 0.6148587619205479 -0.6483560229849552 -1.1291540497586423 -0.3415151943825634 0.26370644046484926 2.397783251164332 1.0394602693671469 2.604484092204369 2.081883413435837 0.3568186546446275 1.1059677061991031 -0.4188066262082124 -1.4483388367587837 -1.4601481087953747 -1.9827488082029978 1.1059677061991025 1.1059677061991027 2.397783251164332"


          />


      <bondArray>


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


      </bondArray>


    </molecule>


  </MChemicalStruct>


</MDocument>






?!?





Your SSS page gave memory errors after repeated use. I converted my own SSS page over to AJAX. I suggest you do the same. I'm attaching a copy of my page.

User 870ab5b546

09-12-2006 15:17:18

Szabolcs wrote:



I try to deliver a solution for you this week.
Hi Szabolcs,





I see JChem 3.2.2 has just been released. I don't suppose, by any chance, that the fix to the matching bug is in this release?





-- Bob

ChemAxon a3d59b832c

09-12-2006 15:49:22

bobgr wrote:
I see JChem 3.2.2 has just been released. I don't suppose, by any chance, that the fix to the matching bug is in this release?
Yes, it is. Please use this option before calling isMatching():





Code:
    searcher.setOption( OPTION_STEREO_MODEL, STEREO_MODEL_GLOBAL);








Best regards,





Szabolcs

User 870ab5b546

09-12-2006 18:37:21

And this option applies also to IsMatchCountInRelation(), right?

ChemAxon a3d59b832c

09-12-2006 21:32:45

bobgr wrote:
And this option applies also to IsMatchCountInRelation(), right?
Definitely. And I should have said: the constants are defined in chemaxon.sss.SearchConstants

ChemAxon a3d59b832c

09-12-2006 21:50:01

bobgr wrote:
More bizarre behavior: When I paste my misbehaving target and query into your SSS page, I get no hits, but if I redraw the target, I do get a hit. Here's the redrawn structure:





?!?
There is a slight difference between the coordinates of the original and the redrawn structure. The important difference is that in the redrawn molecule atom 14 is "less planar" than in the original. (It is slightly further from the plane of its neighbours. Just enough to be on the other side of the threshold for the planarity criterion.) As now this atom has associated stereo info, the query will match even using JChem 3.2.1.

User 870ab5b546

09-12-2006 22:25:26

Well, butter my butt and call me a biscuit.