.. _section_examples_summary_match2img:

Depicting Substructure Search Match
================================================================================

A program that performs a substructure search initialized
with the given SMARTS pattern and highlights the identified
matches on the depicted molecule.


Command Line Interface
--------------------------------------------------------------------------------

A description of the command line interface can be obtained by
executing the program with the --help argument.

.. oe:language:: c++

   .. code-block:: console

      prompt> match2img --help

.. oe:language:: python

   .. code-block:: console

      prompt> python match2img.py --help

.. oe:language:: java

   .. code-block:: console

      prompt> java Match2Img --help

.. oe:language:: csharp

   .. code-block:: console

      prompt> Match2Img --help

will generate the following output:

.. code-block:: console

   Simple parameter list
    highlight options :
      -highlightcolor : Highlighting color
      -highlightstyle : Highlighting style

    image options :
      -height : Height of output image
      -width : Width of output image

    input/output options :
      -in : Input filename
      -out : Output filename
      -smarts : SMARTS pattern

    molecule display options :
      -aromstyle : Aromatic ring display style
      -atomcolor : Atom coloring style
      -atomlabelfontscale : Atom label font scale
      -atomprop : Atom property display
      -atomstereostyle : Atom stereo display style
      -bondcolor : Bond coloring style
      -bondprop : Bond property display
      -bondstereostyle : Bond stereo display style
      -hydrstyle : Hydrogen display style
      -linewidth : Default bond line width
      -protgroupdisp : Protective group display style
      -scale : Scaling of the depicted molecule
      -superdisp : Super atom display style
      -titleloc : Location of the molecule title

    prepare depiction options :
      -clearcoords : Clear and regenerate 2D coordinates of molecule(s)
      -orientation : Set the preferred orientation of 2D coordinates
      -suppressH : Suppress explicit hydrogens of molecule(s)

Code
--------------------------------------------------------------------------------

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`match2img.cpp <../../../../sublibs/tklibs/depict/examples/match2img.cpp>`
         and
         :download:`match2img.txt <../../../../sublibs/tklibs/depict/examples/match2img.txt>`
         interface file

   .. only:: oepdf

      .. oe:source:: match2img.cpp
         :language: c++

      with interface file

      .. oe:source:: match2img.txt
         :language: c++

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`match2img.py <../../../../wrappers/python/examples/depict/match2img.py>`

      .. literalinclude:: ../../../../wrappers/python/examples/depict/match2img.py


   .. only:: oepdf

      .. oe:source:: match2img.py
         :language: python


.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`Match2Img.java <../../../../wrappers/java/examples/openeye/examples/oedepict/Match2Img.java>`
         and
         :download:`Match2Img.txt <../../../../wrappers/java/examples/openeye/examples/oedepict/Match2Img.txt>`
         interface file

   .. only:: oepdf

      .. oe:source:: Match2Img.java
         :language: java

      with interface file

      .. oe:source:: Match2Img.txt
         :language: java

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`Match2Img.cs <../../../../wrappers/csharp/Csharp-Examples/OEDepict/Match2Img.cs>`

   .. only:: oepdf

      .. oe:source:: Match2Img.cs
         :language: csharp

.. seealso::

   * :oe:func:`OEDepict::OEConfigureImageOptions` function
   * :oe:func:`OEDepict::OEConfigurePrepareDepictionOptions` function
   * :oe:func:`OEDepict::OEConfigure2DMolDisplayOptions` function
   * :oe:func:`OEDepict::OEConfigureHighlightParams` function
   * :oe:func:`OEDepict::OESetup2DMolDisplayOptions` function
   * :ref:`OESubSearch <OEChem_OESubSearch>` class
   * :ref:`OEPrepareDepictionOptions <OEDepict_OEPrepareDepictionOptions>` class
   * :oe:func:`OEDepict::OESetupPrepareDepictionOptions` function
   * :oe:func:`OEDepict::OEPrepareDepiction` function
   * :oe:func:`OEDepict::OEGetImageWidth` and :oe:func:`OEDepict::OEGetImageHeight` functions
   * :ref:`OE2DMolDisplayOptions <OEDepict_OE2DMolDisplayOptions>` class
   * :oe:func:`OEDepict::OESetup2DMolDisplayOptions` function
   * :ref:`OE2DMolDisplay <OEDepict_OE2DMolDisplay>` class
   * :oe:func:`OEDepict::OEGetHighlightStyle` and :oe:func:`OEDepict::OEGetHighlightColor` functions
   * :oe:func:`OEChem::OEPrepareSearch` function
   * :oe:func:`OEDepict::OEAddHighlighting` function
   * :oe:func:`OEDepict::OERenderMolecule` function

Examples
--------------------------------------------------------------------------------

.. oe:language:: c++

   .. code-block:: console

      prompt> match2img -in indole.ism -out image.png -smarts "c1ccccc1"

.. oe:language:: python

   .. code-block:: console

      prompt> python match2img.py -in indole.ism -out image.png -smarts "c1ccccc1"

.. oe:language:: java

   .. code-block:: console

      prompt> java Match2Img -in indole.ism -out image.png -smarts "c1ccccc1"

.. oe:language:: csharp

   .. code-block:: console

      prompt> Match2Img -in indole.ism -out image.png -smarts "c1ccccc1"


will generate the image shown in
:ref:`Figure: Example of using the program with default highlighting<figure_match2img_01>`

.. _figure_match2img_01:

.. figure:: images/match2img-01.*
   :align:  center

   **Example of using the program with default highlighting**


.. -----------------------------------------------------------------------------

.. oe:language:: c++

   .. code-block:: console

      prompt> match2img -in indole.ism -out image.png -smarts "c1ccccc1" -highlightcolor green

.. oe:language:: python

   .. code-block:: console

      prompt> python match2img.py -in indole.ism -out image.png -smarts "c1ccccc1" -highlightcolor green

.. oe:language:: java

   .. code-block:: console

      prompt> java Match2Img -in indole.ism -out image.png -smarts "c1ccccc1" -highlightcolor green

.. oe:language:: csharp

   .. code-block:: console

      prompt> Match2Img -in indole.ism -out image.png -smarts "c1ccccc1" -highlightcolor green


will generate the image shown in
:ref:`Figure: Example of using the program with green highlighting<figure_match2img_02>`

.. _figure_match2img_02:

.. figure:: images/match2img-02.*
   :align:  center

   **Example of using the program with green highlighting**


.. -----------------------------------------------------------------------------

.. oe:language:: c++

   .. code-block:: console

      prompt> match2img -in indole.ism -out image.png -smarts "c1ccccc1" -highlightstyle BallAndStick

.. oe:language:: python

   .. code-block:: console

      prompt> python match2img.py -in indole.ism -out image.png -smarts "c1ccccc1" -highlightstyle BallAndStick

.. oe:language:: java

   .. code-block:: console

      prompt> java Match2Img -in indole.ism -out image.png -smarts "c1ccccc1" -highlightstyle BallAndStick

.. oe:language:: csharp

   .. code-block:: console

      prompt> Match2Img -in indole.ism -out image.png -smarts "c1ccccc1" -highlightstyle BallAndStick


will generate the image shown in
:ref:`Figure: Example of using the program with ball and stick<figure_match2img_03>`

.. _figure_match2img_03:

.. figure:: images/match2img-03.*
   :align:  center

   **Example of using the program with ball and stick highlighting**


.. seealso::

   * :ref:`chapter_highlighting` chapter
