User 73ad691ca3
15-11-2012 14:18:30
Dear Chemaxon Team,
We are implementing 'the Structure search functionalities' in our Application using 'Jchem .Net API in JchemBase'.
We need to search 'the molecule with specific stereo type' in database; thereby we need to differentiate the molecules based on stereo types. Precisely, Our Aim is 'to search a molecule with a stereo type' in the database, and to get the search results based on our business logic.
We followed the jchem link http://www.chemaxon.com/jchem/doc/user/query_stereochemistry.html#tetrahedral_stereo.
As mentioned in these examples, the structure search is working properly for ‘the molecules with different stereo types’ provided in the example.
In our database we have added molecule1, molecule2(refer: molecule1.sdf, molecule2.sdf in the attachement). The molecule1, molecule2 represents different stereo types.
If we search molecule1 using JchemSearch .NET API, jchem returns both molecule1, molecule2. The JchemBase structure search is not returning only the molecule1 as a result for the query molecule1.
Jchem search should recognize/differentiate that molecule1, molecule2 are two different molecules.
We set the ‘stereo search option’ as ‘Exact Stereo’ in the JchemSearch API - SearchOption. Even though the Jchem is not returning proper search results.
How can we search ‘the molecules with stereo’ for the above using Jchem .Net API, what are the things we need to include for this?
Please reply us ASAP.
Below is the sample code we use for structure search:
--------------------------------------sample code----------------------------------------
//starting method
public static int[] SearchStructure(object molecule, JChemSearchOptions searchOptions)
{
try
{
JChemSearch searcher = new JChemSearch();
string molStr = molecule as string;
if (molStr == null)
{
Molecule mol = molecule as Molecule;
searcher.setQueryStructure(mol);
}
else
{
searcher.setQueryStructure(molStr);
}
searcher.setConnectionHandler(getConnectionHandler());
searcher.setStructureTable(ConfigurationManager.AppSettings["tablename"]);
searcher.setSearchOptions(searchOptions);
searcher.setRunMode(JChemSearch.RUN_MODE_SYNCH_COMPLETE);
searcher.run();
int[] resultedIds = searcher.getResults();
return resultedIds;
}
catch
{
throw;
}
}
//
public static JChemSearchOptions GetSearchOptions(string searchType, string dissimilarityTreshTxt, string maxHitsTxt)
{
try
{
int srchType = GetSearchType(searchType);//SearchConstants.__Fields.FULL;
JChemSearchOptions searchOptions = new JChemSearchOptions(srchType);
if (srchType == SearchConstants.__Fields.SIMILARITY)
{
searchOptions.setDissimilarityThreshold(1.0f - float.Parse(dissimilarityTreshTxt));
}
if(!string.IsNullOrEmpty(maxHitsTxt))
searchOptions.setMaxResultCount(int.Parse(maxHitsTxt));
searchOptions.setStereoSearchType(SearchConstants.__Fields.STEREO_EXACT);
searchOptions.setStereoModel(SearchConstants.__Fields.STEREO_MODEL_LOCAL);
return searchOptions;
}
catch (Exception ex)
{
throw new ApplicationException("Invalid 'search option': Check innerException for more details...", ex);
}
}
private static int GetSearchType(string searchType)
{
try
{
int srchType = 0;
if (searchType == "Substructure")
srchType = SearchConstants.__Fields.SUBSTRUCTURE;
else if (searchType == "Superstructure")
srchType = SearchConstants.__Fields.SUPERSTRUCTURE;
else if (searchType == "Full")
srchType = SearchConstants.__Fields.FULL;
else if (searchType == "Full fragment")
srchType = SearchConstants.__Fields.FULL_FRAGMENT;
else if (searchType == "Similarity")
srchType = SearchConstants.__Fields.SIMILARITY;
else if (searchType == "Duplicate")
srchType = SearchConstants.__Fields.DUPLICATE;
return srchType;
}
catch
{
throw;
}
}
private static ConnectionHandler getConnectionHandler()
{
return ConnectionHandlerUtil.ConnectionHandlerUtil.GetConnectionHandler();
}
---------------------------------------------------------------------------------------------------
Thanks & Regards,
D. Senthil kumar Vijai.