Premature end of cfile in CTAB when searching

User 956e0ca334

01-05-2014 07:54:19

Hi there,


We are getting an issues when we try to search on certain structure on our website (example file attached), we use Marvin view and Marvin mSketch. 


chemaxon.marvin.io.MRecordParseException: Premature end of cfile in CTAB
chemaxon.marvin.io.formats.mdl.MolRecordReader.readCtab(MolRecordReader.java:628)
chemaxon.marvin.io.formats.mdl.MolRecordReader.readMol0(MolRecordReader.java:196)
chemaxon.marvin.io.formats.mdl.MolRecordReader.nextRecord(MolRecordReader.java:138)
chemaxon.marvin.io.formats.mdl.MolRecordReader.nextRecord(MolRecordReader.java:77)
chemaxon.marvin.io.MRecordImporter.startReadingNext(MRecordImporter.java:1026)
chemaxon.marvin.io.MRecordImporter.readRecord(MRecordImporter.java:670)
chemaxon.marvin.io.MRecordImporter.readMol0(MRecordImporter.java:585)
chemaxon.marvin.io.MRecordImporter.readMol(MRecordImporter.java:509)
chemaxon.formats.MolImporter.readMol(MolImporter.java:823)
chemaxon.formats.MolImporter.read(MolImporter.java:710)
chemaxon.formats.MolImporter.read(MolImporter.java:680)
chemaxon.util.MolHandler.importMol(MolHandler.java:677)
chemaxon.util.MolHandler.setMolecule(MolHandler.java:148)
chemaxon.jchem.base.search.MolSetSearch.readQuery(MolSetSearch.java:1687)
chemaxon.jchem.base.search.MolSetSearch.search(MolSetSearch.java:1230)
chemaxon.jchem.base.search.MolSetSearch.run(MolSetSearch.java:1182)
chemaxon.jchem.db.SimpleJChemSearch.searchCore(SimpleJChemSearch.java:248)
chemaxon.jchem.db.JChemSearch.searchCore(JChemSearch.java:1382)
chemaxon.jchem.db.JChemSearch.search(JChemSearch.java:1439)
chemaxon.jchem.db.JChemSearch.run(JChemSearch.java:1355)
com.tandf.chemsearch.ChemicalDictionaryStructureSearch.createSearchContext(ChemicalDictionaryStructureSearch.java:74)
com.tandf.chemsearch.ChemicalDictionaryStructureSearch.createSearchContext(ChemicalDictionaryStructureSearch.java:26)
com.tfi.dictionaries.search.ChemicalSearchBean.createSearchContext(ChemicalSearchBean.java:334)
com.tfi.dictionaries.search.ChemicalSearchBean.createSearchContext(ChemicalSearchBean.java:258)
com.tfi.actions.dictionaries.search.ShowSearchResultsAction.prepareSearchResults(ShowSearchResultsAction.java:125)
com.tfi.actions.dictionaries.search.ShowSearchResultsAction.execute(ShowSearchResultsAction.java:278)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:480)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:502)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.tfi.util.EncodingFilter.doFilter(EncodingFilter.java:34)


 


The file appears fine in marvin view before we pass it to the searcher:


 


public SearchContext createSearchContext(SearchFilterEntity _search) throws Exception {


SearchContext searchContext = null;
StructureFilterEntity search = (StructureFilterEntity) _search;


ConnectionHandler ch;
ch = new ConnectionHandler();
ch.setDriver(search.getDbdriver());
ch.setUrl(search.getDburl());


ch.setLoginName(search.getLogin());
ch.setPassword(search.getPassword());


ch.setPropertyTable("JChemProperties");

ch.connectToDatabase();


try {
JChemSearch searcher = new JChemSearch();

LicenseHandler.getInstance().setGlobalLicenseEnvironment("#############");

searcher.setQueryStructure(search.getStructureText());
searcher.setConnectionHandler(ch);
searcher.setStructureTable(search.getDbtable());


int TypeOfSearch = 0;


String searchType = search.getSearchtype();


if (searchType.contentEquals("EXACT")) {
TypeOfSearch = SearchConstants.FULL;
} else {
TypeOfSearch = SearchConstants.SUBSTRUCTURE;
}
JChemSearchOptions searchOptions = new JChemSearchOptions(TypeOfSearch);

searcher.setSearchOptions(searchOptions);
searcher.setResultTableMode(JChemSearch.NO_RESULT_TABLE);


long t0 = System.currentTimeMillis();


searcher.run();


int[] StructureResultArray = searcher.getResults();
long t1 = System.currentTimeMillis();
long screeningTime = searcher.getScreeningTime();
int screeningCount = searcher.getScreenedCount();
long searchTime = searcher.getSearchTime();


log.info("Structure search took: " + (t1 - t0) + "ms [screening time=" + screeningTime
+ " screening count=" + screeningCount + " search time=" + searchTime);
log.info("Number of structure hits: " + StructureResultArray.length);


searchContext = new StructureSearchContext();
ContextParam[] params = {
new ContextParam(
"structure-hits", StructureResultArray,
StructureResultArray.getClass()),
new ContextParam(
StructureSearchContext.PARAM_STRUCTURE_HIT_COUNT,
new Long(StructureResultArray.length), java.lang.Long.class)
};
searchContext.init(params);
} finally {
ch.close();
}
return searchContext;
}


(Note I have I replaced out licensing with ########)



 


ChemAxon 9c0afc9aaf

01-05-2014 15:52:40

Hi Megan,


May 1 and 2 are public holidays in Hungary, so our response may be delayed a little.


In the meantime could you please write us the exact JChem version in use ?


Kind regards,


Szilard

User 956e0ca334

01-05-2014 16:25:33

I am using the latest 6.2.2- but this also occured in previous versions _ I have tested them!


 


Have a great holiday


Megan

ChemAxon 9c0afc9aaf

01-05-2014 19:14:55

Hi,


So far I have tried with "jcsearch" command line, and also from Java Code specifying the problem query as a string literal.


In either case the code runs well for me.


It is strange that the CTAB refers to a section of mol/SDF format, while the attached input is MRV.


Could you please verify the value of search.getStructureText(), does it correspond to the attached mrv source, or maybe some other transformation was performed before ?


Best  regards,


Szilard