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

.. _section_examples_summary_bfactor2img:

Depicting BFactor
================================================================================

A program that depicts the B-factor of a ligand and its environment.

.. seealso::

   * `Visualizing Protein-Ligand B-Factor`_  **OpenEye Python Cookbook** example
   * `Visualizing Protein-Ligand B-Factor Map`_  **OpenEye Python Cookbook** example

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

.. oe:language:: python

   .. code-block:: console

      prompt> python bfactor2img.py --help

.. oe:language:: java

   .. code-block:: console

      prompt> java BFactor2Img --help

.. oe:language:: csharp

   .. code-block:: console

      prompt> BFactor2Img --help

will generate the following output:

::

    [-complex] <input> [-out] <output pdf>

    Simple parameter list
        -height : Height of output image
        -width : Width of output image

        SplitMolComplex options :
          -ligandname : Ligand name

        input/output options
          -complex : Input filename of the protein complex
          -out : Output filename

        molecule display options
          -aromstyle : Aromatic ring display style

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

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`bfactor2img.py <../../../../wrappers/python/examples/grapheme/bfactor2img.py>`

      .. literalinclude:: ../../../../wrappers/python/examples/grapheme/bfactor2img.py

   .. only:: oepdf

      .. oe:source:: bfactor2img.py
         :language: python

.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`bfactor2img.cpp <../../../../sublibs/tklibs/grapheme/examples/bfactor2img.cpp>`
         and
         :download:`bfactor2img.txt <../../../../sublibs/tklibs/grapheme/examples/bfactor2img.txt>`
         interface file

   .. only:: oepdf

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

      With the bfactor2img.txt interface file

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

.. oe:language:: java

   .. only:: oehtml

      .. admonition:: Download code

         :download:`BFactor2Img.java <../../../../wrappers/java/examples/openeye/examples/oegrapheme/BFactor2Img.java>`
         and
         :download:`BFactor2Img.txt <../../../../wrappers/java/examples/openeye/examples/oegrapheme/BFactor2Img.txt>`
         interface file

   .. only:: oepdf

      .. oe:source:: BFactor2Img.java
         :language: java

      With the BFactor2Img.txt interface file

      .. oe:source:: BFactor2Img.txt
         :language: java

.. oe:language:: csharp

   .. only:: oehtml

      .. admonition:: Download code

         :download:`BFactor2Img.cs <../../../../wrappers/csharp/Csharp-Examples/OEGrapheme/BFactor2Img.cs>`

   .. only:: oepdf

      .. oe:source:: BFactor2Img.cs
         :language: csharp

.. seealso::

   * :oe:func:`OEBio::OESplitMolComplex` function in **OEChem TK**
   * :ref:`OENearestNbrs <OEChem_OENearestNbrs>` class in **OEChem TK**
   * :oe:func:`OEGrapheme::OEPrepareDepictionFrom3D` function
   * :ref:`OESurfaceArcFxnBase <OEGrapheme_OESurfaceArcFxnBase>` class and
     :oe:func:`OEGrapheme::OEDraw2DSurface` function
   * :ref:`OEAtomGlyphBase <OEGrapheme_OEAtomGlyphBase>` class and
     :oe:func:`OEGrapheme::OEAddGlyph` function

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

.. oe:language:: c++

   .. code-block:: console

      prompt> bfactor2img -complex 1MEH.pdb -ligandname MOA -out MOA.png

.. oe:language:: python

   .. code-block:: console

      prompt> python bfactor2img.py -complex 1MEH.pdb -ligandname MOA -out MOA.png

.. oe:language:: java

   .. code-block:: console

      prompt> java BFactor2Img -complex 1MEH.pdb -ligandname MOA -out MOA.png

.. oe:language:: csharp

   .. code-block:: console

      prompt> BFactor2Img -complex 1MEH.pdb -ligandname MOA -out MOA.png


will generate the following output:

::

    Average BFactor of the complex = +32.721
    Minimum BFactor of the ligand and its environment = +21.500
    Maximum BFactor of the ligand and its environment = +72.060

and the image shown in
:ref:`Figure: Example of depicting the BFactor of MOA and its environment<figure_bfactor2img_MOA>`.

.. _figure_bfactor2img_MOA:

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

   **Example of depicting the BFactor of MOA and its environment**


.. oe:language:: c++

   .. code-block:: console

      prompt> bfactor2img -complex 1LEE.pdb -ligandname R36 -out R36.png

.. oe:language:: python

   .. code-block:: console

      prompt> python bfactor2img.py -complex 1LEE.pdb -ligandname R36 -out R36.png

.. oe:language:: java

   .. code-block:: console

      prompt> java BFactor2Img -complex 1LEE.pdb -ligandname R36 -out R36.png

.. oe:language:: csharp

   .. code-block:: console

      prompt> BFactor2Img -complex 1LEE.pdb -ligandname R36 -out MOA.R36


will generate the following output:

::

    Average BFactor of the complex = +23.754
    Minimum BFactor of the ligand and its environment = +6.040
    Maximum BFactor of the ligand and its environment = +32.050


and the image shown in
:ref:`Figure: Example of depicting the BFactor of R36 and its environment<figure_bfactor2img_R36>`.

.. _figure_bfactor2img_R36:

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

   **Example of depicting the BFactor of R36 and its environment**
