29 #ifndef CDPL_CHEM_SUBSTRUCTUREHISTOGRAMCALCULATOR_HPP
30 #define CDPL_CHEM_SUBSTRUCTUREHISTOGRAMCALCULATOR_HPP
68 typedef std::vector<Pattern> PatternList;
102 bool all_matches =
true,
bool unique_matches =
true);
137 std::size_t priority;
162 bool all_matches =
true,
bool unique_matches =
true);
261 template <
typename T>
272 typedef std::function<void(std::size_t)> HistoUpdateFunction;
274 template <
typename T>
275 class HistoUpdateFunctor
279 HistoUpdateFunctor(
T& histo):
282 void operator()(std::size_t
id)
291 void doCalculate(
const MolecularGraph& molgraph,
const HistoUpdateFunction& func);
293 void init(
const MolecularGraph& molgraph);
295 void processPattern(
const Pattern& ptn,
const HistoUpdateFunction& func);
296 bool processMatch(
const AtomBondMapping& mapping,
const Pattern& ptn,
const HistoUpdateFunction& func);
298 typedef std::pair<Util::BitSet, Util::BitSet> AtomBondMask;
299 typedef std::map<std::size_t, AtomBondMask> PriorityToAtomBondMaskMap;
301 const MolecularGraph* molGraph;
302 PatternList patterns;
303 SubstructureSearch subSearch;
304 PriorityToAtomBondMaskMap matchedSubstructMasks;
305 AtomBondMask testingAtomBondMask;
312 template <
typename T>
315 doCalculate(molgraph, HistoUpdateFunctor<T>(histo));
Declaration of type CDPL::Util::BitSet.
Definition of the preprocessor macro CDPL_CHEM_API.
#define CDPL_CHEM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of class CDPL::Chem::MolecularGraph.
Definition of class CDPL::Chem::SubstructureSearch.
Abstract base class for representations of a chemical structure as a graph of bonded atoms.
Definition: MolecularGraph.hpp:57
std::shared_ptr< MolecularGraph > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MolecularGraph instances.
Definition: MolecularGraph.hpp:63
Stores a single substructure query molecular graph, its histogram ID, its priority and match-handling...
Definition: SubstructureHistogramCalculator.hpp:90
Pattern(const MolecularGraph::SharedPointer &molgraph, std::size_t id, std::size_t priority=0, bool all_matches=true, bool unique_matches=true)
Constructs a Pattern instance for the specified values.
bool processUniqueMatchesOnly() const
Tells whether only one of multiple equivalent mappings is processed per match.
const MolecularGraph::SharedPointer & getStructure() const
Returns the query molecular graph of this pattern.
std::size_t getPriority() const
Returns the pattern priority.
bool processAllMatches() const
Tells whether all substructure matches are processed.
std::size_t getID() const
Returns the histogram bin ID of this pattern.
Counts occurrences of registered substructure patterns in a molecular graph, emitting the per-pattern...
Definition: SubstructureHistogramCalculator.hpp:62
PatternIterator end()
Returns a mutable iterator pointing one past the last registered pattern (range-based for support).
PatternIterator begin()
Returns a mutable iterator pointing to the first registered pattern (range-based for support).
ConstPatternIterator begin() const
Returns a constant iterator pointing to the first registered pattern (range-based for support).
void removePattern(const PatternIterator &it)
Removes the registered pattern referenced by it.
SubstructureHistogramCalculator & operator=(const SubstructureHistogramCalculator &gen)
Replaces the state of this calculator by a copy of the state of gen.
ConstPatternIterator end() const
Returns a constant iterator pointing one past the last registered pattern (range-based for support).
ConstPatternIterator getPatternsEnd() const
Returns a constant iterator pointing one past the last registered pattern.
PatternList::iterator PatternIterator
A mutable iterator over the registered patterns.
Definition: SubstructureHistogramCalculator.hpp:84
PatternIterator getPatternsBegin()
Returns a mutable iterator pointing to the first registered pattern.
PatternIterator getPatternsEnd()
Returns a mutable iterator pointing one past the last registered pattern.
void addPattern(const MolecularGraph::SharedPointer &molgraph, std::size_t id, std::size_t priority=0, bool all_matches=true, bool unique_matches=true)
Registers a new pattern by its query molecular graph and per-pattern settings.
std::size_t getNumPatterns() const
Returns the number of registered patterns.
void removePattern(std::size_t idx)
Removes the registered pattern at index idx.
void addPattern(const Pattern &pattern)
Appends a copy of the pre-built pattern pattern.
PatternList::const_iterator ConstPatternIterator
A constant iterator over the registered patterns.
Definition: SubstructureHistogramCalculator.hpp:79
SubstructureHistogramCalculator()
Constructs an empty SubstructureHistogramCalculator instance.
void clear()
Removes all registered patterns.
SubstructureHistogramCalculator(const SubstructureHistogramCalculator &gen)
Constructs a copy of the SubstructureHistogramCalculator instance gen.
void calculate(const MolecularGraph &molgraph, T &histo)
Counts substructure occurrences in molgraph and writes the per-pattern hit counts to histo.
Definition: SubstructureHistogramCalculator.hpp:313
const Pattern & getPattern(std::size_t idx) const
Returns the registered pattern at index idx.
ConstPatternIterator getPatternsBegin() const
Returns a constant iterator pointing to the first registered pattern.
std::shared_ptr< SubstructureHistogramCalculator > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated SubstructureHistogramCalculator i...
Definition: SubstructureHistogramCalculator.hpp:74
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
boost::dynamic_bitset BitSet
Dynamic bitset class.
Definition: BitSet.hpp:46
The namespace of the Chemical Data Processing Library.