.. _chapter_mdlreaction:

********************************************************************************
MDL Reaction Depiction
********************************************************************************

**OEDepict TK** also supports MDL reaction depiction.
The reaction being depicted has to be imported by calling the
:oe:func:`OEChem::OEReadMDLReactionQueryFile` function.
The rest of the process is identical to depicting a molecule.
First the :oe:func:`OEDepict::OEPrepareDepiction` function has to be
called to generate the 2D atom coordinates, then the image can be
created by rendering the imported reaction (:oe:func:`OEDepict::OERenderMolecule`)
(See examples in :ref:`Figure: Example of MDL reaction depiction<figure_mdlreaction>`)


.. oe:source:: DepictMDLReaction.py
   :language: python
   :refnum:   1
   :caption:  Example of reaction depiction
   :frag:     SNIPPET-DEPICTMDLREACTION

.. oe:source:: DepictMDLReaction.cpp
   :language: c++
   :refnum:   1
   :caption:  Example of reaction depiction
   :frag:     SNIPPET-DEPICTMDLREACTION

.. oe:source:: DepictMDLReaction.java
   :language: java
   :refnum:   1
   :caption:  Example of reaction depiction
   :frag:     SNIPPET-DEPICTMDLREACTION

.. oe:source:: DepictMDLReaction.cs
   :language: csharp
   :refnum:   1
   :caption:  Example of reaction depiction
   :frag:     SNIPPET-DEPICTMDLREACTION

.. _figure_mdlreaction:

.. figure:: images/DepictMDLReaction.*
   :align:  center

   **Example of MDL reaction depiction**

.. seealso::

   * :oe:func:`OEChem::OEReadMDLReactionQueryFile` function in the **OEChem TK** manual
   * :ref:`section_examples_summary_mdlreaction2img` example

The atom map information read from the reaction file can be depicted as
atom properties by using the :ref:`OEDisplayAtomMapIdx <OEDepict_OEDisplayAtomMapIdx>`
class.
(See examples in :ref:`Figure: Example of MDL reaction depiction with atom mapping<figure_mdlreaction_with_mapidx>`)

.. oe:source:: DepictMDLReactionMapIdx.py
   :language: python
   :refnum:   2
   :caption:  Example of reaction depiction with map indices
   :frag:     SNIPPET-DEPICTMDLREACTION-MAPIDX

.. oe:source:: DepictMDLReactionMapIdx.cpp
   :language: c++
   :refnum:   2
   :caption:  Example of reaction depiction with map indices
   :frag:     SNIPPET-DEPICTMDLREACTION-MAPIDX

.. oe:source:: DepictMDLReactionMapIdx.java
   :language: java
   :refnum:   2
   :caption:  Example of reaction depiction with map indices
   :frag:     SNIPPET-DEPICTMDLREACTION-MAPIDX

.. oe:source:: DepictMDLReactionMapIdx.cs
   :language: csharp
   :refnum:   2
   :caption:  Example of reaction depiction with map indices
   :frag:     SNIPPET-DEPICTMDLREACTION-MAPIDX

.. _figure_mdlreaction_with_mapidx:

.. figure:: images/DepictMDLReactionWithMapIdx.*
   :align:  center

   **Example of MDL reaction depiction with atom mapping**

.. seealso::

   * :oe:meth:`OEDepict::OE2DMolDisplayOptions::SetAtomPropertyFunctor` method
   * :oe:src:`Listing 5<SNIPPET-ATOM-PROP-INDEX-AtomPropIndex>` example in the
     :ref:`chapter_mol_display` chapter
