.. include:: ../../common/cookbook/cookbook-hyperlinks

.. oe:namespace:: OEGrapheme

.. meta::
   :keywords: OEDrawPeptide

.. oe:function:: OEDrawPeptide

   .. oe:language:: c++ java csharp

      .. oe:api::

         bool OEDrawPeptide(OEDepict::OEImageBase& image,
                            const OEChem::OEMolBase& mol)
         bool OEDrawPeptide(OEDepict::OEImageBase& image,
                            const OEChem::OEMolBase& mol,
                            const OEPeptideDisplayOptions& opts)

   .. oe:language:: python

      .. oe:api:: python

         OEDrawPeptide(image: OEImageBase, mol: Union[OEGraphMol,OEMol,OEQMol]) -> bool
         OEDrawPeptide(image: OEImageBase, mol: Union[OEGraphMol,OEMol,OEQMol],
                       opts: OEPeptideDisplayOptions) -> bool

   Draws a molecule after performing substitutions in which standard
   amino acids components identified in the molecule are replaced by
   corresponding circular glyphs.

   *image*
     The image on which the molecule is drawn.

   *mol*
      The molecule being depicted.

   *opts*
      The :ref:`OEPeptideDisplayOptions <OEGrapheme_OEPeptideDisplayOptions>` object that stores
      properties that determine the styles of the peptide depiction.

   .. note::

      * The :oe:func:`OEGrapheme::OEDrawPeptide` implementation does not support
        visualizing large proteins. The number of heavy atoms is limited to 250.
      * The :oe:func:`OEGrapheme::OEDrawPeptide` only support standard  L-amino acids and there
        D-amino acid enantiomers.

   **Example:**

   The following code snippet shows how to use the :oe:func:`OEGrapheme::OEDrawPeptide`
   function to generate an interactive SVG image. The image created is shown in
   :ref:`Figure: Example of using the OEDrawPeptide function<figure_draw_peptide>`.

   .. oe:source:: DrawPeptide.py
      :language: python
      :noindent:
      :frag:     SNIPPET-DRAW-PEPTIDE

   ..    oe:language:: python

         :ref:`Full listing. <listing-DrawPeptide.py>`

   .. oe:source:: DrawPeptide.cpp
      :language: c++
      :noindent:
      :frag:     SNIPPET-DRAW-PEPTIDE

   .. oe:source:: DrawPeptide.java
      :language: java
      :noindent:
      :frag:     SNIPPET-DRAW-PEPTIDE

   .. oe:source:: DrawPeptide.cs
      :language: csharp
      :noindent:
      :frag:     SNIPPET-DRAW-PEPTIDE

   .. _figure_draw_peptide:

   .. only:: oehtml

      .. raw:: html

         <p align="center">
         <b>hover mouse over any amino acid circles</b>
         </p>

         <p align="center">
         <object data="../../_images/DrawPeptide.svg" type="image/svg+xml"  width = "500" ></object>
         <p>

         <p align="center">
         <b>Example of using the OEDrawPeptide function to generate an interactive SVG image</b>
         <p>

      .. image:: ../images/DrawPeptide.svg
         :width: 1pt

   .. only:: oepdf

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

         **Example of using the OEDrawPeptide function**


   .. note::

      This `interactive` functionality is **only available** for :file:`.svg`
      image format.

      The generated :file:`svg` image should be included into and
      HTML page with the SVG MIME type.

      .. code-block:: console

         <object data="<imagename>.svg" type="image/svg+xml"></object>

   .. seealso::

      * :ref:`OEPeptideDisplayOptions <OEGrapheme_OEPeptideDisplayOptions>` class
      * :oe:func:`OEGrapheme::OEDrawResidues` function to depict residues of peptides
      * :oe:func:`OEGrapheme::OEDrawMonomerGraph` and :oe:func:`OEGrapheme::OEHighlightMonomers` functions to depict molecules initialized from HELM
      * :ref:`chapter_svg` chapter in **OEDepict TK** manual
