Loading...
Searching...
No Matches
BALL::SmartsParser Class Reference
Molecular Modeling » Molecular Structure » Matching of submolecular structures

`#include <BALL/STRUCTURE/smartsParser.h>`

## Classes

class | SPBond
| Bond representation of the smarts parser. More...
class | SPAtom
| Smarts Parser Atom class. More...
class | SPEdge
| Edge representation of the smarts parser graph. More...
class | SPNode
| Representation of a node in the smarts parser graph. More...
struct | State
| Parser state (used by the parser itself). More...

## Public Types

enum | ZEIsomerType { ANY_ZE = 1 , NONE , Z , E }

enum

ChiralClass {
CHIRAL_CLASS_UNSPECIFIED = 1 , NONCHIRAL , NONCHIRAL_OR_UNSPECIFIED , CW_DEFAULT ,
CW_DEFAULT_OR_UNSPECIFIED , CCW_DEFAULT , CCW_DEFAULT_OR_UNSPECIFIED , CW_TH ,
CW_TH_OR_UNSPECIFIED , CCW_TH , CCW_TH_OR_UNSPECIFIED , CW_AL ,
CW_AL_OR_UNSPECIFIED , CCW_AL , CCW_AL_OR_UNSPECIFIED , CW_SP ,
CW_SP_OR_UNSPECIFIED , CCW_SP , CCW_SP_OR_UNSPECIFIED , CW_TB ,
CW_TB_OR_UNSPECIFIED , CCW_TB , CCW_TB_OR_UNSPECIFIED , CW_OH ,
CW_OH_OR_UNSPECIFIED , CCW_OH , CCW_OH_OR_UNSPECIFIED
}

| chiral class definitions CW = clock wise, CCW = counter clock wise More...
enum | LogicalOperator { AND , OR , AND_LOW , NOOP }

## Public Member Functions

Constructors and Destructors
| SmartsParser ()
| Default constructor.
| SmartsParser (const SmartsParser &parser)
| Copy constructor.
virtual | ~SmartsParser ()
| Destructor.
Parsing
void | parse (const String &s)

## Accessors

static State | state
| static member for the parser itself
bool | needs_SSSR_
| sssr needed flag
bool | recursive_
| recursive flag
bool | component_grouping_
| component level grouping flag
std::map< Size, std::vector< SPNode * > > | ring_connections_
| the ring connection sorted by index of the SMARTS pattern
std::set< SPEdge * > | edges_
| the edges
std::set< SPNode * > | nodes_
| the nodes
std::set< SPEdge * > | rec_edges_
| the recursive edges
SPNode * | root_
| the root node of the tree
int | component_no_
| the actual component number
static vector< std::set< const Atom * > > * | sssr_
| the sssr
static SmartsParser * | current_parser_
| current instance
SPAtom * | createAtom (const String &symbol, bool in_bracket=false)
| creates a new atom of symbol
void | setRoot (SPNode *root)
| sets the root SPNode of the tree
SPNode * | getRoot () const
| returns the root SPNode of the tree
void | dumpTree ()
| dumps the tree to cerr
void | clear ()
| clear the tree
void | addRingConnection (SPNode *spnode, Size index)
| adds a ring connection, SPNode with an index used in the SMARTS pattern
std::map< Size, std::vector< SPNode * > > | getRingConnections () const
| returns the ring connections sorted by index from SMARTS pattern
void | setSSSR (const std::vector< std::vector< Atom * > > &sssr)
| sets the SSSR
void | setNeedsSSSR (bool needs_sssr)
| sets the sssr needed flag
bool | getNeedsSSSR () const
| returns true if the SMARTS pattern contains ring related parts
void | setRecursive (bool recursive)
| sets the recursive flag
bool | isRecursive () const
| returns true if the tree represents a recursive SMARTS pattern
void | setComponentGrouping (bool component_grouping)
| sets the component level flag
bool | hasComponentGrouping () const
| returns true if the component level grouping was enabled
const std::set< SPNode * > & | getNodes () const
| returns the eodes stored in the tree
const std::set< SPEdge * > & | getEdges () const
| returns the edges stored in the tree
void | addEdge (SPEdge *edge)
| adds an edge to the tree
void | addNode (SPNode *node)
| adds a node to the tree
bool | hasRecursiveEdge (SPEdge *edge) const
| returns true if the tree has the given recursive edge
void | addRecursiveEdge (SPEdge *edge)
| adds a recursive edge to the tree
void | setNextComponentNumberToSubTree (SPNode *spnode)
| gets the next component no and assigns it to the subtree
void | dumpTreeRecursive_ (SPNode *node, Size depth)
| dump method for the tree
void | dumpTreeRecursive_ (SPEdge *edge, Size depth)
| dump method for the tree

## Detailed Description

SMARTS Parser.

This class implements the parser for SMARTS patterns. The SMARTS string is converted into a tree, which is used for matching it to molecules. The tree has also some additional features, i.e. additional edges which allows also for graph features (kind of cyclic structure).

Definition at line 35 of file smartsParser.h.

## Member Enumeration Documentation

## ChiralClass

enum BALL::SmartsParser::ChiralClass

chiral class definitions CW = clock wise, CCW = counter clock wise

Enumerator
CHIRAL_CLASS_UNSPECIFIED |
NONCHIRAL |
NONCHIRAL_OR_UNSPECIFIED |
CW_DEFAULT |
CW_DEFAULT_OR_UNSPECIFIED |
CCW_DEFAULT |
CCW_DEFAULT_OR_UNSPECIFIED |
CW_TH |
CW_TH_OR_UNSPECIFIED |
CCW_TH |
CCW_TH_OR_UNSPECIFIED |
CW_AL |
CW_AL_OR_UNSPECIFIED |
CCW_AL |
CCW_AL_OR_UNSPECIFIED |
CW_SP |
CW_SP_OR_UNSPECIFIED |
CCW_SP |
CCW_SP_OR_UNSPECIFIED |
CW_TB |
CW_TB_OR_UNSPECIFIED |
CCW_TB |
CCW_TB_OR_UNSPECIFIED |
CW_OH |
CW_OH_OR_UNSPECIFIED |
CCW_OH |
CCW_OH_OR_UNSPECIFIED |

Definition at line 48 of file smartsParser.h.

## LogicalOperator

enum BALL::SmartsParser::LogicalOperator

The logical operator supported by SMARTS-pattern
'&' -> and
',' -> or
';' -> low precedence and

NOOP is just provided for convenience.

Enumerator
AND |
OR |
AND_LOW |
NOOP |

Definition at line 86 of file smartsParser.h.

## ZEIsomerType

enum BALL::SmartsParser::ZEIsomerType

Enumerator
ANY_ZE |
NONE |
Z |
E |

Definition at line 39 of file smartsParser.h.

## Constructor & Destructor Documentation

## SmartsParser() [1/2]

BALL::SmartsParser::SmartsParser | ( |  | ) |

Default constructor.

## SmartsParser() [2/2]

BALL::SmartsParser::SmartsParser | ( | const SmartsParser & | parser | ) |

Copy constructor.

## ~SmartsParser()

virtual BALL::SmartsParser::~SmartsParser | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## addEdge()

void BALL::SmartsParser::addEdge | ( | SPEdge * | edge | ) |

inline

adds an edge to the tree

Definition at line 717 of file smartsParser.h.

## addNode()

void BALL::SmartsParser::addNode | ( | SPNode * | node | ) |

inline

adds a node to the tree

Definition at line 720 of file smartsParser.h.

## addRecursiveEdge()

void BALL::SmartsParser::addRecursiveEdge | ( | SPEdge * | edge | ) |

inline

adds a recursive edge to the tree

Definition at line 726 of file smartsParser.h.

## addRingConnection()

void BALL::SmartsParser::addRingConnection | ( | SPNode * | spnode,
|  | Size | index )

adds a ring connection, SPNode with an index used in the SMARTS pattern

## clear()

void BALL::SmartsParser::clear | ( |  | ) |

clear the tree

## createAtom()

SPAtom * BALL::SmartsParser::createAtom | ( | const String & | symbol,
|  | bool | in_bracket = false )

creates a new atom of symbol

## dumpTree()

void BALL::SmartsParser::dumpTree | ( |  | ) |

dumps the tree to cerr

## dumpTreeRecursive_() [1/2]

void BALL::SmartsParser::dumpTreeRecursive_ | ( | SPEdge * | edge,
|  | Size | depth )

protected

dump method for the tree

## dumpTreeRecursive_() [2/2]

void BALL::SmartsParser::dumpTreeRecursive_ | ( | SPNode * | node,
|  | Size | depth )

protected

dump method for the tree

## getEdges()

const std::set< SPEdge * > & BALL::SmartsParser::getEdges | ( |  | ) | const

inline

returns the edges stored in the tree

Definition at line 714 of file smartsParser.h.

## getNeedsSSSR()

bool BALL::SmartsParser::getNeedsSSSR | ( |  | ) | const

inline

returns true if the SMARTS pattern contains ring related parts

Definition at line 685 of file smartsParser.h.

## getNodes()

const std::set< SPNode * > & BALL::SmartsParser::getNodes | ( |  | ) | const

inline

returns the eodes stored in the tree

Definition at line 711 of file smartsParser.h.

## getRingConnections()

std::map< Size, std::vector< SPNode * > > BALL::SmartsParser::getRingConnections | ( |  | ) | const

returns the ring connections sorted by index from SMARTS pattern

## getRoot()

SPNode * BALL::SmartsParser::getRoot | ( |  | ) | const

inline

returns the root SPNode of the tree

Definition at line 664 of file smartsParser.h.

## hasComponentGrouping()

bool BALL::SmartsParser::hasComponentGrouping | ( |  | ) | const

inline

returns true if the component level grouping was enabled

Definition at line 697 of file smartsParser.h.

## hasRecursiveEdge()

bool BALL::SmartsParser::hasRecursiveEdge | ( | SPEdge * | edge | ) | const

inline

returns true if the tree has the given recursive edge

Definition at line 723 of file smartsParser.h.

## isRecursive()

bool BALL::SmartsParser::isRecursive | ( |  | ) | const

inline

returns true if the tree represents a recursive SMARTS pattern

Definition at line 691 of file smartsParser.h.

## parse()

void BALL::SmartsParser::parse | ( | const String & | s | ) |

Parse a SMARTS string.

Exceptions

  BALL::Exception::ParseError |

## setComponentGrouping()

void BALL::SmartsParser::setComponentGrouping | ( | bool | component_grouping | ) |

inline

sets the component level flag

Definition at line 694 of file smartsParser.h.

## setNeedsSSSR()

void BALL::SmartsParser::setNeedsSSSR | ( | bool | needs_sssr | ) |

inline

sets the sssr needed flag

Definition at line 682 of file smartsParser.h.

## setNextComponentNumberToSubTree()

void BALL::SmartsParser::setNextComponentNumberToSubTree | ( | SPNode * | spnode | ) |

gets the next component no and assigns it to the subtree

## setRecursive()

void BALL::SmartsParser::setRecursive | ( | bool | recursive | ) |

inline

sets the recursive flag

Definition at line 688 of file smartsParser.h.

## setRoot()

void BALL::SmartsParser::setRoot | ( | SPNode * | root | ) |

inline

sets the root SPNode of the tree

Definition at line 661 of file smartsParser.h.

## setSSSR()

void BALL::SmartsParser::setSSSR | ( | const std::vector< std::vector< Atom * > > & | sssr | ) |

sets the SSSR

## Member Data Documentation

## component_grouping_

bool BALL::SmartsParser::component_grouping_

protected

component level grouping flag

Definition at line 741 of file smartsParser.h.

## component_no_

int BALL::SmartsParser::component_no_

protected

the actual component number

Definition at line 771 of file smartsParser.h.

## current_parser_

SmartsParser* BALL::SmartsParser::current_parser_

static protected

current instance

Definition at line 756 of file smartsParser.h.

## edges_

std::set<SPEdge*> BALL::SmartsParser::edges_

protected

the edges

Definition at line 759 of file smartsParser.h.

## needs_SSSR_

bool BALL::SmartsParser::needs_SSSR_

protected

sssr needed flag

Definition at line 735 of file smartsParser.h.

## nodes_

std::set<SPNode*> BALL::SmartsParser::nodes_

protected

the nodes

Definition at line 762 of file smartsParser.h.

## rec_edges_

std::set<SPEdge*> BALL::SmartsParser::rec_edges_

protected

the recursive edges

Definition at line 765 of file smartsParser.h.

## recursive_

bool BALL::SmartsParser::recursive_

protected

recursive flag

Definition at line 738 of file smartsParser.h.

## ring_connections_

std::map<Size, std::vector<SPNode*> > BALL::SmartsParser::ring_connections_

protected

the ring connection sorted by index of the SMARTS pattern

Definition at line 753 of file smartsParser.h.

## root_

SPNode* BALL::SmartsParser::root_

protected

the root node of the tree

Definition at line 768 of file smartsParser.h.

## sssr_

vector<std::set<const Atom*> >* BALL::SmartsParser::sssr_

static protected

the sssr

Definition at line 744 of file smartsParser.h.

## state

State BALL::SmartsParser::state

static

static member for the parser itself

Definition at line 708 of file smartsParser.h.