.. # split from OEBioFunctions.rst:713

.. include:: ../substitutions

.. oe:namespace:: OEBio

.. meta::
   :keywords: OESplitMolComplex

.. oe:function:: OESplitMolComplex

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

      .. oe:api::

         bool OESplitMolComplex(OEChem::OEMolBase& lig,
                                OEChem::OEMolBase& prot,
                                OEChem::OEMolBase& waters,
                                OEChem::OEMolBase& other,
                                const OEChem::OEMolBase& mol,
                                const OESplitMolComplexOptions& opt = OESplitMolComplexOptions())

   .. oe:language:: python

      .. oe:api:: python

         OESplitMolComplex(lig: Union[OEGraphMol,OEMol,OEQMol],
                           prot: Union[OEGraphMol,OEMol,OEQMol],
                           waters: Union[OEGraphMol,OEMol,OEQMol],
                           other: Union[OEGraphMol,OEMol,OEQMol],
                           mol: Union[OEGraphMol,OEMol,OEQMol],
                           opt: OESplitMolComplexOptions = OESplitMolComplexOptions()) -> bool

   Separates components of the input ``mol`` into the four
   output :ref:`OEMolBase <OEChem_OEMolBase>` categories
   ``lig``, ``prot``, ``waters``, and ``other``
   representing basic elements of a macro-molecular complex.
   The process is controlled by
   an optional :ref:`OESplitMolComplexOptions <OEBio_OESplitMolComplexOptions>` object.
   ``Other`` contains everything that is not in ``lig``, ``prot``, or ``waters``,
   all of which are defined by :ref:`OEMolComplexFilter <OEBio_OEMolComplexFilter>` objects
   from :ref:`OESplitMolComplexOptions <OEBio_OESplitMolComplexOptions>`.
   By default, ``lig``, ``prot``, and ``waters`` return components associated
   with the first binding site.
   The filters can be changed so that ``lig``, ``prot``, and ``waters``
   return other types of components; for example, the filters could be set so that
   both the protein and any waters are placed in ``prot``, and any cofactors are
   placed in ``waters``.

   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.

   Returns ``false`` if the task could not be performed
   (for example, if ``mol`` is empty). To check if a ligand was found,
   check the number of atoms in ``lig``.

   .. warning::

      The input molecule should contain *PDB*
      :ref:`residue information<section_biopolymer_residues>`
      such as residue name, which is used during the
      classification process, either from a PDB format file or
      through :oe:func:`residue perception<OEChem::OEPerceiveResidues>`.
      Molecular complexes read from files in formats that lack this
      information (for example *SDF*) may be split inappropriately unless
      residues are perceived after input.

   .. seealso::

      * :ref:`section_split_mol_complex` section
      * :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::OEGetMolComplexComponents` function
      * :oe:func:`OEBio::OECombineMolComplexFragments` function
      * :oe:func:`OEBio::OEFilterMolComplexFragments` function
      * :oe:func:`OEBio::OECountMolComplexSites` function
