.. oe:namespace:: OEChem



.. meta::
   :keywords: OEQMolBase, QMolBase


.. _OEChem_OEQMolBase:

.. oe:class:: OEQMolBase

   .. oe:api::


      class OEQMolBase : public OEMolBase

   This class represents `OEQMolBase`.

   The :ref:`OEQMolBase <OEChem_OEQMolBase>` is an abstract class that extends
   :ref:`OEMolBase <OEChem_OEMolBase>` and provides facilities useful in graph
   matching.
   Query molecules are used in matching operations such as
   substructure search (:ref:`OESubSearch <OEChem_OESubSearch>`), clique
   detection (:ref:`OECliqueSearch <OEChem_OECliqueSearch>`), and maximum common
   substructure search (:ref:`OEMCSSearch <OEChem_OEMCSSearch>`).
   Query expressions (:ref:`OEExprBase <OEChem_OEExprBase>`) stored in query
   atoms (:ref:`OEQAtomBase <OEChem_OEQAtomBase>`) and query bonds
   (:ref:`OEQBondBase <OEChem_OEQBondBase>`) are used to represent the boolean
   logic used in graph matching operations.
   Query molecules (:ref:`OEQMolBase <OEChem_OEQMolBase>`) conveniently collect
   query atoms and query bonds into a molecule suitable for use as a
   query graph in matching operations.
   As a derived type of :ref:`OEMolBase <OEChem_OEMolBase>`, query molecules
   are valid arguments for functions which take a base molecule class
   as an argument.

   The following methods are publicly inherited from :ref:`OEMolBase <OEChem_OEMolBase>`:

   =========================================================== =========================================================== ============================================================
   :oe:meth:`operator=<OEChem::OEMolBase::operator=>`          :oe:meth:`GetDimension<OEChem::OEMolBase::GetDimension>`    :oe:meth:`NumBonds<OEChem::OEMolBase::NumBonds>`            
   :oe:meth:`operator bool<OEChem::OEMolBase::operator bool>`  :oe:meth:`GetEnergy<OEChem::OEMolBase::GetEnergy>`          :oe:meth:`NumGroups<OEChem::OEMolBase::NumGroups>`          
   :oe:meth:`Clear<OEChem::OEMolBase::Clear>`                  :oe:meth:`GetGroup<OEChem::OEMolBase::GetGroup>`            :oe:meth:`OrderAtoms<OEChem::OEMolBase::OrderAtoms>`        
   :oe:meth:`ClearCoords<OEChem::OEMolBase::ClearCoords>`      :oe:meth:`GetGroups<OEChem::OEMolBase::GetGroups>`          :oe:meth:`OrderBonds<OEChem::OEMolBase::OrderBonds>`        
   :oe:meth:`Compress<OEChem::OEMolBase::Compress>`            :oe:meth:`GetMaxAtomIdx<OEChem::OEMolBase::GetMaxAtomIdx>`  :oe:meth:`ResetPerceived<OEChem::OEMolBase::ResetPerceived>`
   :oe:meth:`Count<OEChem::OEMolBase::Count>`                  :oe:meth:`GetMaxBondIdx<OEChem::OEMolBase::GetMaxBondIdx>`  :oe:meth:`SetCoords<OEChem::OEMolBase::SetCoords>`          
   :oe:meth:`CreateCopy<OEChem::OEMolBase::CreateCopy>`        :oe:meth:`GetTitle<OEChem::OEMolBase::GetTitle>`            :oe:meth:`SetDimension<OEChem::OEMolBase::SetDimension>`    
   :oe:meth:`DeleteAtom<OEChem::OEMolBase::DeleteAtom>`        :oe:meth:`HasPerceived<OEChem::OEMolBase::HasPerceived>`    :oe:meth:`SetEnergy<OEChem::OEMolBase::SetEnergy>`          
   :oe:meth:`DeleteBond<OEChem::OEMolBase::DeleteBond>`        :oe:meth:`IsDataType<OEChem::OEMolBase::IsDataType>`        :oe:meth:`SetPerceived<OEChem::OEMolBase::SetPerceived>`    
   :oe:meth:`DeleteGroup<OEChem::OEMolBase::DeleteGroup>`      :oe:meth:`IsDeleted<OEChem::OEMolBase::IsDeleted>`          :oe:meth:`SetRxn<OEChem::OEMolBase::SetRxn>`                
   :oe:meth:`GetAtom<OEChem::OEMolBase::GetAtom>`              :oe:meth:`IsRxn<OEChem::OEMolBase::IsRxn>`                  :oe:meth:`SetTitle<OEChem::OEMolBase::SetTitle>`            
   :oe:meth:`GetAtoms<OEChem::OEMolBase::GetAtoms>`            :oe:meth:`NewAtom<OEChem::OEMolBase::NewAtom>`              :oe:meth:`Sweep<OEChem::OEMolBase::Sweep>`                  
   :oe:meth:`GetBond<OEChem::OEMolBase::GetBond>`              :oe:meth:`NewBond<OEChem::OEMolBase::NewBond>`              :oe:meth:`UnCompress<OEChem::OEMolBase::UnCompress>`        
   :oe:meth:`GetBonds<OEChem::OEMolBase::GetBonds>`            :oe:meth:`NewGroup<OEChem::OEMolBase::NewGroup>`            
   :oe:meth:`GetCoords<OEChem::OEMolBase::GetCoords>`          :oe:meth:`NumAtoms<OEChem::OEMolBase::NumAtoms>`            
   =========================================================== =========================================================== ============================================================

   .. oe:language:: java

      The following methods are publicly inherited from :ref:`OEMolBase <OEChem_OEMolBase>` only in Java:

      ====================================================== ====================================================== =========================================================
      :oe:meth:`GetAtomList<OEChem::OEMolBase::GetAtomList>` :oe:meth:`GetBondList<OEChem::OEMolBase::GetBondList>` :oe:meth:`GetGroupList<OEChem::OEMolBase::GetGroupList>` 
      ====================================================== ====================================================== =========================================================

   The following methods are publicly inherited from :ref:`OEBase <OESystem_OEBase>`:

   ======================================================== ========================================================= =========================================================
   :oe:meth:`operator=<OESystem::OEBase::operator=>`        :oe:meth:`GetData<OESystem::OEBase::GetData>`             :oe:meth:`IsDataType<OESystem::OEBase::IsDataType>`      
   :oe:meth:`operator+=<OESystem::OEBase::operator+=>`      :oe:meth:`GetDataIter<OESystem::OEBase::GetDataIter>`     :oe:meth:`SetBaseData<OESystem::OEBase::SetBaseData>`    
   :oe:meth:`AddBaseData<OESystem::OEBase::AddBaseData>`    :oe:meth:`GetDataType<OESystem::OEBase::GetDataType>`     :oe:meth:`SetBoolData<OESystem::OEBase::SetBoolData>`    
   :oe:meth:`AddData<OESystem::OEBase::AddData>`            :oe:meth:`GetDoubleData<OESystem::OEBase::GetDoubleData>` :oe:meth:`SetData<OESystem::OEBase::SetData>`            
   :oe:meth:`Clear<OESystem::OEBase::Clear>`                :oe:meth:`GetFloatData<OESystem::OEBase::GetFloatData>`   :oe:meth:`SetDoubleData<OESystem::OEBase::SetDoubleData>`
   :oe:meth:`CreateCopy<OESystem::OEBase::CreateCopy>`      :oe:meth:`GetIntData<OESystem::OEBase::GetIntData>`       :oe:meth:`SetFloatData<OESystem::OEBase::SetFloatData>`  
   :oe:meth:`DeleteData<OESystem::OEBase::DeleteData>`      :oe:meth:`GetStringData<OESystem::OEBase::GetStringData>` :oe:meth:`SetIntData<OESystem::OEBase::SetIntData>`      
   :oe:meth:`GetBoolData<OESystem::OEBase::GetBoolData>`    :oe:meth:`HasData<OESystem::OEBase::HasData>`             :oe:meth:`SetStringData<OESystem::OEBase::SetStringData>`
   ======================================================== ========================================================= =========================================================

   .. oe:method:: Constructors

      .. oe:api::

         OEQMolBase()
         OEQMolBase(const OEMolBase& m)
         OEQMolBase(const OEQMolBase& m)

      Default and copy constructors.

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

      .. oe:api::

         OEQMolBase& operator=(const OEMolBase& rhs)

      Assignment operator that copies the data of the 'rhs' :ref:`OEMolBase <OEChem_OEMolBase>` object
      into the right-hand side :ref:`OEQMolBase <OEChem_OEQMolBase>` object.

      .. oe:api::

         OEQMolBase& operator=(const OEQMolBase& rhs)

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

      Assignment operator.


   .. oe:method:: BuildExpressions

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

         .. oe:api::

            bool BuildExpressions(const OEMatchPair<OEExprBase> &)

      .. oe:language:: python

         .. oe:api:: python

            BuildExpressions(arg2: OEMatchPair[OEExprBase]) -> bool

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

         .. oe:api::

            bool BuildExpressions(unsigned int atomopts, unsigned int bondopts)

      .. oe:language:: python

         .. oe:api:: python

            BuildExpressions(atomopts: int, bondopts: int) -> bool

      Builds query expressions (:ref:`OEExprBase <OEChem_OEExprBase>`) for the
      atoms (:ref:`OEQAtomBase <OEChem_OEQAtomBase>`) and bonds
      (:ref:`OEQBondBase <OEChem_OEQBondBase>`) contained in a query molecule
      object.
      Any pre-existing query expressions are destroyed by this method.
      The bits in the unsigned integers passed to the method define
      how query expressions will be built based on the attributes of
      each atom and bond instance.
      The bitwise options are stored in the
      :oe:constns:`OEChem::OEExprOpts` namespace.
      This method provides the ability to convert attributes of base
      atoms and bonds to query expressions that are consistent with
      the semantics desired for a graph match procedure.
      Each requested expression is constructed, using data from the
      parent atom or bond if necessary.
      During a graph match procedure, the resulting expression
      composition will be used to evaluate atom and bond graph
      component equivalences.

      .. note::

         :oe:meth:`OEChem::OEQMolBase::BuildExpressions` uses the data
         present in a query molecule only when it is called.
         Subsequent modifications to atom and bond data to not cause
         the expressions to be updated to reflect changes.
         An additional call to
         :oe:meth:`OEChem::OEQMolBase::BuildExpressions` must be made
         to synchronize expressions with atom and bond data.

   .. 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 for the returned :ref:`OEQMolBase <OEChem_OEQMolBase>`
      object is dynamically allocated  and owned by the caller.

      .. oe:language:: c++ 

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

   .. oe:method:: GetQAtoms

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

         .. oe:api::

            OESystem::OEIterBase<OEQAtomBase>* GetQAtoms() const = 0

      .. oe:language:: python

         .. oe:api:: python

            GetQAtoms() -> OEQAtomIter

      Returns an iterator over all the query atoms (:ref:`OEQAtomBase <OEChem_OEQAtomBase>`)
      of a query molecule. 
      By default, this returns all the query atoms of the molecule in the order
      they were created. The ordering of the atoms returned by
      :oe:meth:`OEChem::OEQMolBase::GetQAtoms` may be modified by
      :oe:meth:`OEChem::OEMolBase::OrderAtoms`.

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

         .. oe:api::

            OESystem::OEIterBase<OEQAtomBase>* GetQAtoms(const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &) const = 0

      .. oe:language:: python

         .. oe:api:: python

            GetQAtoms(arg2: OEUnaryAtomPred) -> OEQAtomIter

      Returns an iterator over all of the query atoms of a query molecule that
      match the specified atom predicate
      (:ref:`OEUnaryPredicate <OESystem_OEUnaryPredicate>`).

   .. oe:method:: GetQBonds

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

         .. oe:api::

            OESystem::OEIterBase<OEQBondBase>* GetQBonds() const = 0

      .. oe:language:: python

         .. oe:api:: python

            GetQBonds() -> OEQBondIter

      Returns an iterator over all the query bonds (:ref:`OEQBondBase <OEChem_OEQBondBase>`)
      of a query molecule. 
      By default, this returns all the query bonds of the molecule in the order
      they were created. The ordering of the bonds returned by
      :oe:meth:`OEChem::OEQMolBase::GetQBonds` may be modified by
      :oe:meth:`OEChem::OEMolBase::OrderBonds`.

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

         .. oe:api::

            OESystem::OEIterBase<OEQBondBase>* GetQBonds(const OESystem::OEUnaryPredicate<OEChem::OEBondBase> &) const = 0

      .. oe:language:: python

         .. oe:api:: python

            GetQBonds(arg2: OEUnaryBondPred) -> OEQBondIter

      Returns an iterator over all of the query bonds of a query molecule that
      match the specified bond predicate
      (:ref:`OEUnaryPredicate <OESystem_OEUnaryPredicate>`).

   .. 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

