19.4 OEExprOpts Namespace

Pattern matching in OEChem is always done using query molecules or query graphs. Non-query molecules, i.e. those that are derived directly from OEMolBase or OEMCMolBase , must be converted into a query molecule. Conversion into a query molecule is controlled using the values in the OEExprOpts namespace . Expression options can either be specified in the constructor for an OEQMol , or using the convenience constructors in pattern matching classes (OESubSearch , OEMCSSearch , and OECliqueSearch ) which take expression options as as arguments.

Figure 19.9 shows an example where maximum common substructure search is performed using the OEExprOpts.DefaultAtoms and OEExprOpts.DefaultBonds options.

Figure 19.9: Example of maximum common substructure search with DefaultAtoms and DefaultBonds
 
1556

The OEExprOpts.DefaultAtoms option means that two atoms are considered to be equivalent i.e. they can be mapped to each other if they have the same atomic number, aromaticity, and formal charge. The OEExprOpts.DefaultBonds option means that two bonds can be mapped to each other if they have the same bond order and aromaticity.

 1 import openeye.oechem.*;
 2
 3 public class MCSSOEExprOpts
 4 {
 5   public static void main(String argv[])
 6   {
 7     OEGraphMol pattern = new OEGraphMol();
 8     OEGraphMol target  = new OEGraphMol();
 9     oechem.OEParseSmiles(pattern, "c1(cc(nc2c1C(CCC2)Cl)CCl)O");
10     oechem.OEParseSmiles(target,  "c1(c2c(nc(n1)CF)COC=C2)N");
11
12     int atomexpr = OEExprOpts.DefaultAtoms;
13     int bondexpr = OEExprOpts.DefaultBonds;
14
15     OEQMol patternQ = new OEQMol(pattern);
16     /* generate query with atom and bond expression options */
17     patternQ.BuildExpressions(atomexpr,bondexpr);
18     OEMCSSearch mcss = new OEMCSSearch(patternQ.QMol());
19
20     boolean unique = true;
21     int count = 1;
22     /* loop over matches */
23     for (OEMatchBaseIter mi = mcss.Match(target,unique); mi.hasNext();)
24     {
25       OEMatchBase match = mi.next();
26       System.out.println("Match "+count+ " :");
27       System.out.println("Number of matched atoms: " + match.NumAtoms());
28       System.out.println("Number of matched bonds: " + match.NumBonds());
29       /* create match subgraph */
30       OEGraphMol m = new OEGraphMol();
31       oechem.OESubsetMol(m,match,true);
32       System.out.println("match smiles = "+oechem.OECreateCanSmiString(m));
33       count++;
34     }
35   }
36 }

Listing:19.5 MCSS with atom and bond expression.label=code:expropt

The best way to understand how various atom and bond expressions influence the pattern matching is to change the atom (line 12) and bond expressions (line 13) in Listing and compare the obtained matches.

After constructing the pattern molecule, the OEQMolBase.BuildExpressions  (line 17) defines the level of atom and bond matching between the pattern molecule and any target molecule.

By modifying the atom and bond expression options, very diverse pattern matching can be performed. Figure 19.10 - Figure 19.14 show several examples where maximum common substructure searches are performed for the same query and target molecules, but with various atom and bond expression options.

In the first example in Figure 19.10, the OEExprOpts.ExactAtoms expression option is used to give a higher degree of discrimination of the equivalence of atoms, i.e. atoms can only be mapped to each other if they have the same degree, number of hydrogens, chirality, mass, and ring membership in addition to the requirements of the OEExprOpts.DefaultAtoms option.

Figure 19.10: ExactAtoms and DefaultBonds
 
1584

Figure 19.11 - Figure 19.14 show examples where the discrimination capability of the OEExprOpts.DefaultAtoms is decreased by adding various modifiers. For example, using the OEExprOpts.EqAromatic modifier, atoms in any aromatic ring systems are considered equivalent. As a result, the pyridine and pyrimidine ring can be mapped to each other in Figure 19.11. Similarly, OEExprOpts.EqHalogen (Figure 19.12) and OEExprOpts.EqONS (Figure 19.13) define equivalency between halogen atoms and oxygen-nitrogen-sulfur atoms, respectively. Using OEExprOpts.EqCAliphaticONS (Figure 19.14) an aliphatic query carbon atom is considered equivalent to any oxygen, nitrogen, or sulphur atom.

Figure 19.11: DefaultAtoms|EqAromatic and DefaultBonds
 
1605
Figure 19.12: DefaultAtoms|EqHalogen and DefaultBonds
 
1615
Figure 19.13: DefaultAtoms|EqONS and DefaultBonds
 
1625
Figure 19.14: DefaultAtoms|EqCAliphaticONS and DefaultBonds
 
1635

Similar modifiers exist for altering bond equivalency. Figure 19.15 shows an example where single and double bonds are considered identical when OEExprOpts.EqSingleDouble modifier is utilized.

Figure 19.15: DefaultAtoms and DefaultBonds|EqSingleDouble
 
1647

The last example in Figure 19.16 represents a very unrestrained search, where both the atom and bond expression options have weak discrimination power.

Figure 19.16: DefaultAtoms|EqAromatic|EqCAliphaticONS|EqHalogen|EqONS and DefaultBonds|EqSingleDouble
 
1658

Even though only maximum common substructure search examples are presented here, atom and bond expression options can be similarly used with substructure searches or clique detections. For a full description of expression options and their usage please refer to the OEExprOpts namespace section in the OEChem namespaces of the OEChem C++ API document.