.. include:: ../../toolkit-substitutions

.. oe:namespace:: OESpruce

.. meta::
   :keywords: OEBuildLoops

..  _OESpruce_OEBuildLoops:

.. oe:function:: OEBuildLoops


   .. attention::

      |TWOLANGUAGE|

   These functions build missing loops and tails in protein structures. They return false if any of the loops or tails cannot be built, but it
   will return with as many built loops and tails as possible.
   The functions require a loop database be provided in the options class. Using the **loopdb_builder** application it
   is possible to build your own database for a given target family, or a set of proprietary structure. OpenEye provides
   a database built of the structures in the entire PDB repository at the time of toolkit release. The datastamps are noted in
   the info table and logged during loop building. It is possible to append local/proprietary structures to this database if desired,
   again using the desktop application.
   The options class allows different behaviors for the loop builder.

   .. note::

      Explicit hydrogens are not added to the structure during the build processes, therefore no partial charges are assigned.

   .. oe:language:: c++ java csharp

      .. oe:api::

         bool OEBuildLoops(OEChem::OEMolBase& mol,
                           const OESidechainBuilderOptions& scOpts = OESidechainBuilderOptions(),
                           const OELoopBuilderOptions& lOpts = OELoopBuilderOptions())

   .. oe:language:: python

      .. oe:api:: python

         OEBuildLoops(du: OEDesignUnit,
                      scOpts: OESidechainBuilderOptions = OESidechainBuilderOptions(),
                      lOpts: OELoopBuilderOptions = OELoopBuilderOptions()) -> bool
         OEBuildLoops(mol: Union[OEGraphMol,OEMol,OEQMol],
                      scOpts: OESidechainBuilderOptions = OESidechainBuilderOptions(),
                      lOpts: OELoopBuilderOptions = OELoopBuilderOptions()) -> bool

   This function takes a molecule and builds any missing loops that can be detected based on the information
   in the PDB header metadata. The function also takes options classes for the loop building, but also for the side-chain re-building,
   in case the loop in the database is not a 100% identity match. The function calls OEOmega to generate possible conformations for tails.

   .. oe:api: IGNORE

      bool OEBuildLoops(OEBio::OEDesignUnit& du,
                             const OESidechainBuilderOptions& scOpts=OESidechainBuilderOptions(),
                             const OELoopBuilderOptions& lOpts=OELoopBuilderOptions())

   .. oe:language:: c++ java csharp

      .. oe:api::

         bool OEBuildLoops(OEChem::OEMolBase& mol,
                           const OEStructureMetadata& data,
                           const OESidechainBuilderOptions& scOpts = OESidechainBuilderOptions(),
                           const OELoopBuilderOptions& lOpts = OELoopBuilderOptions())

   .. oe:language:: python

      .. oe:api:: python

         OEBuildLoops(du: OEDesignUnit, data: OEStructureMetadata,
                      scOpts: OESidechainBuilderOptions = OESidechainBuilderOptions(),
                      lOpts: OELoopBuilderOptions = OELoopBuilderOptions()) -> bool
         OEBuildLoops(mol: Union[OEGraphMol,OEMol,OEQMol],
                      data: OEStructureMetadata,
                      scOpts: OESidechainBuilderOptions = OESidechainBuilderOptions(),
                      lOpts: OELoopBuilderOptions = OELoopBuilderOptions()) -> bool

   This function works identically to the above function, only metadata is explicitly provided containing information
   about the sequence, so gaps can be detected.

   .. oe:api: IGNORE

      bool OEBuildLoops(OEBio::OEDesignUnit& du,
                             const OEStructureMetadata& data,
                             const OESidechainBuilderOptions& scOpts=OESidechainBuilderOptions(),
                             const OELoopBuilderOptions& lOpts=OELoopBuilderOptions())

   The input ``mol`` must have 3D coordinates assigned.

   .. seealso::

      * :ref:`OEMakeDesignUnitOptions <OESpruce_OEMakeDesignUnitOptions>` class
      * :ref:`OEDesignUnitPrepOptions <OESpruce_OEDesignUnitPrepOptions>` class
      * :ref:`OEDesignUnitBuildOptions <OESpruce_OEDesignUnitBuildOptions>` class
      * :ref:`OELoopBuilderOptions <OESpruce_OELoopBuilderOptions>` class
      * :ref:`OESidechainBuilderOptions <OESpruce_OESidechainBuilderOptions>` class
      * :oe:constns:`OEBio::OERotamerLibrary` namespace
      * :ref:`OEStructureMetadata <OESpruce_OEStructureMetadata>` class
      * :oe:func:`OESpruce::OEBuildSingleLoop` function
