2D Coordinate Generation¶
The OEGenerate2DCoordinates function OEChem TK‘s depiction algorithm is capable of assigning 2D coordinates to molecules and reactions. See Figure: Schematic representation of the steps of the 2D coordinate generation. The algorithm uses a built-in ring template dictionary to provide aesthetically pleasing 2D layouts for complex macro-cycles. In case when no built-in template exists, the 2D coordinates of the ring system are generated on-the-fly. After laying out the ring system(s), the algorithm assigns coordinates for acyclic chains and functional groups. In the last step, the algorithm attempts to resolve atom clashes using a variety of heuristics.
This built-in dictionary currently contains about 3000 ring-systems that frequently occur in drug-like databases. New ring templates are continuously being added with each release.
To improve the depiction of the ring systems, please run the Extract 2D ring templates script on a 2D molecule file and send the results to firstname.lastname@example.org. OpenEye will be happy to incorporate the new ring systems in the built-in dictionary in the next release of the toolkits.
OEGenerate2DCoordinates is a low-level function that only assigns 2D coordinates to the given molecule. It is highly recommended to use the OEPrepareDepiction function of OEDepict TK when generating 2D coordinates for molecular depiction. The OEPrepareDepiction function, apart from assigning 2D coordinates also does the following:
- suppresses or adds explicit hydrogens
- perceives atom and bond stereo information
- optimizes the 2D coordinates for horizontal or vertical rendering
User-Defined Ring Dictionary¶
OEChem TK also allows the customization of the 2D coordinate generation process by providing functionality to extract ring templates from 2D molecule files, build user-defined ring dictionaries, and then plug them into the 2D coordinate generation engine.
The following are the steps to define your own ring dictionaries:
Building a ring dictionary from scratch
Example code : Create 2D ring dictionary
Adding new ring templates to an existing ring dictionary
Example code : Append 2D ring dictionary
Generating 2D coordinates with custom ring templates
Example code : Generate 2D coordinates with user-defined ring templates