5 #ifndef BALL_STRUCTURE_SMARTSMATCHER_H
6 #define BALL_STRUCTURE_SMARTSMATCHER_H
8 #ifndef BALL_STRUCTURE_SMARTSPARSER_H
16 #include <boost/shared_ptr.hpp>
51 typedef std::vector<std::set<const Atom*> >
Match;
76 void match(std::vector<Match>& matches,
Molecule& mol,
const std::vector<String>& smarts);
79 void match(std::vector<Match>& matches,
Molecule& mol,
const std::vector<String>& smarts,
const std::set<const Atom*>& start_atoms);
82 void setSSSR(
const std::vector<std::vector<Atom*> >& sssr);
184 std::vector<RecStructCore_*> rec_struct_pool_;
187 std::vector<Position> free_list_;
252 static boost::shared_ptr<RecStructPool_>
pool_;
255 bool evaluateRingEdges_(
const std::set<const Atom*>& matching,
const std::map<const SPNode*, const Atom*>& mapping,
const String& smarts);
273 std::vector<std::vector<Atom*> >
sssr_;
SmartsParser::SPBond SPBond
std::vector< std::vector< Atom * > > sssr_
user sssr
bool evaluate_edge_(RecStruct_ &rs, SPEdge *start_node, const Atom *start_atom, const Bond *start_bond)
method for evaluating a edge of a pseudo-tree
void unsetSSSR()
this function is used to cause the matcher to do an ring perception if needed (do not use the set SSS...
SmartsParser::SPAtom SPAtom
void setSSSR(const std::vector< std::vector< Atom * > > &sssr)
sets an SSSR which is used instead of doing an ring perception
SmartsParser::SPNode SPNode
bool evaluate_node_(RecStruct_ &rs, SPNode *start_node, const Atom *start_atom)
method for evaluating a node of a pseudo-tree
SmartsParser::SPEdge SPEdge
std::map< SPNode *, std::vector< std::set< const Atom * > > > rec_matches_
matches from the recurive part
void match(std::vector< Match > &matches, Molecule &mol, const std::vector< String > &smarts, const std::set< const Atom * > &start_atoms)
method to match several Smarts patterns given as a vector of string. The atoms used for start matchin...
void evaluate_(RecStruct_ &rs, SPNode *start_node, const Atom *start_atom)
method for the evaluation of a pseudo-tree
virtual ~SmartsMatcher()
destructor
bool has_user_sssr_
user SSSR set?
static boost::shared_ptr< RecStructPool_ > pool_
the pool of rec struct objects
std::vector< std::set< const Atom * > > Match
void match(Match &matches, Molecule &mol, const String &smarts, const std::set< const Atom * > &start_atoms)
method to match a Smarts pattern given as a string to given molecule. The atoms which will be used fo...
bool evaluateRingEdges_(const std::set< const Atom * > &matching, const std::map< const SPNode *, const Atom * > &mapping, const String &smarts)
method for evaluation of ring edges, after the the smarts tree is matched to molcule
void match(Match &matches, Molecule &mol, const String &smarts)
method to match a Smarts pattern given as a string to given molecule
void match(std::vector< Match > &matches, Molecule &mol, const std::vector< String > &smarts)
method to match several Smarts patterns given as a vector of strings
SmartsMatcher()
default constructor
core structure of the recursive matching algorithm for the object pool
std::vector< std::set< const Atom * > > visited_atoms
contains vector of visited atoms of different matches
std::vector< std::set< const Bond * > > visited_bonds
contains vector of visited bonds of different matches
std::vector< std::set< const SPEdge * > > visited_edges
contains vector of visited edges of the Smarts tree of different matches
virtual ~RecStructCore_()
destructor
RecStructCore_(const RecStructCore_ &)
copy constructor
std::vector< std::map< const SPNode *, const Atom * > > mapped_atoms
container which contains a vector of mappings from different matches
void clear()
method that deletes all content from the containers
std::vector< std::pair< const SPNode *, const Atom * > > first_matches
contains the first matched atoms of different matches (needed for recursive Smarts)
RecStructCore_()
default constructor
std::vector< std::set< const Atom * > > matched_atoms
container which contains a vector of matched atoms from different matches
class which does the pool operations of the RecStructCore_ pool
void destroy(Position pos)
frees the structure at position pos
RecStructCore_ * getNextFree()
returns the a free RecStructCore_ of the pool (creates new ones if needed)
Position getLastPosition()
returns the position of the last RecStructCore_* from getNextFree()
virtual ~RecStructPool_()
destructor
RecStructPool_()
default constructors
a wrapper class which is used as an interface in the matching code to the pool
void dump(const String &name, Size depth_=0)
dumps the contents (for debugging)
virtual ~RecStruct_()
destructor
std::vector< std::set< const SPEdge * > > & visited_edges
reference to the visited edges in the core structure
RecStruct_(const RecStruct_ &rec_struct)
copy constructor
void clear()
deletes all contents
std::vector< std::map< const SPNode *, const Atom * > > & mapped_atoms
reference to the mapped SPNodes to Atoms in the core structure
std::vector< std::pair< const SPNode *, const Atom * > > & first_matches
reference to the first matches in the core structure
std::vector< std::set< const Atom * > > & visited_atoms
reference to the visited atoms in the core structure
std::vector< std::set< const Bond * > > & visited_bonds
reference to the visited bonds in the core structure
std::vector< std::set< const Atom * > > & matched_atoms
reference to the matched atoms in the core structure
void add(const RecStruct_ &rec_struct)
adds the content of the given struct
RecStruct_()
default constructor
void add(const RecStruct_ &rec_struct, Size i)
adds the the ith part of the content of the given struct
Bond representation of the smarts parser.
Smarts Parser Atom class.
Edge representation of the smarts parser graph.
Representation of a node in the smarts parser graph.