Substructure search

User e3b516b760

22-12-2011 14:52:54

Hi,


 


 


Just wanted to know if I can get sample code for substructure search in C sharp?


 


 


thanks

ChemAxon bd13b5bd77

25-12-2011 22:00:46

Hi,

 this example demonstrates the DUPLICATE check for an exact match:



          if (mol1 == null)
           return false;



          if (mol2 == null)
            return false;



          // define an in -memory search object
         chemaxon.sss.search.MolSearch molSearch = new chemaxon.sss.search.MolSearch();
         // load the taregt to be searched in our molecule
         molSearch.setTarget(mol1);
         // load our molecule and set as query one for exact match
         molSearch.setQuery(mol2);
         // DUPLICATE check is only valid for exact matching
         molSearch.setSearchOptions( new chemaxon.sss.search.SearchOptions( chemaxon.sss.SearchConstants.__Fields.DUPLICATE));



          // check the result set, consider :
         // if the result is null -> they dop not match
         // ?? if the result is EXACTLY one based on the rank and dimension, we might be sure that we have duplicates
         int[][] result = molSearch.findAll();
         // check the ranks
         return (result != null);



 the differences between substructure search and exact match can be found in:



 http://www.chemaxon.com/jchem/doc/user/query_searchtypes.html#full



 (by using chemaxon.sss.SearchConstants.__Fields.SUBSTRUCTURE)

  http://www.chemaxon.com/jchem/doc/user/queryindex.html







 Viktor