.. include:: ../../common/cookbook/cookbook-hyperlinks

.. oe:namespace:: OEBio

.. meta::
   :keywords: OEInteractionHint


.. _OEBio_OEInteractionHint:

.. oe:class:: OEInteractionHint

   .. oe:api::

      class OEInteractionHint : public OESystem::OEBase

   The :ref:`OEInteractionHint <OEBio_OEInteractionHint>` class is a
   container that stores a typed interaction between two fragments
   (:ref:`OEInteractionHintFragment <OEBio_OEInteractionHintFragment>`) of an
   :ref:`OEInteractionHintContainer <OEBio_OEInteractionHintContainer>` object.

   .. only:: oehtml

      .. figure:: ../images/interactionhint.svg
         :width: 600
         :align: center

         **Schematic representation of interaction hint container**

   .. seealso::

      * :ref:`OEInteractionHintContainer <OEBio_OEInteractionHintContainer>` class
      * :ref:`OEInteractionHintFragment <OEBio_OEInteractionHintFragment>` class
      * :ref:`OEPerceiveInteractionOptions <OEBio_OEPerceiveInteractionOptions>` class

   .. seealso::

      The following built-in interaction hint types are available:

      * :ref:`OECationPiInteractionHint <OEBio_OECationPiInteractionHint>`
      * :ref:`OEChelatorInteractionHint <OEBio_OEChelatorInteractionHint>`
      * :ref:`OEClashInteractionHint <OEBio_OEClashInteractionHint>`
      * :ref:`OEContactInteractionHint <OEBio_OEContactInteractionHint>`
      * :ref:`OECovalentInteractionHint <OEBio_OECovalentInteractionHint>`
      * :ref:`OEHBondInteractionHint <OEBio_OEHBondInteractionHint>`
      * :ref:`OESaltBridgeInteractionHint <OEBio_OESaltBridgeInteractionHint>`
      * :ref:`OEStackingInteractionHint <OEBio_OEStackingInteractionHint>`
      * :ref:`OEHalogenBondInteractionHint <OEBio_OEHalogenBondInteractionHint>`

   .. admonition:: Code Examples

      * :ref:`section_example_oebio_printinteractions` **OEChem TK** example
      * :ref:`section_examples_summary_complex2img` **Grapheme TK** example

      **OpenEye Python Cookbook** recipes:

      * `Accessing Interaction Hint Information`_
      * `Print Protein-Ligand Interactions to Console`_
      * `Print the Summary of Protein-Ligand Interactions for a Set of Molecules`_


   .. oe:method:: Constructors

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

         .. oe:api::

            OEInteractionHint(const OEInteractionHintContainerImpl* container,
                              const OEInteractionHintFragment* fragBgn,
                              const OEInteractionHintFragment* fragEnd,
                              const OEInteractionHintTypeBase& itype)

      .. oe:language:: python

         .. oe:api:: python

            OEInteractionHint(rhs: OEInteractionHint) -> OEInteractionHint

      Constructs an :ref:`OEInteractionHint <OEBio_OEInteractionHint>` object with
      the given parameters.

      *container*
        The :ref:`OEInteractionHintContainer <OEBio_OEInteractionHintContainer>` object the
        two fragments belong to.

      **fragBgn, fragEnd**
        The two fragments of the interaction.
        The first fragment is going to be considered as the 'begin'
        fragment, while the second one will be the considered as the
        'end' fragment.

      **type**
        The type of the interaction that is derived from the
        :ref:`OEInteractionHintTypeBase <OEBio_OEInteractionHintTypeBase>` abstract base class.

      .. seealso::

         * :oe:meth:`OEBio::OEInteractionHint::GetBgnFragment` method
         * :oe:meth:`OEBio::OEInteractionHint::GetEndFragment` method

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

         .. oe:api::

            OEInteractionHint(const OEInteractionHint& rhs)

      .. oe:language:: python

         .. oe:api:: python

            OEInteractionHint(rhs: OEInteractionHint) -> OEInteractionHint

      Copy constructor.


   .. oe:method:: operator=
      :language: c++

      .. oe:api::

         OEInteractionHint &operator=(const OEInteractionHint &rhs)

      Assignment operator.


   .. oe:method:: CreateCopy

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

         .. oe:api::

            OESystem::OEBase* CreateCopy() const

      .. oe:language:: python

         .. oe:api:: python

            CreateCopy() -> OEBase

      Deep copy constructor that returns a copy of the object.
      The memory of the returned :ref:`OEInteractionHint <OEBio_OEInteractionHint>`
      object is dynamically allocated and owned by the caller.

      .. oe:language:: c++

         The returned copy should be deallocated using the C++
         delete operator in order to prevent a memory leak.

   .. oe:method:: HasCalculatedGeometry

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

         .. oe:api::

            bool HasCalculatedGeometry(const std::string& name) const

      .. oe:language:: python

         .. oe:api:: python

            HasCalculatedGeometry(name: str) -> bool

      Returns ``true`` if the interaction hint has the geometry calculated with the
      given name.

      **name**
        The name of the calculated geometry.
        All interaction hint geometry names start with the ``bio:interaction:`` prefix.
        The :oe:meth:`OEBio::OEInteractionHint::HasCalculatedGeometry` method can
        be invoked with or without the ``bio:interaction:`` prefix in the given name.

      .. seealso::

         * :ref:`chapter_interactions_geometry` section
         * :oe:meth:`OEBio::OEInteractionHint::GetCalculatedGeometry` method
         * :oe:meth:`OEBio::OEInteractionHint::GetCalculatedGeometries` method


   .. oe:method:: GetBgnFragment

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

         .. oe:api::

            const OEInteractionHintFragment* GetBgnFragment() const

      .. oe:language:: python

         .. oe:api:: python

            GetBgnFragment() -> OEInteractionHintFragment

      Returns the ‘begin’ fragment of the interaction.
      The 'begin' fragment is defined when the interaction is constructed.

      .. seealso::

         * :oe:meth:`OEBio::OEInteractionHint::Constructors` method

      .. note::

         In case of an "unpaired" interaction both the :oe:meth:`OEBio::OEInteractionHint::GetBgnFragment` and
         :oe:meth:`OEBio::OEInteractionHint::GetEndFragment` methods will point to the same fragment.

         **See Also:** :oe:cls:`OEBio::OEIsUnpairedInteractionHint` predicate

   .. oe:method:: GetCalculatedGeometry

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

         .. oe:api::

            double GetCalculatedGeometry(const std::string& name) const

      .. oe:language:: python

         .. oe:api:: python

            GetCalculatedGeometry(name: str) -> float

      Returns the calculated geometry of the interaction (such as distance or angle).
      The "distance" values are given in Angstroms, and all "angle" values are given in radians.

      **name**
        The name of the calculated geometry.
        All interaction hint geometry names start with the ``bio:interaction:`` prefix.
        The :oe:meth:`OEBio::OEInteractionHint::GetCalculatedGeometry` method can be
        invoked with or without the ``bio:interaction:`` prefix in the given name.

      .. hint::

         It is a good practice to call :oe:meth:`OEBio::OEInteractionHint::HasCalculatedGeometry`
         beforehand to check whether the interaction hint has a geometry with a given name.

      **Example:**

      .. oe:source:: InteractionGeometry.py
         :language: python
         :noindent:
         :frag:     SNIPPET-HAS-GEOMETRY

      .. oe:source:: InteractionGeometry.cpp
         :language: c++
         :noindent:
         :frag:     SNIPPET-HAS-GEOMETRY

      .. oe:source:: InteractionGeometry.java
         :language: java
         :noindent:
         :frag:     SNIPPET-HAS-GEOMETRY

      .. oe:source:: InteractionGeometry.cs
         :language: csharp
         :noindent:
         :frag:     SNIPPET-HAS-GEOMETRY

      .. seealso::

         * :ref:`chapter_interactions_geometry` section
         * :oe:meth:`OEBio::OEInteractionHint::HasCalculatedGeometry` method
         * :oe:meth:`OEBio::OEInteractionHint::GetCalculatedGeometries` method

   .. oe:method:: GetCalculatedGeometries

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

         .. oe:api::

            OESystem::OEIterBase<const std::string>* GetCalculatedGeometries() const

      .. oe:language:: python

         .. oe:api:: python

            GetCalculatedGeometries() -> Iterable[str]

      Returns an iterator over the geometry names of the interaction hint.

      .. seealso::

         * :ref:`chapter_interactions_geometry` section
         * :oe:meth:`OEBio::OEInteractionHint::HasCalculatedGeometry` method
         * :oe:meth:`OEBio::OEInteractionHint::GetCalculatedGeometry` method
         * :oe:func:`OEBio::OEGetCalculatedInteractionGeometries` function


   .. oe:method:: GetDataType

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

         .. oe:api::

            const void* GetDataType() const

      .. oe:language:: python

         .. oe:api:: python

            GetDataType() -> void

      This function is used to perform run-time type identification.

      .. seealso::

         * :oe:meth:`OESystem::OEBase::GetDataType` method in the **OEChem TK** manual


   .. oe:method:: GetDetails

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

         .. oe:api::

            std::string GetDetails() const

      .. oe:language:: python

         .. oe:api:: python

            GetDetails() -> str

      Returns the string data associated with the
      :ref:`OEInteractionHint <OEBio_OEInteractionHint>` object.


   .. oe:method:: GetEndFragment

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

         .. oe:api::

            const OEInteractionHintFragment* GetEndFragment() const

      .. oe:language:: python

         .. oe:api:: python

            GetEndFragment() -> OEInteractionHintFragment


      Returns the ‘end’ fragment of the interaction.
      The 'end' fragment is defined when the interaction is constructed.

      .. seealso::

         * :oe:meth:`OEBio::OEInteractionHint::Constructors` method


      .. note::

         In case of an "unpaired" interaction both the :oe:meth:`OEBio::OEInteractionHint::GetBgnFragment` and
         :oe:meth:`OEBio::OEInteractionHint::GetEndFragment` methods will point to the same fragment.

         **See Also:** :oe:cls:`OEBio::OEIsUnpairedInteractionHint` predicate

   .. oe:method:: GetFragment

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

         .. oe:api::

            const OEInteractionHintFragment* GetFragment(const OEInteractionHintComponentTypeBase &) const

      .. oe:language:: python

         .. oe:api:: python

            GetFragment(arg2: OEInteractionHintComponentTypeBase) -> OEInteractionHintFragment

      Returns the pointer to one fragment with the given component type.
      If neither the 'begin' nor the 'end' fragment has the given type,
      a NULL pointer will be returned.

      .. warning::

         In case of an intramolecular interaction, the
         :oe:meth:`OEBio::OEInteractionHint::GetFragment` can return a NULL
         pointer, so the return value should always be checked.

      .. seealso::

         The following built-in component types are available:

         * :ref:`OELigandInteractionHintComponent <OEBio_OELigandInteractionHintComponent>`
         * :ref:`OEProteinInteractionHintComponent <OEBio_OEProteinInteractionHintComponent>`

   .. oe:method:: GetInteractionType

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

         .. oe:api::

            const OEInteractionHintTypeBase& GetInteractionType() const

      .. oe:language:: python

         .. oe:api:: python

            GetInteractionType() -> OEInteractionHintTypeBase

      Returns the interaction type of the
      :ref:`OEInteractionHint <OEBio_OEInteractionHint>` object.

      .. seealso::

         The following built-in fragment connection types are available:

         * :ref:`OECationPiInteractionHint <OEBio_OECationPiInteractionHint>`
         * :ref:`OEChelatorInteractionHint <OEBio_OEChelatorInteractionHint>`
         * :ref:`OEClashInteractionHint <OEBio_OEClashInteractionHint>`
         * :ref:`OEContactInteractionHint <OEBio_OEContactInteractionHint>`
         * :ref:`OECovalentInteractionHint <OEBio_OECovalentInteractionHint>`
         * :ref:`OEHBondInteractionHint <OEBio_OEHBondInteractionHint>`
         * :ref:`OESaltBridgeInteractionHint <OEBio_OESaltBridgeInteractionHint>`
         * :ref:`OEStackingInteractionHint <OEBio_OEStackingInteractionHint>`
         * :ref:`OEHalogenBondInteractionHint <OEBio_OEHalogenBondInteractionHint>`


   .. oe:method:: GetWeight

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

         .. oe:api::

            double GetWeight() const

      .. oe:language:: python

         .. oe:api:: python

            GetWeight() -> float

      Returns the 'weight' (or score) associated with the
      :ref:`OEInteractionHint <OEBio_OEInteractionHint>` object.


   .. oe:method:: IsDataType

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

         .. oe:api::

            bool IsDataType(const void *) const

      .. oe:language:: python

         .. oe:api:: python

            IsDataType(arg2: void) -> bool

      Returns whether type is the same as the instance this method is
      called on.

      .. seealso::

         * :oe:meth:`OESystem::OEBase::IsDataType` method in the **OEChem TK** manual


   .. oe:method:: IsInter

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

         .. oe:api::

            bool IsInter() const

      .. oe:language:: python

         .. oe:api:: python

            IsInter() -> bool

      Returns whether the two fragments of the :ref:`OEInteractionHint <OEBio_OEInteractionHint>`
      object belongs to the different molecules.


   .. oe:method:: IsIntra

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

         .. oe:api::

            bool IsIntra() const

      .. oe:language:: python

         .. oe:api:: python

            IsIntra() -> bool

      Returns whether the two fragments of the :ref:`OEInteractionHint <OEBio_OEInteractionHint>`
      object belongs to the same molecule.


   .. oe:method:: IsValid

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

         .. oe:api::

            bool IsValid() const

      .. oe:language:: python

         .. oe:api:: python

            IsValid() -> bool


      Returns whether the :ref:`OEInteractionHint <OEBio_OEInteractionHint>` object
      represents a valid interaction defined by the type
      associated with it.


   .. oe:method:: SetDetails

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

         .. oe:api::

            void SetDetails(const std::string& details)

      .. oe:language:: python

         .. oe:api:: python

            SetDetails(details: str) -> None

      Sets string data associated with the
      :ref:`OEInteractionHint <OEBio_OEInteractionHint>` object.


   .. oe:method:: SetWeight

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

         .. oe:api::

            void SetWeight(double)

      .. oe:language:: python

         .. oe:api:: python

            SetWeight(arg2: float) -> None

      Sets the 'weight' associated with the
      :ref:`OEInteractionHint <OEBio_OEInteractionHint>` object.

      **weight**
         This number has to be in the range of ``[0.0, 1.0]``.
