RDKit: RDKit::QueryAtom Class Reference

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
RDKit::QueryAtom Class Reference

Class for storing atomic queries. More...

`#include <QueryAtom.h>`

Inheritance diagram for RDKit::QueryAtom:

## Public Types
typedef Queries::Query< int, Atom const *, true > | QUERYATOM_QUERY
Public Types inherited from RDKit::Atom
enum | HybridizationType { UNSPECIFIED = 0 , S , SP , SP2 , SP3 , SP2D , SP3D , SP3D2 , OTHER }
| store hybridization More...
enum | ChiralType { CHI_UNSPECIFIED = 0 , CHI_TETRAHEDRAL_CW , CHI_TETRAHEDRAL_CCW , CHI_OTHER , CHI_TETRAHEDRAL , CHI_ALLENE , CHI_SQUAREPLANAR , CHI_TRIGONALBIPYRAMIDAL , CHI_OCTAHEDRAL }
| store type of chirality More...
enum class | ValenceType : std::uint8_t { IMPLICIT = 0 , EXPLICIT }
typedef Queries::Query< int, Atom const *, true > | QUERYATOM_QUERY

## Public Member Functions
| QueryAtom ()
| QueryAtom (int num)
| QueryAtom (const Atom &other)
| QueryAtom (const QueryAtom &other)
QueryAtom & | operator= (const QueryAtom &other)
| QueryAtom (QueryAtom &&other) noexcept
QueryAtom & | operator= (QueryAtom &&other) noexcept
| ~QueryAtom () override
Atom * | copy () const override
| returns a copy of this query, owned by the caller
bool | hasQuery () const override
std::string | getQueryType () const override
| returns the label associated to this query
void | setQuery (QUERYATOM_QUERY *what) override
| replaces our current query with the value passed in
QUERYATOM_QUERY * | getQuery () const override
| returns our current query
void | expandQuery (QUERYATOM_QUERY *what, Queries::CompositeQueryType how=Queries::COMPOSITE_AND, bool maintainOrder=true) override
| expands our current query
bool | Match (Atom const *what) const override
| returns true if we match Atom `what`
bool | QueryMatch (QueryAtom const *what) const
| returns true if our query details match those of QueryAtom `what`
Public Member Functions inherited from RDKit::Atom
| Atom ()
| Atom (unsigned int num)
| construct an Atom with a particular atomic number
| Atom (const std::string &what)
| Atom (const Atom &other)
Atom & | operator= (const Atom &other)
| Atom (Atom &&other)=default
Atom & | operator= (Atom &&other)=default
virtual | ~Atom ()
int | getAtomicNum () const
| returns our atomic number
void | setAtomicNum (int newNum)
| sets our atomic number
std::string | getSymbol () const
| returns our symbol (determined by our atomic number)
bool | hasOwningMol () const
| returns whether or not this instance belongs to a molecule
ROMol & | getOwningMol () const
| returns a reference to the ROMol that owns this instance
unsigned int | getIdx () const
| returns our index within the ROMol
void | setIdx (unsigned int index)
| sets our index within the ROMol
template<class U>
void | setIdx (const U index)
| overload
unsigned int | getDegree () const
unsigned int | getTotalDegree () const
unsigned int | getTotalNumHs (bool includeNeighbors=false) const
| returns the total number of Hs (implicit and explicit) that this Atom is bound to
unsigned int | getTotalValence () const
| returns the total valence (implicit and explicit) for an atom
unsigned int | getNumImplicitHs () const
| returns the number of implicit Hs this Atom is bound to
unsigned int | getValence (ValenceType which) const
| returns the valence (explicit or implicit) of this atom
int | getExplicitValence () const
| returns the explicit valence (including Hs) of this atom
int | getImplicitValence () const
| returns the implicit valence for this Atom
bool | hasValenceViolation () const
| returns whether the atom has a valency violation or not
unsigned int | getNumRadicalElectrons () const
| returns the number of radical electrons for this Atom
void | setNumRadicalElectrons (unsigned int num)
int | getFormalCharge () const
| returns the formal charge of this atom
void | setFormalCharge (int what)
| set's the formal charge of this atom
void | setNoImplicit (bool what)
| sets our `noImplicit` flag, indicating whether or not we are allowed to have implicit Hs
bool | getNoImplicit () const
| returns the `noImplicit` flag
void | setNumExplicitHs (unsigned int what)
| sets our number of explicit Hs
unsigned int | getNumExplicitHs () const
| returns our number of explicit Hs
void | setIsAromatic (bool what)
| sets our `isAromatic` flag, indicating whether or not we are aromatic
bool | getIsAromatic () const
| returns our `isAromatic` flag
double | getMass () const
| returns our mass
void | setIsotope (unsigned int what)
| sets our isotope number
unsigned int | getIsotope () const
| returns our isotope number
void | setChiralTag (ChiralType what)
| sets our `chiralTag`
bool | invertChirality ()
| inverts our `chiralTag`, returns whether or not a change was made
ChiralType | getChiralTag () const
| returns our `chiralTag`
void | setHybridization (HybridizationType what)
| sets our hybridization
HybridizationType | getHybridization () const
| returns our hybridization
int | getPerturbationOrder (const INT_LIST &probe) const
| returns the perturbation order for a list of integers
void | updatePropertyCache (bool strict=true)
| calculates any of our lazy `properties`
bool | needsUpdatePropertyCache () const
void | clearPropertyCache ()
int | calcExplicitValence (bool strict=true)
| calculates and returns our explicit valence
int | calcImplicitValence (bool strict=true)
| calculates and returns our implicit valence
AtomMonomerInfo * | getMonomerInfo ()
const AtomMonomerInfo * | getMonomerInfo () const
void | setMonomerInfo (AtomMonomerInfo *info)
| takes ownership of the pointer
void | setAtomMapNum (int mapno, bool strict=true)
| Set the atom map Number of the atom.
int | getAtomMapNum () const
void | setFlags (std::uint64_t flags)
std::uint64_t | getFlags () const
std::uint64_t & | getFlags ()
Public Member Functions inherited from RDKit::RDProps
| RDProps ()
| RDProps (const RDProps &rhs)
RDProps & | operator= (const RDProps &rhs)
| RDProps (RDProps &&o) noexcept=default
RDProps & | operator= (RDProps &&rhs) noexcept=default
void | clear ()
const Dict & | getDict () const
| gets the underlying Dictionary
Dict & | getDict ()
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>
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

## Additional Inherited Members
Static Public Attributes inherited from RDKit::Atom
static constexpr unsigned int | NOATOM
Protected Member Functions inherited from RDKit::Atom
void | setOwningMol (ROMol *other)
| sets our owning molecule
void | setOwningMol (ROMol &other)
| sets our owning molecule
void | initAtom ()
void | initFromOther (const Atom &other)
Protected Attributes inherited from RDKit::Atom
bool | df_isAromatic
bool | df_noImplicit
std::uint8_t | d_numExplicitHs
std::int8_t | d_formalCharge
std::uint8_t | d_atomicNum
std::int8_t | d_implicitValence
std::int8_t | d_explicitValence
std::uint8_t | d_numRadicalElectrons
std::uint8_t | d_chiralTag
std::uint8_t | d_hybrid
std::uint16_t | d_isotope
atomindex_t | d_index
std::uint64_t | d_flags = 0ul
ROMol * | dp_mol
AtomMonomerInfo * | dp_monomerInfo
Protected Attributes inherited from RDKit::RDProps
Dict | d_props

## Detailed Description

Class for storing atomic queries.

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

Definition at line 28 of file QueryAtom.h.

## Member Typedef Documentation

## ◆ QUERYATOM_QUERY

typedef Queries::Query<int, Atom const *, true> RDKit::QueryAtom::QUERYATOM_QUERY

Definition at line 30 of file QueryAtom.h.

## Constructor & Destructor Documentation

## ◆ QueryAtom() [1/5]

RDKit::QueryAtom::QueryAtom | ( |  | ) |
| inline

Definition at line 32 of file QueryAtom.h.

References RDKit::Atom::Atom().

Referenced by operator=(), operator=(), QueryAtom(), QueryAtom(), and QueryMatch().

## ◆ QueryAtom() [2/5]

RDKit::QueryAtom::QueryAtom | ( | int | num | ) |
| inlineexplicit

Definition at line 33 of file QueryAtom.h.

References RDKit::Atom::Atom(), and RDKit::makeAtomNumQuery().

## ◆ QueryAtom() [3/5]

RDKit::QueryAtom::QueryAtom | ( | const Atom & | other | ) |
| inlineexplicit

Definition at line 34 of file QueryAtom.h.

References RDKit::Atom::Atom(), RDKit::Atom::getAtomicNum(), RDKit::Atom::getFormalCharge(), RDKit::Atom::getIsotope(), RDKit::Atom::getNumRadicalElectrons(), and RDKit::makeAtomNumQuery().

## ◆ QueryAtom() [4/5]

RDKit::QueryAtom::QueryAtom | ( | const QueryAtom & | other | ) |
| inline

Definition at line 50 of file QueryAtom.h.

References RDKit::Atom::Atom(), and QueryAtom().

## ◆ QueryAtom() [5/5]

RDKit::QueryAtom::QueryAtom | ( | QueryAtom && | other | ) |
| inlinenoexcept

Definition at line 71 of file QueryAtom.h.

References RDKit::Atom::Atom(), and QueryAtom().

## ◆ ~QueryAtom()

RDKit::QueryAtom::~QueryAtom | ( |  | ) |
| override

## Member Function Documentation

## ◆ copy()

Atom * RDKit::QueryAtom::copy | ( |  | ) | const
| overridevirtual

returns a copy of this query, owned by the caller

Reimplemented from RDKit::Atom.

References RDKit::Atom::Atom().

## ◆ expandQuery()

void RDKit::QueryAtom::expandQuery | ( | QUERYATOM_QUERY * | what,
|  | Queries::CompositeQueryType | how = Queries::COMPOSITE_AND,
|  | bool | maintainOrder = true )
| overridevirtual

expands our current query

Parameters

  what | the 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.
  how | the 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::Atom.

References Queries::COMPOSITE_AND.

## ◆ getQuery()

QUERYATOM_QUERY * RDKit::QueryAtom::getQuery | ( |  | ) | const
| inlineoverridevirtual

returns our current query

Reimplemented from RDKit::Atom.

Definition at line 100 of file QueryAtom.h.

## ◆ getQueryType()

std::string RDKit::QueryAtom::getQueryType | ( |  | ) | const
| inlineoverridevirtual

returns the label associated to this query

Reimplemented from RDKit::Atom.

Definition at line 92 of file QueryAtom.h.

## ◆ hasQuery()

bool RDKit::QueryAtom::hasQuery | ( |  | ) | const
| inlineoverridevirtual

Reimplemented from RDKit::Atom.

Definition at line 89 of file QueryAtom.h.

## ◆ Match()

bool RDKit::QueryAtom::Match | ( | Atom const * | what | ) | const
| overridevirtual

returns true if we match Atom `what`

Reimplemented from RDKit::Atom.

References RDKit::Atom::Atom().

## ◆ operator=() [1/2]

QueryAtom & RDKit::QueryAtom::operator= | ( | const QueryAtom & | other | ) |
| inline

Definition at line 57 of file QueryAtom.h.

References Queries::Query< MatchFuncArgType, DataFuncArgType, needsConversion >::copy(), RDKit::Atom::operator=(), and QueryAtom().

Referenced by operator=().

## ◆ operator=() [2/2]

QueryAtom & RDKit::QueryAtom::operator= | ( | QueryAtom && | other | ) |
| inlinenoexcept

Definition at line 74 of file QueryAtom.h.

References operator=(), and QueryAtom().

## ◆ QueryMatch()

bool RDKit::QueryAtom::QueryMatch | ( | QueryAtom const * | what | ) | const

returns true if our query details match those of QueryAtom `what`

References QueryAtom().

## ◆ setQuery()

void RDKit::QueryAtom::setQuery | ( | QUERYATOM_QUERY * | what | ) |
| inlineoverridevirtual

replaces our current query with the value passed in

Reimplemented from RDKit::Atom.

Definition at line 95 of file QueryAtom.h.

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

- QueryAtom.h