react() and selectivity rules

User 870ab5b546

24-07-2007 18:55:57

Hi,





In the API for Reactor, you say about the method react(),
Quote:
Performs the reaction sequence. Returns the next product list, or null if there are no more product lists. Product lists are ordered according to priority if a selectivity rule is specified.
Consider doing a base-promoted elimination reaction from CCCC(Br)(CC)C=C. Suppose also there is a selectivity rule using connections(), so that the H is removed from the atom with more connections (sp3 before sp2). There are three possible products of the reaction: CCCC(C=C)=CC |w:6,6|, CCC=C(CC)C=C |w:2,1|, and CCCC(CC)=C=C. The selectivity rule chooses against the third product, but does not discriminate between the first two.





I understand that react() will return one of the first two products on the first call, the other of the first two on the second call, and the third product on the third call.





My question is, if I repeatedly call react(), is there a way to tell when it is returning products that are unpreferred according to the selectivity rule?





Perhaps there is a flag I can set that tells react() to return null if there are no more products that are unpreferred? Then, if I want the less preferred products, I can reset the flag?





Essentially, I am asking how I can distinguish a completely unselective reaction from one that gives major and minor products.

ChemAxon e08c317633

25-07-2007 09:46:36

Hi,





You can ignore rules. If rules are set they are applied by default.





API: setIgnoreRules(int)





Command line options:
Code:
  -n, --no-rules <type>               ignore reaction rules,


                                      depending on type:


                                      r  - ignore reactivity rule


                                      s  - ignore selectivity rule


                                      t  - ignore selectivity tolerance


                                      rs - ignore both reactivity and


                                           selectivity rules


                                      rt - ignore reactivity rule and


                                           selectivity tolerance






GUI: "Ignore Reaction rules" checkboxes





Products generated with ignored selectivity rule(s) will contain the "preferred" and the "unpreferred" products too.





Zsolt

User 870ab5b546

25-07-2007 12:54:10

I guess my question wasn't clear.





I know that I can ignore rules. The problem is that when I don't ignore rules, I want to know when react() begins returning products that are unpreferred according to the rules.





Perhaps what I need is a "rules strictness" flag with three possible values (instead of the current two). Value 0 means ignore rules, value 1 means return the most preferred products first and then the less preferred products, and value 2 means return only the most preferred products.





An exclude rule won't help me here.

ChemAxon e08c317633

26-07-2007 09:25:11

OK, I understand now.





With selectivity tolerance you can control the selectivity acceptance interval. Selectivity rules are real-valued chemical expressions that order products according to their occurrence. Products are returned by Reactor only if the difference between their computed selectivity and the maximum selectivity value is within the specified tolerance. The default tolerance is 0.0001 which essentially means that only the maximum selectivity value is accepted.





You can set the tolerance value to default to get only the most preferred products, and you can use your current tolerance values to get all expected products.





API: we have a few setReaction(...) methods that can be used to set the tolerance, e.g. http://www.chemaxon.com/jchem/doc/api/chemaxon/reaction/Reactor.html#setReaction(chemaxon.struc.Molecule, java.lang.String, java.lang.String, double[]) (sorry, it is not a link because our forum engine doesn't support "]" characters in links).





Zsolt

User 870ab5b546

26-07-2007 16:59:35

Is the process of setting the tolerance entirely empirical, or is there some guidance as to what values will exclude what products of certain selectivity rules?





Also, if I have very strict tolerance, and I get some products from react(), and then I reset the tolerance and call react() again, will Reactor pick up where it left off, or will it start all over?

ChemAxon e08c317633

30-07-2007 10:27:58

bobgr wrote:
Is the process of setting the tolerance entirely empirical, or is there some guidance as to what values will exclude what products of certain selectivity rules?
It is empirical.
Quote:
Also, if I have very strict tolerance, and I get some products from react(), and then I reset the tolerance and call react() again, will Reactor pick up where it left off, or will it start all over?
It will start over. The reaction also have to be reset when you reset the tolerance.





Zsolt

User 870ab5b546

10-08-2007 20:54:22

Here is a suggestion for the long term:





Instead of using tolerance to decide when to cut off returning products from the Reactor, instead, return an object, call it "ReactorResult", that contains two variables: the Molecule[] containing the products, and a float, call it "likelihood", with a value of between 0 and 1 that refers to the extent to which the product is consistent with the selectivity rules. Two products that are equally likely to be formed would both have likelihood = 1, a product that has little or no chance of forming would have likelihood = 0, and, e.g., if we nitrate toluene, the ortho product might have likelihood = 0.2.





The virtue of this approach is that it allows the user to set a high tolerance but still see how likely certain products are to form. Currently, there is no way to see how minor a minor product is without changing the tolerance, rerunning the Reactor, and seeing if the product is still returned. With likelihood, you can set tolerance once, then see how minor the minor products are. Another advantage: tolerance must be set *before* you run a reaction, whereas likelihood is a value obtained *after* the reaction.

ChemAxon e08c317633

14-08-2007 09:35:27

Hi,





Thanks for the suggestion, but I'm not sure it is a user friendly solution. Handling of "ReactorResult" objects would be much more complicated than handling a Molecule array.





We will consider to ad getters for the calculated selectivity values. Using these values it would be possible to implement likelihood methods.





Zsolt

User 870ab5b546

14-08-2007 13:21:04

Good point. But instead of returning a ReactorResult, how about returning a Molecule[] in which each Molecule member has a "likelihood" property? Then the user could just use the getProperty() method to get the likelihood.





Speaking of which, can a user set a property for a Molecule that is not predefined? That is, can I do,





mol.setProperty("tastiness", "yummy");





?





-- Bob

ChemAxon e08c317633

14-08-2007 14:54:26

bobgr wrote:
Good point. But instead of returning a ReactorResult, how about returning a Molecule[] in which each Molecule member has a "likelihood" property? Then the user could just use the getProperty() method to get the likelihood.





Speaking of which, can a user set a property for a Molecule that is not predefined? That is, can I do,





mol.setProperty("tastiness", "yummy");





?





-- Bob
If the Molecule is not null then you can.





Zsolt