.. oe:namespace:: OEChem



.. meta::
   :keywords: OELingoSim, LingoSim


.. _OEChem_OELingoSim:

.. oe:class:: OELingoSim

   .. oe:api::


      class OELingoSim

   This class represents `OELingoSim`.

   The :ref:`OELingoSim <OEChem_OELingoSim>` class provides a fast 2D molecular
   similarity method.
   The construction of an :ref:`OELingoSim <OEChem_OELingoSim>` object based on a
   single molecule or canonical string describing the molecule.
   Similarity between this original molecule and any
   subsequent molecule can then be rapidly calculated using another
   molecule or its canonical string.

   .. seealso::

      * :term:`LINGO`

      * [Grant-2006]_ 

      * [Vidal-2005]_   

      * [Vidal-2006]_


   .. oe:method:: Constructors

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

         .. oe:api::

            OELingoSim(const char* str = 0,
                       unsigned type = OELingoType::Default)
            OELingoSim(const std::string& str,
                       unsigned type = OELingoType::Default)

      .. oe:language:: python

         .. oe:api:: python

            OELingoSim(str: str = None, type: int) -> OELingoSim

      Constructs a :ref:`OELingoSim <OEChem_OELingoSim>` object with a canonical string.
      The string API of :ref:`OELingoSim <OEChem_OELingoSim>` class allows use
      of any string in both construction and similarity testing
      (:oe:meth:`OEChem::OELingoSim::Similarity`).
      While :term:`canonical SMILES` or :term:`canonical isomeric
      SMILES` are the most common string to be used, there is
      absolutely no requirement to use these strings in generating
      lingos comparisons.
      Care must be taken, however, to make sure consistent string
      types are passed to the constructors and similarity functions!
      The set of valid types are defined in the
      :oe:constns:`OEChem::OELingoType` namespace.
 
      .. oe:language:: c++ java csharp

         .. oe:api::

            OELingoSim(const OEMolBase& mol,
                       unsigned type = OELingoType::Default)

      .. oe:language:: python

         .. oe:api:: python

            OELingoSim(mol: Union[OEGraphMol,OEMol,OEQMol], type: int) -> OELingoSim

      Constructs a :ref:`OELingoSim <OEChem_OELingoSim>` object with a query
      molecule (:ref:`OEMolBase <OEChem_OEMolBase>`).
      Constructing an :ref:`OELingoSim <OEChem_OELingoSim>` object with a
      molecule provides less flexibility because the strings are
      generated inside the object and thus limited to a specific
      string type.
      The set of valid types are defined in the
      :oe:constns:`OEChem::OELingoType` namespace.

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

         .. oe:api::

            OELingoSim(const OELingoSim& rhs)

      .. oe:language:: python

         .. oe:api:: python

            OELingoSim(rhs: OELingoSim) -> OELingoSim

      Copy constructor.


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

      .. oe:api::

         OELingoSim &operator=(const OELingoSim &rhs)

      Assignment operator that copies the data of the 'rhs' :ref:`OELingoSim <OEChem_OELingoSim>` object
      into the right-hand side :ref:`OELingoSim <OEChem_OELingoSim>` object.

      Assignment operator.


   .. oe:method:: GetType

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

         .. oe:api::

            unsigned GetType() const

      .. oe:language:: python

         .. oe:api:: python

            GetType() -> int

   .. oe:method:: Init

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

         .. oe:api::

            bool Init(const OEMolBase& mol)

      .. oe:language:: python

         .. oe:api:: python

            Init(mol: Union[OEGraphMol,OEMol,OEQMol]) -> bool

      (Re)initialize the :ref:`OELingoSim <OEChem_OELingoSim>` object with a
      molecule.

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

         .. oe:api::

            bool Init(const char* str)
            bool Init(const std::string& str)

      .. oe:language:: python

         .. oe:api:: python

            Init(str: str) -> bool

      (Re)initialize the :ref:`OELingoSim <OEChem_OELingoSim>` object with a
      string.

      .. note:: 
      
        The implementation type (:oe:constns:`OEChem::OELingoType`),
        set in the constructor, is unchanged by the
        :oe:meth:`OEChem::OELingoSim::Init` methods.

   .. oe:method:: IsValid

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

         .. oe:api::

            bool IsValid() const

      .. oe:language:: python

         .. oe:api:: python

            IsValid() -> bool

      Tests for successful initialization of the
      :ref:`OELingoSim <OEChem_OELingoSim>` object.
      If initialization was attempted with an invalid molecule, a
      string shorter than four characters, or was default
      constructed it will not be valid. 
      Similarity of any object to an invalid
      :ref:`OELingoSim <OEChem_OELingoSim>` will always be ``0.0``.

   .. oe:method:: SetImpl
      :language: c++

      .. oe:api::

         void SetImpl(const OELingoSimImpl &impl)

   .. oe:method:: Similarity

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

         .. oe:api::

            float Similarity(const char* str) const
            float Similarity(const OEMolBase& mol) const
            float Similarity(const std::string& cansmi) const

      .. oe:language:: python

         .. oe:api:: python

            Similarity(str: str) -> float
            Similarity(mol: Union[OEGraphMol,OEMol,OEQMol]) -> float

      Calculates the lingos similarity between the molecule or string
      used to create the :ref:`OELingoSim <OEChem_OELingoSim>` object and the
      molecule or string passed into the
      :oe:meth:`OEChem::OELingoSim::Similarity` function.

      The :ref:`OEMolBase <OEChem_OEMolBase>` version is provided for
      convenience, and is suitable for most uses, but is somewhat less
      efficient than comparing strings directly.

      .. note::

         In the string API of the :oe:meth:`OEChem::OELingoSim::Similarity`
         method, any string can be used (:term:`canonical SMILES`,
         :term:`canonical isomeric SMILES`, IUPAC name), but care
         must be taken to make sure consistent string types are passed to
