MolSearch fails to search substructure

User d1c1a30031

27-04-2016 17:47:39

tried to find if a substructure (CH) occurs in Benzene.The substructure was imported as SMARTS: [cH1;a]. no matter I use findAllHits() or getMatchCount(), it returns 0 match. Why? apply aromatize() or not it still fails. Any help is highly appreciated.


 


int substructureSearch(Molecule toSearch, String smartsQuery) {


             
MolSearch
s = new MolSearch();


             
try {


                    
MolHandler
mh = new MolHandler(smartsQuery, true);


                     s.setQuery(mh.getMolecule());


                     toSearch.aromatize(true); //apply or not it fails to match!!!


                    
s.setTarget(toSearch);


                    
SearchHit[]
hits = s.findAllHits();


                    
if (hits == null) {


                          
return 0;


                    
}
else {


                          
return hits.length;


                    
}


             
}
catch (MolFormatException
| SearchException
e) {


                    


                    
IOUtils.
INSTANCE.showException("MolFormatException or
SearchException"
, "For '" + smartsQuery + "', got the error " + e.getMessage(), e);


             
}


             
return 0;


 


       }

ChemAxon abe887c64e

02-05-2016 12:43:42

Hi Zhe,


The MolSearch class, by default, does not use any standardization - neither aromatization.


You can use StandardizedMolSearch if you want the default general aromatization to be taken into account or apply the setStandardizer method of the MolSearch class to set custom standardizer actions.


Best regards,


Krisztina

User d1c1a30031

04-05-2016 18:02:46










kvajda wrote:

Hi Zhe,


The MolSearch class, by default, does not use any standardization - neither aromatization.


You can use StandardizedMolSearch if you want the default general aromatization to be taken into account or apply the setStandardizer method of the MolSearch class to set custom standardizer actions.


Best regards,


Krisztina



Hi Kris,


Thanks for the suggestion. Problem was solved.


Best,


Zhe