RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
RDKit::QueryBond Class Reference

Class for storing Bond queries. More...

#include <QueryBond.h>

Inheritance diagram for RDKit::QueryBond:
RDKit::Bond RDKit::RDProps

Public Types

typedef Queries::Query< int, Bond const *, trueQUERYBOND_QUERY
 
- Public Types inherited from RDKit::Bond
enum  BondType {
  UNSPECIFIED = 0 , SINGLE , DOUBLE , TRIPLE ,
  QUADRUPLE , QUINTUPLE , HEXTUPLE , ONEANDAHALF ,
  TWOANDAHALF , THREEANDAHALF , FOURANDAHALF , FIVEANDAHALF ,
  AROMATIC , IONIC , HYDROGEN , THREECENTER ,
  DATIVEONE , DATIVE , DATIVEL , DATIVER ,
  OTHER , ZERO
}
 the type of Bond More...
 
enum  BondDir {
  NONE = 0 , BEGINWEDGE , BEGINDASH , ENDDOWNRIGHT ,
  ENDUPRIGHT , EITHERDOUBLE , UNKNOWN
}
 the bond's direction (for chirality) More...
 
enum  BondStereo {
  STEREONONE = 0 , STEREOANY , STEREOZ , STEREOE ,
  STEREOCIS , STEREOTRANS , STEREOATROPCW , STEREOATROPCCW
}
 the nature of the bond's stereochem (for cis/trans) More...
 
typedef Queries::Query< int, Bond const *, trueQUERYBOND_QUERY
 

Public Member Functions

 QueryBond ()
 
 QueryBond (BondType bT)
 initialize with a particular bond order
 
 QueryBond (const Bond &other)
 initialize from a bond
 
 QueryBond (const QueryBond &other)
 
 QueryBond (QueryBond &&other) noexcept
 
QueryBondoperator= (QueryBond &&other) noexcept
 
 ~QueryBond () override
 
Bondcopy () const override
 returns a copy of this query, owned by the caller
 
QueryBondoperator= (const QueryBond &other)
 
void setBondType (BondType bT)
 sets the BondType of this query:
 
void setBondDir (BondDir bD)
 sets the BondDir of this query:
 
bool Match (Bond const *what) const override
 returns true if we match Bond what
 
bool QueryMatch (QueryBond const *what) const
 returns true if our query details match those of QueryBond what
 
bool hasQuery () const override
 
QUERYBOND_QUERYgetQuery () const override
 returns our current query
 
void setQuery (QUERYBOND_QUERY *what) override
 replaces our current query with the value passed in
 
void expandQuery (QUERYBOND_QUERY *what, Queries::CompositeQueryType how=Queries::COMPOSITE_AND, bool maintainOrder=true) override
 expands our current query
 
double getValenceContrib (const Atom *at) const override
 returns our contribution to the explicit valence of an Atom
 
- Public Member Functions inherited from RDKit::Bond
 Bond ()
 
 Bond (BondType bT)
 construct with a particular BondType
 
 Bond (const Bond &other)
 
virtual ~Bond ()
 
Bondoperator= (const Bond &other)
 
 Bond (Bond &&o) noexcept
 
Bondoperator= (Bond &&o) noexcept
 
BondType getBondType () const
 returns our bondType
 
void setBondType (BondType bT)
 sets our bondType
 
double getBondTypeAsDouble () const
 returns our bondType as a double (e.g. SINGLE->1.0, AROMATIC->1.5, etc.)
 
void setIsAromatic (bool what)
 sets our isAromatic flag
 
bool getIsAromatic () const
 returns the status of our isAromatic flag
 
void setIsConjugated (bool what)
 sets our isConjugated flag
 
bool getIsConjugated () const
 returns the status of our isConjugated flag
 
bool hasOwningMol () const
 returns whether or not this instance belongs to a molecule
 
ROMolgetOwningMol () const
 returns a reference to the ROMol that owns this instance
 
void setOwningMol (ROMol *other)
 sets our owning molecule
 
void setOwningMol (ROMol &other)
 sets our owning molecule
 
bool invertChirality ()
 
unsigned int getIdx () const
 returns our index within the ROMol
 
void setIdx (unsigned int index)
 sets our index within the ROMol
 
unsigned int getBeginAtomIdx () const
 returns the index of our begin Atom
 
unsigned int getEndAtomIdx () const
 returns the index of our end Atom
 
unsigned int getOtherAtomIdx (unsigned int thisIdx) const
 given the index of one Atom, returns the index of the other
 
void setBeginAtomIdx (unsigned int what)
 sets the index of our begin Atom
 
void setEndAtomIdx (unsigned int what)
 sets the index of our end Atom
 
void setBeginAtom (Atom *at)
 sets our begin Atom
 
void setEndAtom (Atom *at)
 sets our end Atom
 
AtomgetBeginAtom () const
 returns a pointer to our begin Atom
 
AtomgetEndAtom () const
 returns a pointer to our end Atom
 
AtomgetOtherAtom (Atom const *what) const
 returns a pointer to the other Atom
 
void setBondDir (BondDir what)
 sets our direction
 
BondDir getBondDir () const
 returns our direction
 
void setStereo (BondStereo what)
 sets our stereo code
 
BondStereo getStereo () const
 returns our stereo code
 
void setStereoAtoms (unsigned int bgnIdx, unsigned int endIdx)
 sets the atoms to be considered as reference points for bond stereo
 
const INT_VECTgetStereoAtoms () const
 returns the indices of our stereo atoms
 
INT_VECTgetStereoAtoms ()
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void updatePropertyCache (bool strict=true)
 calculates any of our lazy properties
 
- Public Member Functions inherited from RDKit::RDProps
 RDProps ()
 
 RDProps (const RDProps &rhs)
 
RDPropsoperator= (const RDProps &rhs)
 
 RDProps (RDProps &&o) noexcept=default
 
RDPropsoperator= (RDProps &&rhs) noexcept=default
 
void clear ()
 
const DictgetDict () const
 gets the underlying Dictionary
 
DictgetDict ()
 
STR_VECT getPropList (bool includePrivate=true, bool includeComputed=true) const
 returns a list with the names of our properties
 
template<typename T >
void setProp (const std::string &key, T val, bool computed=false) const
 sets a property value
 
template<typename T >
void getProp (const std::string &key, T &res) const
 allows retrieval of a particular property value
 
template<typename T >
getProp (const std::string &key) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
bool getPropIfPresent (const std::string &key, T &res) const
 
bool hasProp (const std::string &key) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void clearProp (const std::string &key) const
 clears the value of a property
 
void clearComputedProps () const
 clears all of our computed properties
 
void updateProps (const RDProps &source, bool preserveExisting=false)
 update the properties from another
 

Protected Attributes

QUERYBOND_QUERYdp_query {nullptr}
 
- Protected Attributes inherited from RDKit::Bond
ROMoldp_mol
 
INT_VECTdp_stereoAtoms
 
atomindex_t d_index
 
atomindex_t d_beginAtomIdx
 
atomindex_t d_endAtomIdx
 
bool df_isAromatic
 
bool df_isConjugated
 
std::uint8_t d_bondType
 
std::uint8_t d_dirTag
 
std::uint8_t d_stereo
 
- Protected Attributes inherited from RDKit::RDProps
Dict d_props
 

Additional Inherited Members

- Protected Member Functions inherited from RDKit::Bond
void initBond ()
 

Detailed Description

Class for storing Bond queries.

QueryBond objects are derived from Bond objects, so they can be added to molecules and the like, but they have much fancier querying capabilities.

Definition at line 28 of file QueryBond.h.

Member Typedef Documentation

◆ QUERYBOND_QUERY

Constructor & Destructor Documentation

◆ QueryBond() [1/5]

RDKit::QueryBond::QueryBond ( )
inline

Definition at line 32 of file QueryBond.h.

◆ QueryBond() [2/5]

RDKit::QueryBond::QueryBond ( BondType  bT)
explicit

initialize with a particular bond order

◆ QueryBond() [3/5]

RDKit::QueryBond::QueryBond ( const Bond other)
inlineexplicit

initialize from a bond

Definition at line 36 of file QueryBond.h.

References RDKit::makeBondOrderEqualsQuery().

◆ QueryBond() [4/5]

RDKit::QueryBond::QueryBond ( const QueryBond other)
inline

◆ QueryBond() [5/5]

RDKit::QueryBond::QueryBond ( QueryBond &&  other)
inlinenoexcept

Definition at line 45 of file QueryBond.h.

◆ ~QueryBond()

RDKit::QueryBond::~QueryBond ( )
override

Member Function Documentation

◆ copy()

Bond * RDKit::QueryBond::copy ( ) const
overridevirtual

returns a copy of this query, owned by the caller

Reimplemented from RDKit::Bond.

◆ expandQuery()

void RDKit::QueryBond::expandQuery ( QUERYBOND_QUERY what,
Queries::CompositeQueryType  how = Queries::COMPOSITE_AND,
bool  maintainOrder = true 
)
overridevirtual

expands our current query

Parameters
whatthe Queries::Query to be added. The ownership of the query is passed to the current object, where it might be deleted, so that the pointer should not be used again in the calling code.
howthe operator to be used in the expansion
maintainOrder(optional) flags whether the relative order of the queries needs to be maintained, if this is false, the order is reversed

Notes:

  • what should probably be constructed using one of the functions defined in QueryOps.h
  • the maintainOrder option can be useful because the combination operators short circuit when possible.

Reimplemented from RDKit::Bond.

◆ getQuery()

QUERYBOND_QUERY * RDKit::QueryBond::getQuery ( ) const
inlineoverridevirtual

returns our current query

Reimplemented from RDKit::Bond.

Definition at line 79 of file QueryBond.h.

◆ getValenceContrib()

double RDKit::QueryBond::getValenceContrib ( const Atom at) const
overridevirtual

returns our contribution to the explicit valence of an Atom

Notes:

  • requires an owning molecule

Reimplemented from RDKit::Bond.

◆ hasQuery()

bool RDKit::QueryBond::hasQuery ( ) const
inlineoverridevirtual

Reimplemented from RDKit::Bond.

Definition at line 76 of file QueryBond.h.

◆ Match()

bool RDKit::QueryBond::Match ( Bond const what) const
overridevirtual

returns true if we match Bond what

Reimplemented from RDKit::Bond.

◆ operator=() [1/2]

QueryBond & RDKit::QueryBond::operator= ( const QueryBond other)

◆ operator=() [2/2]

QueryBond & RDKit::QueryBond::operator= ( QueryBond &&  other)
inlinenoexcept

Definition at line 48 of file QueryBond.h.

◆ QueryMatch()

bool RDKit::QueryBond::QueryMatch ( QueryBond const what) const

returns true if our query details match those of QueryBond what

◆ setBondDir()

void RDKit::QueryBond::setBondDir ( BondDir  bD)

sets the BondDir of this query:

◆ setBondType()

void RDKit::QueryBond::setBondType ( BondType  bT)

sets the BondType of this query:

◆ setQuery()

void RDKit::QueryBond::setQuery ( QUERYBOND_QUERY what)
inlineoverridevirtual

replaces our current query with the value passed in

Reimplemented from RDKit::Bond.

Definition at line 81 of file QueryBond.h.

Member Data Documentation

◆ dp_query

QUERYBOND_QUERY* RDKit::QueryBond::dp_query {nullptr}
protected

Definition at line 117 of file QueryBond.h.

Referenced by QueryBond().


The documentation for this class was generated from the following file: