.. _spruce_examples_superposition:

Calculating superposition
=================================

The superposition calculation is a functionality offered through the
**Spruce TK**.  This example shows how to calculate structural superposition using
either the global, DDM, weighted-DDM, site sequence, or SSE methods.


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

This example takes in a reference and a fit protein (from either a PDB or OEDU file) and aligns them with one of the supported methods 
(see :oe:constns:`OESpruce::OESuperposeMethod` for methods and descriptions).

.. code-block:: console

   prompt> superpose <reference protein PDB> <fit protein PDB> [global|ddm|weighted|sse|site] [site-residue file]

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

.. oe:language:: python

   .. only:: oehtml

      .. admonition:: Download code

         :download:`superpose.py <../../../../wrappers/python/examples/spruce/superpose.py>`
         and both
         :download:`1A29.pdb <../../../../sublibs/tklibs/spruce/tests/data/1A29.pdb>`
         (the reference PDB file)
         and
         :download:`1CLL.pdb <../../../../sublibs/tklibs/spruce/tests/data/1CLL.pdb>`
         (the fit PDB file)

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

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

   .. only:: oepdf

      .. oe:source:: superpose.py
         :language: python


.. oe:language:: c++

   .. only:: oehtml

      .. admonition:: Download code

         :download:`superpose.cpp <../../../../sublibs/tklibs/spruce/examples/superpose.cpp>`
         and both
         :download:`1A29.pdb <../../../../sublibs/tklibs/spruce/tests/data/1A29.pdb>`
         (the reference PDB file)
         and
         :download:`1CLL.pdb <../../../../sublibs/tklibs/spruce/tests/data/1CLL.pdb>`
         (the fit PDB file)

   .. only:: oepdf

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


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

.. oe:language:: c++

   .. code-block:: console

      prompt> superpose 1A29.pdb 1CLL.pdb ddm

.. oe:language:: python

   .. code-block:: console

      prompt> superpose.py 1A29.pdb 1CLL.pdb ddm

will generate the following output:

::

   Superposing 1CLL.pdb to 1A29.pdb using ddm
   Writing superimposed fit protein to 1CLL_sp.oeb.gz
   RMSD: 0.596203 Angstroms
   SeqScore: 642

.. seealso::

   * :ref:`OESuperpose <OESpruce_OESuperpose>` class
   * :ref:`OESuperposeOptions <OESpruce_OESuperposeOptions>` class
   * :ref:`OESuperposeResults <OESpruce_OESuperposeResults>` class
   * :oe:constns:`OESpruce::OESuperposeMethod` namespace
