Go to the documentation of this file.
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_;
281 #endif // BALL_STRUCTURE_SMARTSMATCHER_H
std::vector< std::pair< const SPNode *, const Atom * > > & first_matches
reference to the first matches in the core structure
void clear()
deletes all contents
RecStructCore_ * getNextFree()
returns the a free RecStructCore_ of the pool (creates new ones if needed)
void add(const RecStruct_ &rec_struct)
adds the content of the given struct
std::vector< std::set< const SPEdge * > > & visited_edges
reference to the visited edges in the core structure
std::vector< std::set< const Atom * > > Match
SmartsParser::SPEdge SPEdge
Edge representation of the smarts parser graph.
bool has_user_sssr_
user SSSR set?
std::vector< std::set< const SPEdge * > > visited_edges
contains vector of visited edges of the Smarts tree of different matches
std::vector< std::set< const Bond * > > & visited_bonds
reference to the visited bonds in the core structure
SmartsParser::SPBond SPBond
std::vector< std::set< const Atom * > > visited_atoms
contains vector of visited atoms of different matches
RecStructCore_(const RecStructCore_ &)
copy constructor
SmartsParser::SPNode SPNode
SmartsParser::SPAtom SPAtom
Smarts Parser Atom class.
a wrapper class which is used as an interface in the matching code to the pool
std::vector< std::set< const Atom * > > matched_atoms
container which contains a vector of matched atoms from different matches
RecStruct_(const RecStruct_ &rec_struct)
copy constructor
void evaluate_(RecStruct_ &rs, SPNode *start_node, const Atom *start_atom)
method for the evaluation of a pseudo-tree
void clear()
method that deletes all content from the containers
core structure of the recursive matching algorithm for the object pool
void unsetSSSR()
this function is used to cause the matcher to do an ring perception if needed (do not use the set SSS...
std::vector< std::map< const SPNode *, const Atom * > > mapped_atoms
container which contains a vector of mappings from different matches
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...
std::map< SPNode *, std::vector< std::set< const Atom * > > > rec_matches_
matches from the recurive part
std::vector< std::pair< const SPNode *, const Atom * > > first_matches
contains the first matched atoms of different matches (needed for recursive Smarts)
std::vector< std::set< const Bond * > > visited_bonds
contains vector of visited bonds of different matches
bool evaluate_node_(RecStruct_ &rs, SPNode *start_node, const Atom *start_atom)
method for evaluating a node of a pseudo-tree
virtual ~RecStructPool_()
destructor
RecStruct_()
default constructor
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
virtual ~RecStruct_()
destructor
std::vector< std::set< const Atom * > > & matched_atoms
reference to the matched atoms in the core structure
virtual ~RecStructCore_()
destructor
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 match(std::vector< Match > &matches, Molecule &mol, const std::vector< String > &smarts)
method to match several Smarts patterns given as a vector of strings
std::vector< std::map< const SPNode *, const Atom * > > & mapped_atoms
reference to the mapped SPNodes to Atoms in the core structure
void setSSSR(const std::vector< std::vector< Atom * > > &sssr)
sets an SSSR which is used instead of doing an ring perception
RecStructCore_()
default constructor
virtual ~SmartsMatcher()
destructor
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...
static boost::shared_ptr< RecStructPool_ > pool_
the pool of rec struct objects
void add(const RecStruct_ &rec_struct, Size i)
adds the the ith part of the content of the given struct
Representation of a node in the smarts parser graph.
std::vector< std::set< const Atom * > > & visited_atoms
reference to the visited atoms in the core structure
RecStructPool_()
default constructors
std::vector< std::vector< Atom * > > sssr_
user sssr
void destroy(Position pos)
frees the structure at position pos
Bond representation of the smarts parser.
void dump(const String &name, Size depth_=0)
dumps the contents (for debugging)
class which does the pool operations of the RecStructCore_ pool
Position getLastPosition()
returns the position of the last RecStructCore_* from getNextFree()