.. _flynn_theory:
.. include:: ../../apps-substitutions

Theory
======

Current methods of ligand fitting that are based on either
topological analysis of electron density [Menéndez-Velázquez-2003]_
global optimization of position and
conformation of a ligand in a density blob [Diller-1999]_
interatomic distance matrix [Koch-1974]_ [Cascarano-1991]_
or on varying torsion dihedral angles of shape-matched ligand
conformations [Oldfield-2001]_ are unable to prevent creation
of high energy, sometimes even chemically unrealistic, ligand
models. As a result, there are a number of PDB ligands with
unlikely, very high-energy structures [Perola-2004]_. For example,
the PDB
structure of an inhibitor of RNA polymerase in *1nhu* has significant
repulsion between the two methylene groups.

FLYNN is composed of two main components, location of ligand density and
ligand fitting.  Location of density generally works well with
clean density but there are times when ligand density is unclear
or not well resolved.  In the latter cases, the user should supply
a bounding box or simply just input the ligand density by itself
and use the density as is.

By default, FLYNN samples bioactive
conformations [Boström-2001]_ [Boström-2003]_ of the input ligand, however,
there are times when it might be desirable to input the ligand and
use it as is (see section :ref:`flynn_req_params` for more details).

Once the location of the ligand in the map and the conformations
have been selected, FLYNN then adapts the initial conformations
to the ligand density using a modern force-field, MMFF94
[Halgren-I-1996]_
[Halgren-II-1996]_
[Halgren-III-1996]_
[Halgren-IV-1996]_
[Halgren-V-1996]_
[Halgren-VI-1999]_
[Halgren-VII-1999]_


The potential function being used to adapt the ligand is

 :math:`V = V_{ff} + \lambda V_{shape}`

where :math:`V_{ff}` represents the internal energy of the ligand and
:math:`V_{shape}`
is the overlap between the ligand and the electron density.  :math:`\lambda`
is a mixing parameter that represents the degree to which the shape of
the density dominates the combined potential during the current optimization step [Wlodek-2006]_.

The strain placed on the ligand is bounded while the function
is optimized producing high-quality fits with low-strain ligand
conformations.

Fragment Fitting
----------------

Fragments are fit taking the input fragment cocktail and, one at a
time, fitting each fragment against each region of detected density.
Once a fragment has been placed, it is further analyzed to ensure that
all possible orientations of the fragment have been sampled.  In poor
density, several orientations may fit equally well.  To break ties,
FLYNN scores each pose with the following scores:

 o RSCC (real space correlation coefficient)  This is a measure of fit to electron density (higher is better). [Jones-1991]_

 o PLP Piecewise-linear potential (lower is better).  [Verkhivker-2000]_

 o Chemscore (lower is better). [Eldridge-1997]_

The docking scores are not used to fit the molecule, they are only
used to rank the output.  Unless highly symmetric molecules are being
input, the real space correlation coefficient (RSCC) is the preferred
method of ranking results to density.

To use fragment mode, please add the "-fragment" option to the command
line.  In future versions of FLYNN, this will most likely become the
default setting.

The output of the fragment fitting process is a file for each density
region that includes the fragments fit to the region sorted from
best-fit to worst fit.  For example:

.. code-block:: bash

   prompt> flynn -in fragments.smi -out 2IKO_cocktail.sdf ...

would result in the files:

.. code-block:: bash

  2IKO_cocktail_blob001.sdf
  2IKO_cocktail_blob002.sdf
  2IKO_cocktail_blob003.sdf

one for each blob found.  By default, the first molecule in the file is the best
fit to the density (RSCC):

    :math:`RSCC = \frac{\Sigma |p_{obs} - <p_{obs}>| \Sigma |p_{calc} - <p_{calc}>|}{(\Sigma |p_{obs} - <p_{obs}>|^2 \Sigma |p_{calc} - <p_{calc}>|^2)^\frac{1}{2}}` [Jones-1991]_

where obs refers to the experimental electron density and calc refers
to the calculated electron density sampled from grid points around
the residue being scored.  The experimental density is usually the
sigma weighted difference map when loading an MTZ map.  The calculated
density is generated by simulating scattering of the ligand
conformation with bfactors set to 20.

To sort using another measure, for instance, PLP, use the sort flag:

.. code-block:: bash

   prompt> flynn -sortBy plp -in fragments.smi -out 2IKO_cocktail.sdf ...

.. note::

  The *-sortBy* flag can be used in non-fragment mode as well.
