Exception when performing API MolSearch

User f05f6b8c05

28-12-2010 03:22:19


Hi,


 


I am getting an error when running the following code in jchem 5.4.0.0 (java 1.5.0_17-b04)


 


        Molecule mol = MolImporter.importMol("OC(C(O)C(O)=O)C(O)=O");


        MolSearch s = new MolSearch();


        MolSearchOptions so = new MolSearchOptions();


        so.setExactFragment(true);


        so.setStereoSearchType(SearchConstants.STEREO_EXACT);


        s.setSearchOptions(so);


        Molecule m = MolImporter.importMol("OC(C(O)C(O)=O)C(O)=O |&1:1,2,w:1.0,2.2|");


        s.setTarget(mol);


        s.setQuery(m);


        int[][] hits = s.findAll();


        if (hits!=null) {


            System.out.println("found");


        }


 


If I comment out this line:


so.setStereoSearchType(SearchConstants.STEREO_EXACT);


then I no longer get an exception.


 


Am I doing something incorrectly?


 


Thanks for any help.


 


The exception is:


 


chemaxon.sss.search.SearchException: An error occured during search:java.lang.ArrayIndexOutOfBoundsException: 64


  Query:OC(C(O)C(O)=O)C(O)=O |&1:1,2,w:1.0,2.2|


  Target:OC(C(O)C(O)=O)C(O)=O


 


Caused by:


64


        at chemaxon.sss.search.MolSearch.getWrapperSearchException(MolSearch.java:697)


        at chemaxon.sss.search.MolSearch.findFirstHit(MolSearch.java:732)


        at chemaxon.sss.search.MolSearch.findAllHits(MolSearch.java:795)


        at chemaxon.sss.search.Search.findAll(Search.java:649)


        at debug.<init>(debug.java:37)


        at debug.main(debug.java:18)


Caused by: java.lang.ArrayIndexOutOfBoundsException: 64


        at chemaxon.sss.search.StructureSearch.hasEnoughBondsForStereo(StructureSearch.java:4694)


        at chemaxon.sss.search.StructureSearch.compareChiralities0(StructureSearch.java:5330)


        at chemaxon.sss.search.StructureSearch.compareChiralities(StructureSearch.java:5196)


        at chemaxon.sss.search.StructureSearch.testChiralityInTheMiddle(StructureSearch.java:5427)


        at chemaxon.sss.search.StructureSearch.isCompatibleIdx(StructureSearch.java:5505)


        at chemaxon.sss.search.StructureSearch.findNextSNforThisQN(StructureSearch.java:5575)


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


        at chemaxon.sss.search.StructureSearch.findFirst0(StructureSearch.java:6334)


        at chemaxon.sss.search.StructureSearch.findFirstHit(StructureSearch.java:6288)


        at chemaxon.sss.search.MolSearch.findNextEnumeratedHit(MolSearch.java:1024)


        at chemaxon.sss.search.MolSearch.findNextFilteredHit(MolSearch.java:877)


        at chemaxon.sss.search.MolSearch.findFirstHit(MolSearch.java:724)


        ... 4 more



ChemAxon 9c0afc9aaf

28-12-2010 19:54:38

Hi,


 


Thank you for the detailed bug report !


We could reproduce the problem and my colleagues will start working on it after the holidays.


They will get back to you here with their findings and the estimated time when the bugfix will be available in a future version.


Meanwhile I have noticed that your query is a bit strange:


"OC(C(O)C(O)=O)C(O)=O |&1:1,2,w:1.0,2.2|"


Enhanced stereo AND groups are designed to be used with UP or DOWN wedges - with wiggly bonds I guess they are superfluous. Please see:


http://www.chemaxon.com/jchem/doc/user/query_stereochemistry.html#mdl_enhanced_stereo


If you let us know what do you want to achieve we may give you some advice. 


Nevertheless the following query only containing the wiggly bonds throws the same exception, so we will have to investigate and fix anyway:


"OC(C(O)C(O)=O)C(O)=O |w:1.0,2.2|"


Thank you again for the report.


 


Best regards,


 


Szilard

User f05f6b8c05

28-12-2010 20:21:02

Hi,


Thanks for the quick reply, and also for catching my notation/smiles mistake .. I really should have used "O[C@H]([C@@H](O)C(O)=O)C(O)=O |&1:1,2|" to indicate the mixture of "both up" and "both down" structures .. the revised structure does not cause an exception.


Thanks again for the help.


Happy holidays,


Andrew

ChemAxon 42004978e8

24-01-2011 11:53:00

Hi Andrew,


We are happy that you could avoid the exception this way. We fixed this bug, so the original query will work as well. This will be released in 5.4.1.


Bye,


Robert