.. _section_examples_summary_mcsalign2D:

Aligning Molecule Based on MCS
================================================================================

A program that aligns molecules based on their maximum common substructure.


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> mcsalign2D --help

.. oe:language:: python

   .. code-block:: console

      prompt> python mcsalign2D.py --help

.. oe:language:: java

   .. code-block:: console

      prompt> java MCSAlign2D --help

.. oe:language:: csharp

   .. code-block:: console

      prompt> MCSAlign2D --help


will generate the following output:

.. code-block:: console

   Simple parameter list
    input/output options :
      -fit : Align filename
      -out : Output filename
      -ref : Ref filename

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

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

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

   .. only:: oepdf

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

      with interface file

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

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

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

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


   .. only:: oepdf

      .. oe:source:: mcsalign2D.py
         :language: python


.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

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

   .. only:: oepdf

      .. oe:source:: MCSAlign2D.java
         :language: java

      with interface file

      .. oe:source:: MCSAlign2D.txt
         :language: java

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

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

   .. only:: oepdf

      .. oe:source:: MCSAlign2D.cs
         :language: csharp


.. seealso::

   * :ref:`chapter_molalign` chapter

   * :oe:func:`OEChem::OEIs2DFormat` function
   * :oe:func:`OEDepict::OEPrepareDepiction` function
   * :ref:`OEMCSSearch <OEChem_OEMCSSearch>` class
   * :oe:func:`OEDepict::OEPrepareAlignedDepiction` function

Example
--------------------------------------------------------------------------------

.. oe:language:: c++

   .. code-block:: console

      prompt> mcsalign2D -ref ace1.ism -fit ace2.ism -out out.mol

.. oe:language:: python

   .. code-block:: console

      prompt> python mcsalign2D.py -ref ace1.ism -fit ace2.ism -out out.mol

.. oe:language:: java

   .. code-block:: console

      prompt> java MCSAlign2D -ref ace1.ism -fit ace2.ism -out out.mol

.. oe:language:: csharp

   .. code-block:: console

      prompt> MCSAlign2D -ref ace1.ism -fit ace2.ism -out out.mol

.. oe:language:: c++ python

   taking the output coordinates and generating the images with the
   **mol2img** program will produce the images shown in
   :ref:`Table: Example of using the program to align two molecules based on MCS <table_mcsalign2D>`.

.. oe:language:: java csharp

   taking the output coordinates and generating the images with the
   **Mol2Img** program will produce the images shown in
   :ref:`Table: Example of using the program to align two molecules based on MCS <table_mcsalign2D>`.

.. _table_mcsalign2D:

.. list-table:: Example of using the program to align two molecules based on MCS
   :widths: 100 100
   :header-rows: 1

   * - reference molecule
     - aligned molecule
   * - .. image:: images/mcsalign2D-out-ref.*
          :align:  center
     - .. image:: images/mcsalign2D-out-fit.*
          :align:  center

.. seealso::

   * :ref:`chapter_molalign` chapter
