Go to the documentation of this file.
5 #ifndef BALL_STRUCTURE_SMARTES_PARSER_H
6 #define BALL_STRUCTURE_SMARTES_PARSER_H
50 CHIRAL_CLASS_UNSPECIFIED = 1,
161 void setNot(
bool is_not) { not_ = is_not; }
364 bool equals(
const Atom* atom)
const;
405 bool isInternal()
const {
return internal_; }
433 bool isNot()
const {
return is_not_; }
436 void setNot(
bool is_not) { is_not_ = is_not; }
524 bool isInternal()
const {
return internal_; }
564 void setNot(
bool is_not) { is_not_ = is_not; }
586 EdgeIterator begin() {
return edges_.begin(); }
657 SPAtom* createAtom(
const String& symbol,
bool in_bracket =
false);
679 void setSSSR(
const std::vector<std::vector<Atom*> >& sssr);
711 const std::set<SPNode*>&
getNodes()
const {
return nodes_; }
714 const std::set<SPEdge*>&
getEdges()
const {
return edges_; }
744 static vector<std::set<const Atom*> >*
sssr_;
776 #endif // BALL_STRUCTURE_SMARTS_PARSER_H
SPNode * getRoot() const
returns the root SPNode of the tree
SPEdge * getFirstEdge() const
returns the first edge (for tree use)
Atom * atom_
the atom which this sp_atom belongs to
void addRecursiveEdge(SPEdge *edge)
adds a recursive edge to the tree
SPNode * getSecondSPNode() const
returns the second SPNode of this edge
std::map< Size, std::vector< SPNode * > > ring_connections_
the ring connection sorted by index of the SMARTS pattern
void setSSSR(const std::vector< std::vector< Atom * > > &sssr)
sets the SSSR
Size getDefaultValence(const Atom *atom) const
return the number of valences of the given atom
bool isNot() const
returns true if negation is enabled
bool not_
general negation flag
void dumpTreeRecursive_(SPNode *node, Size depth)
dump method for the tree
void dumpTreeRecursive_(SPEdge *edge, Size depth)
dump method for the tree
LogicalOperator log_op_
in brackets flag
bool internal_
internal flag
int component_no_
the actual component number
virtual ~Property()
Destructor.
Edge representation of the smarts parser graph.
SPNode(const SPNode &sp_node)
Copy constructor.
static State state
static member for the parser itself
void setSecondSPEdge(SPEdge *second)
set the second SPEdge (second tree child)
virtual ~SPBond()
Destructor.
SPAtom * sp_atom_
SPAtom associated with this SPNode.
void setInternal(bool internal)
sets the internal flag
void addRingConnection(SPNode *spnode, Size index)
adds a ring connection, SPNode with an index used in the SMARTS pattern
bool is_not_
negation flag
bool needs_SSSR_
sssr needed flag
Parser state (used by the parser itself)
void setZEType(ZEIsomerType type)
sets the Z/E isomer type
LogicalOperator getLogicalOperator() const
returns the asociated logical operator (for the child edges)
Property struct of smarts parser atom.
void setFirstSPNode(SPNode *first)
set the first SPNode of this edge
void addSPEdge(SPEdge *sp_edge)
flag whether the pattern is in brackets
bool isNot() const
return true if a general negation is set
SPNode * getFirstSPNode() const
returns the first SPNode of this edge
void setProperty(PropertyType type, const Element *element)
sets a Element
SPEdge * getFirstSPEdge() const
returns the first SPEdge (first tree child)
std::vector< SPEdge * >::const_iterator EdgeConstIterator
constant edge iterator
bool getNeedsSSSR() const
returns true if the SMARTS pattern contains ring related parts
void dumpTree()
dumps the tree to cerr
Smarts Parser Atom class.
bool hasComponentGrouping() const
returns true if the component level grouping was enabled
SPAtom * getSPAtom() const
returns the associated SPAtom
SPBond * getSPBond() const
returns the corresponding SPBond of this edge
SPEdge * getSecondEdge() const
returns the second edge (for tree use)
ChiralClass chiral_class_value
EdgeConstIterator begin() const
non-mutable access to begin of edges list
void setProperty(PropertyType type, ChiralClass chirality)
sets a chirality value
SPNode * getPartnerSPNode(SPNode *node)
returns the partner; either the first or the second SPNode
virtual ~SmartsParser()
Destructor.
void parse(const String &s)
std::set< PropertyType > not_properties_
the properties which are negated
bool isRecursive() const
returns true if the tree represents a recursive SMARTS pattern
Property(PropertyType type, ChiralClass value)
Detailed constructor with type and chiral class definition.
virtual ~SPEdge()
Destructor.
std::map< PropertyType, PropertyValue > properties_
the properties of this SPAtom
virtual ~SPNode()
Destructor.
void setBondOrder(SPBondOrder bond_order)
sets the bond order
void setSecondEdge(SPEdge *second)
sets the second edge (for tree use)
SPEdge * getSecondSPEdge() const
returns the second SPEdge (second tree child)
std::vector< SPEdge * > edges_
edges list
EdgeConstIterator end() const
non-mutable access to end of edges list
@ CCW_DEFAULT_OR_UNSPECIFIED
SmartsParser * current_parser
@ NOT_NECESSARILY_CONNECTED
const std::set< SPEdge * > & getEdges() const
returns the edges stored in the tree
SPNode * first_
first SPNode
Property(PropertyType type, bool value)
Detailed constructor with type and flag.
SPEdge * second_edge_
second SPEdge
static SmartsParser * current_parser_
current instance
void setRecursive(bool recursive)
sets the recursive flag
SPAtom(const String &symbol)
copy constructor
void addPropertiesFromSPAtom(SPAtom *sp_atom)
adds properties from another SPAtom
SPBondOrder
the bond orders supported by SMARTS-patterns
bool recursive_
recursive flag
Size getComponentNumber() const
returns the component number
bool component_grouping_
component level grouping flag
void setNot(bool is_not)
sets the negation flag
void setLogicalOperator(LogicalOperator log_op)
sets the logical operator associated with the SPNode
SPBondOrder bond_order_
the bond order
void setInternal(bool internal)
set this edge to a internal edge
PropertyValue getValue() const
returns the value of the property
PropertyType
enum of all properties possible for a smarts parser atom
virtual ~SPAtom()
destructor
SPNode * second_
second SPNode
std::map< Size, std::vector< SPNode * > > getRingConnections() const
returns the ring connections sorted by index from SMARTS pattern
ZEIsomerType ze_type_
Z/E isomer type.
bool is_not_
negotiation flag
void setRecursive(bool recursive)
sets the recursive flag
SmartsParser(const SmartsParser &parser)
Copy constructor.
SPNode(SPAtom *atom)
Detailed constructor with an atom.
SPNode * root_
the root node of the tree
void setSecondSPNode(SPNode *second)
sets the second SPNode of this edge
EdgeIterator end()
mutable access to end of edges list
bool hasRecursiveEdge(SPEdge *edge) const
returns true if the tree has the given recursive edge
void setComponentNumber(int no)
set the component no of the component level grouping
void setRoot(SPNode *root)
sets the root SPNode of the tree
ChiralClass
chiral class definitions CW = clock wise, CCW = counter clock wise
Size countEdges() const
counts the number of edges
void setNot(bool is_not)
set the negation flag
void setNextComponentNumberToSubTree(SPNode *spnode)
gets the next component no and assigns it to the subtree
void setNeedsSSSR(bool needs_sssr)
sets the sssr needed flag
void setLogicalOperator(LogicalOperator log_op)
sets the associated logical operator (for the child edges)
Size countProperties() const
returns the number of properties
void setNotProperty(PropertyType type)
negotiates the property definition
Property(PropertyType type, const Element *value)
Detailed constructor with type and Element.
SPEdge * second_edge_
second edge
LogicalOperator log_op_
logical operator associated with the SPEdges
const Element * element_value
void setFirstSPEdge(SPEdge *first)
set the first SPEdge (first tree child)
void setSPAtom(SPAtom *sp_atom)
set the associated SPAtom
std::set< SPNode * > nodes_
the nodes
int component_no_
component level
std::set< SPEdge * > rec_edges_
the recursive edges
SPEdge * first_edge_
first edge
const std::set< SPNode * > & getNodes() const
returns the eodes stored in the tree
static vector< std::set< const Atom * > > * sssr_
the sssr
void setProperty(Property property)
sets a property
void clear()
clear the tree
void setProperty(PropertyType type, bool flag)
sets a flag
SPEdge * first_edge_
first SPEdge
LogicalOperator getLogicalOperator() const
returns the logical operator of the SPNode
bool recursive_
recursive flag
SPBondOrder getBondOrder() const
returns the bond order
Representation of a node in the smarts parser graph.
SPBond * bond_
associated bond
SPBond(SPBondOrder bond_order)
Detailed constructor with bond order.
bool internal_
internal flag
void setSPBond(SPBond *sp_bond)
sets the corresponding SPBond of this edge
std::vector< SPEdge * >::iterator EdgeIterator
non-constant edge iterator
BALL_EXTERN_VARIABLE const double E
Euler's number - base of the natural logarithm.
possible types of the properties
Size countRealValences(const Atom *atom) const
returns the number of available valences of the given atom
void setFirstEdge(SPEdge *first)
sets the first edge (for tree use)
bool equals(const Bond *bond) const
std::set< SPEdge * > edges_
the edges
@ CW_DEFAULT_OR_UNSPECIFIED
SPEdge(const SPEdge &sp_edge)
Copy constructor.
void setNot(bool is_not)
set the general negation to the bool given
void setComponentGrouping(bool component_grouping)
sets the component level flag
SPNode(SPNode *first, LogicalOperator log_op, SPNode *second)
Detailed constructor with two nodes and a logical operator.
Bond representation of the smarts parser.
PropertyValue getProperty(PropertyType type)
returns a value of the given property type
SPBond(SPAtom *first, SPAtom *second, SPBondOrder bond_order)
Detailed constructor with.
Size getNumberOfImplicitHydrogens(const Atom *atom) const
returns the number of implicit hydrogens of the given atom
bool getNot() const
returns the negation flag
bool isRecursive() const
returns true if the SPNode is a recursive node (from recursive SMARTS)
@ NONCHIRAL_OR_UNSPECIFIED
bool hasProperty(PropertyType type) const
returns true if the property is set
void addNode(SPNode *node)
adds a node to the tree
void addEdge(SPEdge *edge)
adds an edge to the tree