Running a SMART test on a SMILES molecule

User 525d9a3104

10-10-2016 16:48:25

I'm hoping to do something super simple:



  1. Create a molecule using SMILES -- I don't want a file, I don't need it translated or anything.  I just need the chemical makeup of the SMILES formula represented

  2. Using a serious of SMART filters, verify which SMART the SMILES molecule most represents.

ChemAxon d51151248d

18-10-2016 10:57:47

Hi Jason,


1. What do you mean by creating? I mean you can read a molecule represented by a SMILES code and do different things with it: visualize in MarvinView, or calculate different properties for it. To look at the chemical makeup of a molecule, you should visualize it somehow. Can you give more information on what you want to do?


2. We have a language called Chemical Terms, which has functions that can help you find and count fragments represented by SMARTS codes. The match() and matchCount() do these. By using them you can make a script that finds the fragment, which  occurs the most in the molecule.


Here is the manual of these match functions with usage examples:


https://docs.chemaxon.com/display/docs/Functions+by+Categories#match_functions


I hope this helps,


Daniel 

User 525d9a3104

18-10-2016 16:37:20

Daniel,


I might not be going about this the correct way, but what I have is some SMILES representation: HCOOH (which is Formic Acid).  And then I have a list of SMART filters.  I want to check which SMART filter best represents my SMILES notation.


Now, I believe the best way to do this, from reading the documentation, is to build a molecule from my SMILES notation and then just ask the molecule: "are you like x, y, or z?"  As luck would have it, the docs.chemaxon.com is currently down.  But I will read that documentation you sent when it's back up to see how well it will fit my needs.


Thanks,


Jason

ChemAxon e7b9408ca1

19-10-2016 06:33:39

For information, HCOOH is not in the SMILES format. In SMILES double bonds are explicit, one possible SMILES representation for formic acid is OC=O.

ChemAxon d51151248d

19-10-2016 09:43:05

Hi Jason !


First, our docs site is available again, so you can browse our manuals. 


Second, for your case I would experiment with the match and matchCount functions. (as I mentioned in my last email) Here is an easy example of using these functions for the formic acid molecule:


./evaluate -e "match('[#8]C=O')" "OC=O"
1
./evaluate -e "matchCount('[#8]C=O')" "OC=O"
1


So I filtered the molecule for the -COOH group, and got a single hit.


I hope this helps, 


Daniel



User 525d9a3104

19-10-2016 18:41:24










dszisz wrote:

Hi Jason !


First, our docs site is available again, so you can browse our manuals. 


Second, for your case I would experiment with the match and matchCount functions. (as I mentioned in my last email) Here is an easy example of using these functions for the formic acid molecule:


./evaluate -e "match('[#8]C=O')" "OC=O"
1
./evaluate -e "matchCount('[#8]C=O')" "OC=O"
1


So I filtered the molecule for the -COOH group, and got a single hit.


I hope this helps, 


Daniel





Ok, so I have to use the command line?  I cannot us a programmatic API to do this?  It's mostly ok for what I need, just orders of magnitude slower than what I was hoping for.


 


Thanks,


Jason

ChemAxon d51151248d

20-10-2016 14:04:55

Hi, 


No, of course we have an API as well for you. Look at this API documentation of the evaluator tool:


https://www.chemaxon.com/jchem/doc/dev/java/api/chemaxon/jep/Evaluator.html


Please check if this is what you need. 


Daniel

User 525d9a3104

20-10-2016 17:28:55

This is exactly what I need.  Thank you!


I already have a solution coded up and mostly working.  My only followup question is: how do you get this to allow recursive SMART statements, I have a SMART filter for Epoxides: [$([#7+][OX1-]),$([#7v5]=[OX1]);!$([#7](~[O])~[O]);!$([#7]=[#7])]


However, this throws a ParseException error at line 1, column 1:


Exception in thread "main" chemaxon.nfunk.jep.ParseException: Error while compiling expression:


[$([#7+][OX1-]),$([#7v5]=[OX1]);!$([#7](~[O])~[O]);!$([#7]=[#7])]


    Encountered "[" at line 1, column 1.


Was expecting one of:


    <EOF> 


    ";" ...


    "+" ...


    "-" ...


    <NOT> ...


    <STRING_LITERAL> ...


    <INTEGER_LITERAL> ...


    <FLOATING_POINT_LITERAL> ...


    <IDENTIFIER> ...


    "(" ...


    


at chemaxon.nfunk.jep.JEP.parseExpression(JEP.java:437)


at chemaxon.jep.ChemJEP.compile(ChemJEP.java:118)


at chemaxon.jep.Evaluator.compile(Evaluator.java:955)


at chemaxon.jep.Evaluator.compile(Evaluator.java:872)


at ChemAxionMain.runEvaluator(ChemAxionMain.java:27)


at ChemAxionMain.main(ChemAxionMain.java:19)


at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)


at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)


at java.lang.reflect.Method.invoke(Method.java:497)


at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)


Caused by:


chemaxon.nfunk.jep.ParseException: Encountered "[" at line 1, column 1.


Was expecting one of:


    <EOF> 


    ";" ...


    "+" ...


    "-" ...


    <NOT> ...


    <STRING_LITERAL> ...


    <INTEGER_LITERAL> ...


    <FLOATING_POINT_LITERAL> ...


    <IDENTIFIER> ...


    "(" ...


    


at chemaxon.nfunk.jep.Parser.generateParseException(Parser.java:1761)


at chemaxon.nfunk.jep.Parser.jj_consume_token(Parser.java:1641)


at chemaxon.nfunk.jep.Parser.Start(Parser.java:60)


at chemaxon.nfunk.jep.Parser.parseStream(Parser.java:26)


at chemaxon.nfunk.jep.JEP.parseExpression(JEP.java:404)


at chemaxon.jep.ChemJEP.compile(ChemJEP.java:118)


at chemaxon.jep.Evaluator.compile(Evaluator.java:955)


at chemaxon.jep.Evaluator.compile(Evaluator.java:872)


 


at ChemAxionMain.runEvaluator(ChemAxionMain.java:27)


 


Thanks so much for your help thus far!  I greatly appreciate it.

User 525d9a3104

06-11-2016 23:37:08

....i realized my issue.  I wasn't prepending the "match()" method call to the smart string.

ChemAxon d51151248d

07-11-2016 10:06:06

Hi Jason, 


Thank you for this correction. We unfortunately haven't started to investigate your issue on a code level, so if you still encounter the problem, please tell us and we will go on with it.


Thank you,


Daniel