.. _spruce_examples_extract_biounits_remarks:

Extracting Biounits from PDB header remarks
============================================

Biounit (BU) extraction is one of the more basic functionalities offered through the
**Spruce TK**.  This example shows how to extract BUs using the PDB header remarks.

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

This example takes in a PDB file, and optionally the maximum number of atoms to be
considered a BU as well as a boolean flag to instruct the code to prefer author or
software generated headers (see :oe:func:`OESpruce::OEExtractBioUnits` for details on the API).

.. code-block:: console

   prompt> extract_biounits_remarks <extract protein PDB> [max atoms] [prefer author]

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

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`extract_biounits_remarks.py <../../../../wrappers/python/examples/spruce/extract_biounits_remarks.py>`
         and
         :download:`4re6.pdb <../../../../sublibs/tklibs/spruce/tests/data/4re6.pdb>`
         (the extraction PDB file)


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

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

   .. only:: oepdf

      .. oe:source:: extract_biounits_remarks.py
         :language: python


.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`extract_biounits_remarks.cpp <../../../../sublibs/tklibs/spruce/examples/extract_biounits_remarks.cpp>`
         and
         :download:`4re6.pdb <../../../../sublibs/tklibs/spruce/tests/data/4re6.pdb>`
         (the extraction PDB file)

   .. only:: oepdf

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


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

.. oe:language:: c++

   .. code-block:: console

      prompt> extract_biounits_remarks 4re6.pdb

.. oe:language:: python

   .. code-block:: console

      prompt> extract_biounits_remarks.py 4re6.pdb

will generate the following output:

::

   Writing biounit 0 to 4re6_BU_0.oeb.gz
   Writing biounit 1 to 4re6_BU_1.oeb.gz

.. seealso::

   * :oe:func:`OESpruce::OEExtractBioUnits` function
   * :ref:`OEBioUnitExtractionOptions <OESpruce_OEBioUnitExtractionOptions>` class
