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

.. oe:namespace:: OEChem

.. _OEChem_OEMonomerData:

.. oe:class:: OEMonomerData

   .. attention::

      |PRELIMINARY-API|

   .. oe:api::

      class OEMonomerData

   Stores the basic definition required for a monomer (:ref:`OEMonomer <OEChem_OEMonomer>`)
   to be used as a building block for representing biological macromolecules.

   .. list-table:: **Example of monomer definition of L-Alanine**
      :widths: 250 250 250
      :header-rows: 1

      * - Property
        - Value
        - Required/Optional/Generated

      * - Smiles
        - ``[H:1]N[C@@H](C)C(=O)[OH:2]``
        - required

      * - Canonical Smiles
        - ``C[C@@H](C(=O)O)N``
        - generated

      * - Name
        - ``L-Alanine`` (optional)
        - optional

      * - Polymer type
        - :oe:const:`OEChem::OEPolymerType::Peptide`
        - required

      * - Monomer type
        - :oe:const:`OEChem::OEMonomerType::Backbone`
        - required

      * - Monomer code-set/code pair
        - ``A`` in code-set ``Standard``
        - required for at least one code-set

   .. oe:source:: MakeAlanine.py
      :language: python
      :noindent:
      :frag:     SNIPPET

   .. oe:source:: MakeAlanine.cpp
      :language: c++
      :noindent:
      :frag:     SNIPPET

   .. seealso::
      
      * :oe:func:`OEChem::OEIsValidMonomerData` function
      * :oe:cls:`OEChem::OEMonomerValidationResult` class

   .. oe:method:: Constructors

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

         .. oe:api::

            OEMonomerData()

      .. oe:language:: python

         .. oe:api:: python

            OEMonomerData() -> OEMonomerData

      Default constructor that creates an :ref:`OEMonomerData <OEChem_OEMonomerData>`
      object.

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

         .. oe:api::

            OEMonomerData(const std::string& smiles,
                          unsigned polymerType = OEPolymerType::Peptide,
                          unsigned monomerType = OEMonomerType::Backbone)

      .. oe:language:: python

         .. oe:api:: python

            OEMonomerData(smiles: str, polymerType: int, monomerType: int) -> OEMonomerData

      Constructor that initializes an :ref:`OEMonomerData <OEChem_OEMonomerData>`
      object.

      .. seealso::

         * :oe:constns:`OEChem::OEPolymerType` namespace
         * :oe:constns:`OEChem::OEMonomerType` namespace

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

         .. oe:api::

            OEMonomerData(const OEMonomerData &)

      .. oe:language:: python

         .. oe:api:: python

            OEMonomerData(arg2: OEMonomerData) -> OEMonomerData

      Copy constructor.

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

      .. oe:api::

         OEMonomerData &operator=(const OEMonomerData &)

      Assignment operator.

   .. oe:method:: AddCode

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

         .. oe:api::

            void AddCode(const std::string& codeSet, const std::string& code)

      .. oe:language:: python

         .. oe:api:: python

            AddCode(codeSet: str, code: str) -> None

      Adds a code to a monomer for a given code-set.    

   .. oe:method:: GetCode

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

         .. oe:api::

            std::string GetCode(const std::string& codeSet) const

      .. oe:language:: python

         .. oe:api:: python

            GetCode(codeSet: str) -> str

      Returns the code of the monomer for the given code-set. Returns an empty string
      if there is no code defined for the code-set.   

   .. oe:method:: GetCodes

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

         .. oe:api::

            const std::map<std::string, std::string>& GetCodes() const

      .. oe:language:: python

         .. oe:api:: python

            GetCodes() -> OEStringStringMap

      Returns the map that contains all the code-set and code pairs 
      defined for the monomer. 

   .. oe:method:: GetMonomerType

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

         .. oe:api::

            unsigned int GetMonomerType() const

      .. oe:language:: python

         .. oe:api:: python

            GetMonomerType() -> int

      Returns the monomer type of the monomer.

      .. seealso::

         * :oe:constns:`OEChem::OEMonomerType` namespace

   .. oe:method:: GetName

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

         .. oe:api::

            std::string GetName() const

      .. oe:language:: python

         .. oe:api:: python

            GetName() -> str

      Returns the full name of the monomer. It is optional to define and only used to reference name.

   .. oe:method:: GetPolymerType

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

         .. oe:api::

            unsigned int GetPolymerType() const

      .. oe:language:: python

         .. oe:api:: python

            GetPolymerType() -> int

      Returns the polymer type of the monomer.

      .. seealso::

         * :oe:constns:`OEChem::OEPolymerType` namespace

   .. oe:method:: GetSmiles

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

         .. oe:api::

            std::string GetSmiles() const

      .. oe:language:: python

         .. oe:api:: python

            GetSmiles() -> str

      Returns the smiles representation of the monomer that contains the atom 
      map indices representing connection points.
      Such as ``[H:1]N[C@@H](C)C(=O)[OH:2]`` defining alanine.

   .. oe:method:: GetCanonicalSmiles

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

         .. oe:api::

            std::string GetCanonicalSmiles() const

      .. oe:language:: python

         .. oe:api:: python

            GetCanonicalSmiles() -> str

      Returns the canonical smiles representation of the monomer (without atom mapping)
      Such as ``C[C@@H](C(=O)O)N]`` for  alanine.

   .. oe:method:: HasCode

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

         .. oe:api::

            bool HasCode(const std::string& codeSet) const

      .. oe:language:: python

         .. oe:api:: python

            HasCode(codeSet: str) -> bool

      Returns whether the monomer has a code defined for the given code set.

   .. oe:method:: IsValid

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

         .. oe:api::

            bool IsValid() const

      .. oe:language:: python

         .. oe:api:: python

            IsValid() -> bool

      Returns whether the  :oe:cls:`OEChem::OEMonomerData` object is fully defined 
      and correct.

      .. seealso::

         * :oe:func:`OEChem::OEIsValidMonomerData` function      

   .. oe:method:: NumCodes

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

         .. oe:api::

            unsigned int NumCodes() const

      .. oe:language:: python

         .. oe:api:: python

            NumCodes() -> int

   Returns the number of codes defined for the monomer in various code-sets.

   .. oe:method:: SetCodes

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

         .. oe:api::

            void SetCodes(const std::map<std::string, std::string>& codes)

      .. oe:language:: python

         .. oe:api:: python

            SetCodes(codes: OEStringStringMap) -> None

   Sets a code of the monomer for a specific code-set.

   .. oe:method:: SetMonomerType

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

         .. oe:api::

            void SetMonomerType(unsigned int)

      .. oe:language:: python

         .. oe:api:: python

            SetMonomerType(arg2: int) -> None

      Sets the monomer type of the monomer.

      .. seealso::

         * :oe:constns:`OEChem::OEMonomerType` namespace


   .. oe:method:: SetName

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

         .. oe:api::

            void SetName(const std::string &)

      .. oe:language:: python

         .. oe:api:: python

            SetName(arg2: str) -> None

      Sets the name of the monomer. The name can be arbitrary, but it is recommended use the IUPAC name
      or any other name that well the monomer.
      For example, the name of the ``C[C@@H](C(=O)O)N]`` monomer of can be ``Alanine`` , ``L-alanine`` or
      ``L-alpha-Alanine`` or ``(2S)-2-aminopropanoic acid``.
      Setting the name is optional.

   .. oe:method:: SetPolymerType

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

         .. oe:api::

            void SetPolymerType(unsigned int)

      .. oe:language:: python

         .. oe:api:: python

            SetPolymerType(arg2: int) -> None

      Sets the polymer type of the monomer.

      .. seealso::

         * :oe:constns:`OEChem::OEPolymerType` namespace


   .. oe:method:: SetSmiles

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

         .. oe:api::

            void SetSmiles(const std::string &)

      .. oe:language:: python

         .. oe:api:: python

            SetSmiles(arg2: str) -> None

      Sets the smiles of the monomer.  The given smiles has to define possible attachment points
      of the monomer using map indices.
      For example, ``[H:1]N[C@@H](C)C(=O)[OH:2]`` defining alanine with two connection points to
      from a peptide bonds with adjacent amino acid monomers.

      .. seealso::

         * :oe:func:`OEChem::OEPerceivePeptideMonomerConnections` function

   .. oe:method:: Validate

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

         .. oe:api::

            bool Validate() const

      .. oe:language:: python

         .. oe:api:: python

            Validate() -> bool

      Calls the :oe:func:`OEChem::OEIsValidMonomerData` function
      to validate the monomer data object.
