# MDL Query Depiction¶

In order to depict an MDL query the query molecule has to be imported by calling the OEReadMDLQueryFile function. The rest of the process is identical to depicting a molecule. First the OEPrepareDepiction function has to be called to generate the 2D atom coordinates, then the image can be created by rendering the molecule (OERenderMolecule).

Listing 1: Example of MDL query depiction

if len(sys.argv) != 3:
oechem.OEThrow.Usage("%s <mdlquery> <imagefile>" % sys.argv[0])

ifs = oechem.oemolistream(sys.argv[1])
qmol = oechem.OEGraphMol()
oedepict.OEPrepareDepiction(qmol)
oedepict.OERenderMolecule(sys.argv[2], qmol)


OEReadMDLQueryFile function in the OEChem TK manual

## Atom Query Features¶

The depiction of the following MDL atom query features is supported:

1. The 8th column in the atom block is used to define the number of allowed hydrogens for an atom. (See examples in Table: Example of depicting hydrogen count)

• (H0) means no hydrogen atoms allowed unless explicitly drawn.
• (Hn) means atom must have n or more implicit hydrogen(s)
Examples of depicting hydrogen count
query
2. Query atom types:

• A = any atom type except hydrogen
• Q = any atom type except hydrogen and carbon
• L = atom list

The M  ALS line in the property block is used to list alternative atom types for an atom. (See examples in Table: Examples of depicting query atom types)

Examples of depicting query atom types
query target target target
3. M  CHG line in the property block is used to define atom formal charges. (See examples in Table: Example of depicting formal charge)

Examples of depicting formal charge
query target target
4. M  RBC line in the property block is used to limit the number of allowed ring bonds attached to an atom. (See examples in Table: Example of depicting ring count)

• (r0) means no ring bond allowed
• (r*) means as drawn
• (rn) means n number of ring bonds allowed
Examples of depicting ring count
query target target
5. M  SUB line in the property block is used set the number of allowed substitutions of an atom. (See examples in Table: Examples of depicting substitution count)

• (s0) means no substitution allowed
• (s*) means as drawn
• (sn) means n number of substitution(s) allowed
Examples of depicting substitution count
query target target
6. M  UNS line in the property block is used to specify whether or not an atom is unsaturated, i.e., having at least one multiple bond. (See examples in Table: Examples of depicting unsaturated property)

Examples of depicting unsaturated property
query target target

## Bond Query Features¶

The depiction of the following MDL bond query features is supported:

1. Alternative bond types in the bond block (4 = aromatic, 5 = single or double, 6 = single or aromatic, 7 = double or aromatic, 8 = any bond). (See examples in Table: Examples of depicting query bond types)

Examples of depicting query bond types
query target target target

2. The 6th column in the atom block describes bond topology. (See examples in Table: Examples of depicting bond topology)

• (rn) means that it can only mapped to ring bond
• (ch) means that it can only mapped to chain bond
Examples of depicting bond topology
query target target
3. Double bond stereochemistry is considered if both ends of the bond are marked with stereo care flags in the atom block. (See examples in Table: Examples of depicting bond stereo care)

Examples of depicting bond stereo care
query target target