IllegalArgumentException: MolSearch: Unknown search type: 3

User 52a4e280f0

19-07-2012 14:29:02

 


Hi All,


I am performing a SIMILARITY search for a MOL file along with a SUBFORMULA search on a molecular formula but in return getting the following exception:


SEVERE: Error during ABAS in table "ChemistryStructureMolecule" for cd_id: 4776


chemaxon.sss.search.SearchException: An error occured during search:java.lang.IllegalArgumentException: MolSearch: Unknown search type: 3


Query:c1ccc2ccccc2c1


Target:c1ccc2ccccc2c1


Caused by:


MolSearch: Unknown search type: 3


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


at chemaxon.sss.search.MolSearch.isMatching(MolSearch.java:646)


at chemaxon.jchem.db.JChemSearch.isMatching(JChemSearch.java:4744)


at chemaxon.jchem.db.JChemSearch.access$1500(JChemSearch.java:121)


at chemaxon.jchem.db.JChemSearch$ABASThread.run(JChemSearch.java:554)


........


 


The code I am using is:


 


        ConnectionHandler connectionHandler = null;


        try {


            connectionHandler = connectionHandlerFactory.createReadOnly();


         


            final byte[] queryMolFile = "SOME VALID MOL FILE";


            final Molecule queryMolecule = moleculeFactory.create(queryMolFile);


            final String molecularFormula = "SOME MOL FORMULA";


 


            float similarityThreshold = SOME THRESHOLD VALUE IN FLOAT;


 


            JChemSearchOptions searchOptions = new JChemSearchOptions(JChemSearchOptions.SIMILARITY);


            searchOptions.setDissimilarityThreshold(1 - similarityThreshold);


 


            if (molecularFormula != null) {


                searchOptions.setFormulaSearchQuery(molecularFormula);


                searchOptions.setFormulaSearchType(FormulaSearch.SUBFORMULA);


            }


 


            final String filterQuery = "SOME SQL QUERY";


            searchOptions.setFilterQuery(filterQuery);


 


            final String structureTable = structureTableLookup.lookup("ChemistryStructureMolecule");


 


            final JChemSearch searcher = jChemSearchFactory.create();


            searcher.setQueryStructure(queryMolecule);


            searcher.setConnectionHandler(connectionHandler);


            searcher.setStructureTable(structureTable);


            searcher.setRunMode(JChemSearch.RUN_MODE_SYNCH_COMPLETE);


            searcher.setSearchOptions(searchOptions);


            searcher.run();


 


        } catch (Exception e) {


            throw new RuntimeException(e);


        } finally {


            if (connectionHandler != null) {


                try {


                    connectionHandler.close();


                } catch (SQLException e) 


            }


        }


Can somebody please look into this and let me know if I am missing something?


Many thanks,


Isha


 

ChemAxon fa971619eb

19-07-2012 14:34:19

I moved this to the JChem forum as its more releavnt to that forum.
You should get an answer soon. 


Tim

ChemAxon 9c0afc9aaf

19-07-2012 15:30:20

Hi,


Just a quick answer, the experts may provide more detail.


You can only run one type of search at a time, so you have to choose between similarity or formula.


When using formula search, just set the search type to DEFAULT, and it should wotk fine.


 


Best regards,


 


Szilard

User 52a4e280f0

19-07-2012 15:38:14

But as part of a separate code I do run SUBFORMULA search with SUBSTUCTURE search for the MOL file. And they two seem to work?


 


Is the combination of SIMILARITY(MOL file) and SUBFORMULA not valid?? The online documentation doesn't mention anything like that?? 

ChemAxon 9c0afc9aaf

19-07-2012 15:57:51

Hi,


 


I think I spoke too soon, and formula search is indeed supposed to be used together with other search types.


So it is probably a bug that we are trying to invoke the graph search even with similarity search.


Please let us know your exact JChem version.


The experts will respond soon.


Best regards,


Szilard

User 52a4e280f0

19-07-2012 16:08:40

Thanks Szilard,


The version we are using is 1.0



  <dependency>


            <groupId>chemaxon.jchem</groupId>


            <artifactId>jchem</artifactId>


            <version>1.0</version>


</dependency>


User 52a4e280f0

19-07-2012 16:14:24

Also just to bring into your notice that I think that seems to work on one of the web sites:


http://www.chemaxon.com/ajax/


Maybe the version I have with me is not the correct one?


Thanks,


Isha


 


 

ChemAxon 9c0afc9aaf

19-07-2012 16:25:41

Hi,


 


You can obtain the JChem version by printing the value of the following constant:


 


chemaxon.jchem.VersionInfo.JCHEM_VERSION

Szilard

User 52a4e280f0

20-07-2012 09:36:27

It prints:


5.5.1.0

ChemAxon a3d59b832c

24-07-2012 08:43:15

Dear Isha,


 


I am sorry for the late answer.


We will look into this issue in more detail soon.


 


Best regards,


Szabolcs

User 52a4e280f0

24-07-2012 13:03:42

Thanks Szabolcs....

ChemAxon 4a2fc68cd1

25-07-2012 12:03:05

Dear Isha,


We have investigated the issue and we could reproduce it even with the latest JChem versions. (I do not understand why it seemed to work in the AJAX example site.) Currently, formula search filtering is only supported for the following search types: SUBSTRUCTURE, FULL, FULL_FRAGMENT, SUPERSTRUCTURE, and NO_SCREEN.


It is not clear now which release could fix this issue, but until then you can apply a quite simple workaround as follows. Instead of executing one JChemSearch process with all the required filters, you can first execute a simple formula search (without a query molecule) and then execute a similarity search using the results of the first search as a filter ID list. Here is an example code (using your variable names):


    final JChemSearch searcher = jChemSearchFactory.create();
    searcher.setConnectionHandler(connectionHandler);
    searcher.setStructureTable(structureTable);
    searcher.setRunMode(JChemSearch.RUN_MODE_SYNCH_COMPLETE);

    int[] formulaResults = null;
    if (molecularFormula != null) {
        JChemSearchOptions formulaSearchOpts =
                new JChemSearchOptions(JChemSearchOptions.SUBSTRUCTURE);
        formulaSearchOpts.setFormulaSearchQuery(molecularFormula);
        formulaSearchOpts.setFormulaSearchType(FormulaSearch.SUBFORMULA);
        searcher.setSearchOptions(formulaSearchOpts);
        searcher.run();
        formulaResults = searcher.getResults();
    }

    JChemSearchOptions simSearchOpts =
            new JChemSearchOptions(JChemSearchOptions.SIMILARITY);
    simSearchOpts.setDissimilarityThreshold(1 - similarityThreshold);
    simSearchOpts.setFilterQuery(filterQuery);
    searcher.setSearchOptions(simSearchOpts);
    searcher.setQueryStructure(queryMolecule);
    if (molecularFormula != null) {
       
searcher.setFilterIDList(formulaResults);
    }


    searcher.run();


For efficiency reasons, you can apply your filter query to the first search, as well (by invoking simSearchOpts.setFilterQuery(filterQuery) before the first call of searcher.run()).


I hope this helps!


Best regards,
Peter

User 52a4e280f0

25-07-2012 12:41:38

Thanks Peter for looking into this... 


I tried your suggested approach but I get the following error:



Caused by: java.lang.ArrayIndexOutOfBoundsException: 24 >= 0


at chemaxon.util.FloatVector.elementAt(FloatVector.java:280)


at chemaxon.jchem.db.JChemSearch.filterScreened(JChemSearch.java:5195)


at chemaxon.jchem.db.JChemSearch.getScreened(JChemSearch.java:3946)


at chemaxon.jchem.db.JChemSearch.searchCore(JChemSearch.java:2218)


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


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


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


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



ChemAxon 4a2fc68cd1

28-07-2012 13:03:02

Dear Isha,


I checked the exception you reported, but I could not reproduce this issue neither with JChem 5.5.1 (the version you have) nor with the recent releases. However, we made some changes and a bug fix releated to the handling of filter ID lists in case of similarity search since the release of JChem 5.5.1. Could you please try upgrading your JChem installation to a recent release? (The latest one is JChem 5.10.1) Maybe, it would solve your problem, otherwise your experiments would help us in the further investigation of this issue.


Best regards,
Peter

ChemAxon 4a2fc68cd1

28-07-2012 13:33:18

Dear Isha,


I would like to refine my previous comment: finally I could reproduce similar exceptions (even with the latest JChem version), but only in case if JChemSearchOptions.setReturnsNonHits() is called with true value, i.e. JChemSearch is required to return the non-hits instead of hits (in case of similarity search, it means that dissimilar targets are returned instead of similar ones).


So this is obviously a bug in our code, we will fix it soon. However, it seems to be related to the non-hits option. Could you check the value of this option in your use case? For example, by calling


System.out.println(searcher.getSearchOptions().isReturnsNonHits());


before searcher.run(). Thank you in advance.


Regards,
Peter

User 52a4e280f0

30-07-2012 09:19:00

Hi Peter,


This prints 'false'.


Thanks,


Isha


 

ChemAxon 4a2fc68cd1

30-07-2012 10:57:47

Hi Isha,


It is strange, we could only reproduce such problems if this non-hits option is set to true. Could you please update your JChem installation to see whether a recent version also produces such an exception?


Thanks,
Peter

User 52a4e280f0

06-08-2012 12:23:06

Hi Peter,


I have tried it with the latest version (5.10.1) as well but still get the same error:



Caused by: java.lang.ArrayIndexOutOfBoundsException: 10 >= 0


[12:45:20.207][warn][talledLocalContainer]      at chemaxon.common.util.FloatVector.elementAt(FloatVector.java:297)


[12:45:20.207][warn][talledLocalContainer]      at chemaxon.jchem.db.JChemSearch.filterScreened(JChemSearch.java:5801)


[12:45:20.207][warn][talledLocalContainer]      at chemaxon.jchem.db.JChemSearch.getCandidates(JChemSearch.java:4455)


[12:45:20.207][warn][talledLocalContainer]      at chemaxon.jchem.db.JChemSearch.searchCore(JChemSearch.java:2634)


[12:45:20.207][warn][talledLocalContainer]      at chemaxon.jchem.db.JChemSearch.search1(JChemSearch.java:2494)


[12:45:20.207][warn][talledLocalContainer]      at chemaxon.jchem.db.JChemSearch.search(JChemSearch.java:2274)


[12:45:20.207][warn][talledLocalContainer]      at chemaxon.jchem.db.JChemSearch.setRunning(JChemSearch.java:1994)


[12:45:20.207][warn][talledLocalContainer]      at chemaxon.jchem.db.JChemSearch.run(JChemSearch.java:2017)


Thanks,

Isha

ChemAxon 4a2fc68cd1

07-08-2012 19:43:45

Dear Isha,


Thank you. This stack trace is useful for us to localize and fix this issue. We will inform you about any progress.


Regards,
Peter

ChemAxon 4a2fc68cd1

27-08-2012 12:11:39

Dear Isha,


The upcoming major release, JChem 5.11 will be released in September 2012. It will contain several bug fixes related to filtering and ordering issues, including problems like the one you encountered. We hope that this release will fix your problem, although we could not reproduce the error exactly the same way.


Regards,
Peter

User 52a4e280f0

30-08-2012 10:19:00

Thanks, I will try upgrading my version to the latest one as soon as its out and see if it works?


Regards,


Isha