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,
133 SPBond(SPBondOrder bond_order);
152 void setBondOrder(SPBondOrder bond_order);
161 void setNot(
bool is_not) { not_ = is_not; }
164 bool equals(
const Bond* bond)
const;
246 void operator = (
const Property& rhs);
321 void setProperty(PropertyType type,
int int_value);
325 void setProperty(PropertyType type,
bool flag);
328 void setProperty(PropertyType type,
const Element* element);
331 void setProperty(PropertyType type,
ChiralClass chirality);
334 void setProperty(
Property property);
337 void addPropertiesFromSPAtom(
SPAtom* sp_atom);
340 void setNotProperty(PropertyType type);
343 bool hasProperty(PropertyType type)
const;
346 PropertyValue getProperty(PropertyType type);
349 Size countProperties()
const;
352 Size getDefaultValence(
const Atom* atom)
const;
355 Size countRealValences(
const Atom* atom)
const;
358 Size getNumberOfImplicitHydrogens(
const Atom* atom)
const;
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_; }
534 void setRecursive(
bool recursive);
564 void setNot(
bool is_not) { is_not_ = is_not; }
586 EdgeIterator begin() {
return edges_.begin(); }
652 void parse(
const String& s);
657 SPAtom* createAtom(
const String& symbol,
bool in_bracket =
false);
673 void addRingConnection(SPNode* spnode,
Size index);
676 std::map<Size, std::vector<SPNode*> > getRingConnections()
const;
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_; }
729 void setNextComponentNumberToSubTree(SPNode* spnode);
744 static vector<std::set<const Atom*> >*
sssr_;
747 void dumpTreeRecursive_(
SPNode* node,
Size depth);
750 void dumpTreeRecursive_(
SPEdge* edge,
Size depth);
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
bool isNot() const
returns true if negation is enabled
bool not_
general negation flag
LogicalOperator log_op_
in brackets flag
bool internal_
internal flag
int component_no_
the actual component number
Edge representation of the smarts parser graph.
static State state
static member for the parser itself
void setSecondSPEdge(SPEdge *second)
set the second SPEdge (second tree child)
SPAtom * sp_atom_
SPAtom associated with this SPNode.
void setInternal(bool internal)
sets the internal flag
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
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
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
SPNode * getPartnerSPNode(SPNode *node)
returns the partner; either the first or the second SPNode
std::set< PropertyType > not_properties_
the properties which are negated
bool isRecursive() const
returns true if the tree represents a recursive SMARTS pattern
std::map< PropertyType, PropertyValue > properties_
the properties of this SPAtom
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
const BALL_EXTERN_VARIABLE double E
Euler's number - base of the natural logarithm.
SPNode * first_
first SPNode
SPEdge * second_edge_
second SPEdge
static SmartsParser * current_parser_
current instance
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
SPNode * second_
second SPNode
ZEIsomerType ze_type_
Z/E isomer type.
bool is_not_
negotiation flag
void setRecursive(bool recursive)
sets the recursive flag
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 setNeedsSSSR(bool needs_sssr)
sets the sssr needed flag
void setLogicalOperator(LogicalOperator log_op)
sets the associated logical operator (for the child edges)
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
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
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
possible types of the properties
void setFirstEdge(SPEdge *first)
sets the first edge (for tree use)
std::set< SPEdge * > edges_
the edges
@ CW_DEFAULT_OR_UNSPECIFIED
void setNot(bool is_not)
set the general negation to the bool given
void setComponentGrouping(bool component_grouping)
sets the component level flag
Bond representation of the smarts parser.
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
void addNode(SPNode *node)
adds a node to the tree
void addEdge(SPEdge *edge)
adds an edge to the tree