.. # split by hand

.. include:: ../substitutions

.. oe:namespace:: OEBio

.. meta::
   :keywords: OECombineMolComplexFragments

.. oe:function:: OECombineMolComplexFragments

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

      .. oe:api::

         bool OECombineMolComplexFragments(OEChem::OEMolBase& dst,
                                           const std::vector<OEChem::OEAtomBondSet>& frags,
                                           const OESplitMolComplexOptions& opt = OESplitMolComplexOptions())
         bool OECombineMolComplexFragments(OEChem::OEMolBase& dst,
                                           const std::vector<OEChem::OEAtomBondSet>& frags,
                                           const OESplitMolComplexOptions& opt,
                                           const OESystem::OEUnaryPredicate<OESystem::OERoleSet>& filter,
                                           OEChem::OEAtomBase** atomMap = NULL,
                                           OEChem::OEBondBase** bondMap = NULL)

   .. oe:language:: python

      .. oe:api:: python

         OECombineMolComplexFragments(dst: Union[OEGraphMol,OEMol,OEQMol],
                                      frags: OEAtomBondSetVector,
                                      opt: OESplitMolComplexOptions = OESplitMolComplexOptions()) -> bool
         OECombineMolComplexFragments(dst: Union[OEGraphMol,OEMol,OEQMol],
                                      frags: OEAtomBondSetVector,
                                      opt: OESplitMolComplexOptions,
                                      filter: OEUnaryRoleSetPred,
                                      atomMap: OEAtomBase = None,
                                      bondMap: OEBondBase = None) -> bool

   Constructs a (subset) molecule ``dst`` from
   the input :ref:`OEAtomBondSet <OEChem_OEAtomBondSet>` vector ``frags``.
   The optional :ref:`OESplitMolComplexOptions <OEBio_OESplitMolComplexOptions>` object
   controls this process. If an explicit ``filter`` is not provided,
   the filter returned by the :ref:`OESplitMolComplexOptions <OEBio_OESplitMolComplexOptions>` method
   :oe:meth:`GetCombinedFilter<OEBio::OESplitMolComplexOptions::GetCombinedFilter>`
   method will be used. You can generate your own filters,
   see :ref:`section_split_mol_complex`.

   Using an :oe:cls:`OEAtomBondSet<OEChem::OEAtomBondSet>` vector and then
   filtering several times to produce molecules can be much more efficient
   compared to using the :oe:func:`OEBio::OESplitMolComplex` or
   :oe:func:`OEBio::OEGetMolComplexComponents` functions.

   Any molecules returned have been given titles.
   Protein chains are given a shortened version of the input title
   combined with the chain ID. Small molecule titles are
   residue names. Molecules with more than one residue are combined
   with a ``-`` if they are covalently attached, and a ``.`` if not.
   Residue names are not repeated. So, a single two residue
   molecule combined with any number of waters might have
   the title ``XYZ-ABC.HOH``.
   Output molecules may have *SD Tags* to indicate they include
   a covalent ligand.

   Atom and bond maps may be provided as a way to map from the original
   ``mol`` used to generate the :ref:`OEAtomBondSet <OEChem_OEAtomBondSet>` vector
   to the ``dst`` molecule. They are arrays of pointers of size
   :oe:meth:`GetMaxAtomIdx<OEChem::OEMolBase::GetMaxAtomIdx>` and
   :oe:meth:`GetMaxBondIdx<OEChem::OEMolBase::GetMaxBondIdx>`,
   respectively, indexed by atom and bond
   indices (using :oe:meth:`OEChem::OEAtomBase::GetIdx` and
   :oe:meth:`OEChem::OEBondBase::GetIdx`).

   Returns ``false`` if the task could not performed.
   To check if the filter identified any atoms,
   check the number of atoms in ``dst``.

   .. seealso::

      * :ref:`section_split_mol_complex` section
      * :oe:func:`OEBio::OEGetMolComplexFragments` function
      * :ref:`OEAtomBondSet <OEChem_OEAtomBondSet>` class
      * :ref:`OESplitMolComplexOptions <OEBio_OESplitMolComplexOptions>` class
      * :ref:`OEMolComplexFilter <OEBio_OEMolComplexFilter>` class
      * :oe:meth:`OEBio::OESplitMolComplexOptions::GetLigandFilter` method
      * :oe:meth:`OEBio::OESplitMolComplexOptions::GetProteinFilter` method
      * :oe:meth:`OEBio::OESplitMolComplexOptions::GetWaterFilter` method
      * :oe:meth:`OEBio::OESplitMolComplexOptions::GetOtherFilter` method
      * :oe:func:`OEBio::OESplitMolComplex` function
      * :oe:func:`OEBio::OEGetMolComplexComponents` function
