SMARTS JChem search .Net How-to

User 873a9ae9d0

07-04-2016 08:52:41

HI,


I use the ChemAxon .Net API to perform JChem searches.


The input format to the search is a molfile


Sometimes the molfile contains query features (e.g. atom lists), and the search fails with messages such as:


Some features of the molecule which simplest SMILES representation is: xxx cannot be converted to smiles.
Molecule  has not supported feature at atom nnn: atom is list atom.


Use the cxsmiles, smarts or cxsmarts format.


 


I already tried to convert the molfile to smarts and use


 


search.setQueryStructure("mysmartstring");


but I still get the same error. Somehow.


 


Question: What is the right way to do a JChem search (using the .Net API) for input molfiles that contain query features ?


 


Any feedback is highly appreciated.


Best regards


Hans-Juergen Himmler


 


 


 


 


 


 


 


 


 

ChemAxon abe887c64e

07-04-2016 13:30:06

Hi Hans-Juergen,


Thank you for the question.


The error in case of SMARTS format for structures with list atoms is strange, because it should work. We recommend to convert the query structures to CXSMARTS format using our molconverter tool and/or please send us the structure both in smiles and in smarts format.


Best regards,


Krisztina

User 773d472e7f

07-04-2016 14:01:40

HI Krisztina,


 


thanks for the quick response.


What is the correct way of converting a molfile to e.g. CXSMARTS using the .Net APi ?


In the past I  used chemaxon.struc.Molecule.exportToFormat("fmt")


i.e. after


chemaxon.struc.Molecule.importMol('themolfile');


I would call string mysmart = chemaxon.struc.Molecule.exportToFormat("CXSMARTS")


and finally search.setQueryStructure(mysmart);


Question ONE: Should that potentially work ?


Note: the exportToFormat() method seems to be depredicated.


Question TWO: What is the correct way of converting my molfile to say CXSMARTS using the .Net API ?


Hope to hear back from you.


Cheers


Hans-Juergen

ChemAxon abe887c64e

07-04-2016 14:36:36

Hi Hans-Juergen,


You can use chemaxon.formats.MolExporter.exportToFormat() method. Here is its Java API doc available. (The description fits also to the .NET version.)


Hope this helps,


Krisztina 

User 873a9ae9d0

07-04-2016 16:45:54

Hi Krisztina,


 


I got the smart (using cxsmart format) match to work using chemaxon.sss.search.StructureSearch AND using the most current version of the .Net API and using a single query molecule (with an atom list) and a single target molecule, BUT doing the equivalent using chemaxon.jchem.db.JChemSearch still fails.


I realized that the code for the JChemSearch (accessing a real big mysql db with more than 20 million compounds) is based on a rather old version of the .Net API (version 6.2.2.233). The current version for the JChem .Net API  seems to be 16.3.2800.2944.


Question: Is it possible that the reason I succeed calling chemaxon.sss.search.StructureSearch and fail calling chemaxon.jchem.db.JChemSearch that I use an old version of the API ?


It might be not a bad idea to switch to a newer version of the JChem .Net API, but before I do that I need to know if we need to change ANYTHING in our database to be able to utilize the most current version of the JChem .Net API.


Question: Do you know of any issues regarding dependencies of the mysql chemaxon db and the version of the JChem .Net API you use to access the db ??


Last question:


In case we decide to switch to a newer version of the JChem .Net API , I assume the current code will not run anymore, because of changes to the API.


To get a good ground start in case I go the new JChem .Net API- Is there anywhere a (c#) code example that shows how to perform a Substructure search in a JChemserver db using the most current version of the JChem .Net API ??


Hope you get help !


Cheers


Hans-Juergen

User 873a9ae9d0

08-04-2016 07:48:51

Hi Krisztina,


 


I have new information regarding the topic.


I did some more testing with OTHER query features than atom lists and realized that my current code (i.e. the one using the rather old JChem .Net API) WORKS with query features such as Any atoms, usage of e.g. the Q query atom etc.


It seems it is the ATOM LIST that causes problems.


Therefore I attach to this post the original molfile with a contained atom list. Can you please check from your side if a SSS using the .Net JChem API works on your system or not.


Please let me know your findings.


Thanks a lot for your efforts in advance.


Best regards


Hans-Juergen

ChemAxon abe887c64e

11-04-2016 10:18:58

Hi Hans-Juergen,


The atom list line (line 19) in the molfile you sent seems not to suit the requirements of the molfile format:


M  ALS   7  2 F  Br


This line should contain an additional F (meaning this is a normal atom list; T would stand for a NOT list):


M  ALS   7  2 F  F  Br


Best regards,


Krisztina