.. include:: ../substitutions

.. oe:namespace:: OEBio

.. meta::
   :keywords: OEHierFragment, HierFragment


.. _OEBio_OEHierFragment:

.. oe:class:: OEHierFragment

   .. oe:api::


      class OEHierFragment

   The hierarchical view has an :ref:`OEHierFragment <OEBio_OEHierFragment>` object
   in the hierarchy between :ref:`OEHierChain <OEBio_OEHierChain>` and
   :ref:`OEHierResidue <OEBio_OEHierResidue>`. This gives a
   hierarchical view of a temporary snapshot of the data structure in
   the molecule used to construct the :ref:`OEHierView <OEBio_OEHierView>` which owns the
   fragment objects.

   .. oe:method:: Constructors

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

         .. oe:api::

            OEHierFragment()
            OEHierFragment(OEHierFragImpl* i)
            OEHierFragment(const OEHierFragment &)

      .. oe:language:: python

         .. oe:api:: python

            OEHierFragment(i: OEHierFragImpl) -> OEHierFragment
            OEHierFragment() -> OEHierFragment
            OEHierFragment(arg2: OEHierFragment) -> OEHierFragment

      Default and copy constructors.

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

      .. oe:api::

         OEHierFragment &operator=(const OEHierFragment &)

      Default assignment operator

      Assignment operator.


   .. oe:method:: GetAtom

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

         .. oe:api::

            OEChem::OEAtomBase* GetAtom(const char* resName, int resIdx,
                                        unsigned pdbAtomIdx)
            const OEChem::OEAtomBase* GetAtom(const char* resName, int resIdx,
                                              unsigned pdbAtomIdx) const

      .. oe:language:: python

         .. oe:api:: python

            GetAtom(resName: str, resIdx: int, pdbAtomIdx: int) -> OEAtomBase

   .. oe:method:: GetFragmentNumber

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

         .. oe:api::

            int GetFragmentNumber() const

      .. oe:language:: python

         .. oe:api:: python

            GetFragmentNumber() -> int

      Returns the integer representation of the fragment number for this
      fragment of the chain. While reading a PDB file, fragment numbers
      are incremented every time a `TER`_ record is encountered or a new
      ChainID is encountered.

   .. oe:method:: GetOEResidue

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

         .. oe:api::

            const OEChem::OEResidue& GetOEResidue() const

      .. oe:language:: python

         .. oe:api:: python

            GetOEResidue() -> OEResidue

      Returns an arbitrary :ref:`OEResidue <OEChem_OEResidue>` object associated
      with this fragment.

   .. oe:method:: GetResidue

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

         .. oe:api::

            OEHierResidue& GetResidue(const char* resName, int resIdx)
            const OEHierResidue& GetResidue(const char* resName, int resIdx) const

      .. oe:language:: python

         .. oe:api:: python

            GetResidue(resName: str, resIdx: int) -> OEHierResidue

      Gives direct access to a residue using the typical information
      that a user might know about a residue of interest (*e.g.* -
      ``THR242``). The chain specifier is not included because the chain
      is implied by the current object.

   .. oe:method:: GetResidues


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

         .. oe:api::

            OESystem::OEIterBase<OEHierResidue>* GetResidues()
            OESystem::OEIterBase<const OEHierResidue>* GetResidues() const

      .. oe:language:: python

         .. oe:api:: python

            GetResidues() -> OEHierResidueIter
            GetResidues() -> Iterable[OEHierResidue]

      Returns an iterator over all of the residues in the fragment.
