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