.. _spruce_examples_find_pockets:

Finding pockets and their properties (like, Surface Area) from a PDB file
=========================================================================

This example shows how to find pockets in an input PDB file using the 
:oe:func:`OESpruce::OEFindPockets` function. OEDesignUnit file 
(:ref:`OEDesignUnit <OEBio_OEDesignUnit>`) can also be used as input to find the pockets.


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

This example uses an input PDB file, and will print surface area and list of residues 
for each found pocket in given PDB file.

.. code-block:: console

   prompt> findpockets <input protein molecule or DesignUnit file> 

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

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`findpockets.py <../../../../wrappers/python/examples/spruce/findpockets.py>`
         and the
         :download:`7mhf.pdb <../../../../wrappers/test_data/OESpruceTests/7mhf.pdb>`
         (the input PDB file),

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

   ..   literalinclude:: ../../../../wrappers/python/examples/spruce/findpockets.py

   .. only:: oepdf

      .. oe:source:: findpockets.py
         :language: python


.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`findpockets.cpp <../../../../sublibs/tklibs/spruce/examples/findpockets.cpp>`
         and the
         :download:`7mhf.pdb <../../../../wrappers/test_data/OESpruceTests/7mhf.pdb>`
         (the input PDB file),

   .. only:: oepdf

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


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

.. oe:language:: python

   .. code-block:: console

      prompt> findpockets.py 7mhf.pdb

   will generate the following output:

   ::

      pockets count: 1
      pocket_1 Residues count:  22
      pocket_1 Residues: 
      HOH 623   A 2  
      GLY 143   A 1  
      ASN 142   A 1  
      HOH 502   A 2  
      DMS 404   A 2  
      MET 165   A 1 A
      HOH 624   A 2  
      ASP 187   A 1  
      HOH 671   A 2  
      HOH 655   A 2  
      HOH 589   A 2  
      MET 49   A 1  
      HOH 782   A 2  
      ARG 188   A 1  
      THR 25   A 1  
      HIS 41   A 1  
      GLN 189   A 1  
      CYS 44   A 1  
      HOH 750   A 2  
      HOH 548   A 2  
      THR 45   A 1  
      SER 46   A 1  
      pocket_1 Surface Area:  211.0912322998047


.. oe:language:: c++

   .. code-block:: console

      prompt> findpockets 7mhf.pdb

   will generate the following output:

   ::

      pockets count: 1
      pocket_1Residues count: 22
      pocket_1Residues: 
      HOH 623
      GLY 143
      ASN 142
      HOH 502
      DMS 404
      MET 165
      HOH 624
      ASP 187
      HOH 671
      HOH 655
      HOH 589
      MET 49
      HOH 782
      ARG 188
      THR 25
      HIS 41
      GLN 189
      CYS 44
      HOH 750
      HOH 548
      THR 45
      SER 46
      pocket_1 Surface Area: 211.091


.. seealso::

   * :ref:`OEPocketOptions <OESpruce_OEPocketOptions>` class
