29 #ifndef CDPL_CHEM_FRAGMENTGENERATOR_HPP
30 #define CDPL_CHEM_FRAGMENTGENERATOR_HPP
200 unsigned int rule_id,
unsigned int atom1_label,
unsigned int atom2_label);
239 std::size_t frag1Idx;
240 std::size_t frag2Idx;
243 unsigned int atom1Label;
244 unsigned int atom2Label;
248 typedef std::vector<FragmentationRule> FragmentationRuleList;
249 typedef std::vector<ExcludePattern> ExcludePatternList;
250 typedef std::vector<FragmentLink> FragmentLinkList;
517 std::size_t start_idx)
const;
524 unsigned int atom1Label;
525 unsigned int atom2Label;
528 typedef std::vector<SplitBondData> SplitBondDataArray;
530 FragmentationRuleList fragRules;
531 ExcludePatternList exclPatterns;
532 FragmentLinkList fragLinks;
534 FragmentFilterFunction fragFilterFunc;
538 SplitBondDataArray splitBondData;
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::FragmentList.
Definition of class CDPL::Chem::MolecularGraph.
Definition of class CDPL::Chem::SubstructureSearch.
Abstract base class representing a chemical atom and its bonded neighborhood.
Definition: Atom.hpp:57
Abstract base class representing a chemical bond between two Chem::Atom instances.
Definition: Bond.hpp:54
A pattern descriptor specifying bonds that shall not be cleaved.
Definition: FragmentGenerator.hpp:125
ExcludePattern(const MolecularGraph::SharedPointer &match_ptn, unsigned int rule_id)
Constructs a rule-specific exclude pattern.
unsigned int getRuleID() const
Returns the rule ID this exclusion applies to (only meaningful when isGeneric() is false).
bool isGeneric() const
Tells whether this exclude pattern applies to all rules (generic) or only to a specific one.
void setMatchPattern(const MolecularGraph::SharedPointer &ptn)
Sets the substructure match pattern.
void setRuleID(unsigned int id)
Sets the rule ID this exclusion applies to.
void setGeneric(bool generic)
Sets whether this exclude pattern is generic.
ExcludePattern(const MolecularGraph::SharedPointer &match_ptn)
Constructs a generic exclude pattern (applies to all fragmentation rules).
const MolecularGraph::SharedPointer & getMatchPattern() const
Returns the substructure match pattern.
Records the connectivity between two fragments produced by a single bond cleavage.
Definition: FragmentGenerator.hpp:187
const Bond & getBond() const
Returns the cleaved bond from the original molecular graph.
unsigned int getAtom2Label() const
Returns the label of the second atom of the cleaved bond.
std::size_t getFragment1Index() const
Returns the index of the first fragment in the output fragment list.
FragmentLink(std::size_t frag1_idx, std::size_t frag2_idx, const Bond &bond, unsigned int rule_id, unsigned int atom1_label, unsigned int atom2_label)
Constructs the fragment link.
unsigned int getAtom1Label() const
Returns the label of the first atom of the cleaved bond.
unsigned int getRuleID() const
Returns the rule ID that triggered the cleavage of this bond.
std::size_t getFragment2Index() const
Returns the index of the second fragment in the output fragment list.
A single fragmentation rule, consisting of a bond substructure match pattern and a numeric rule ID.
Definition: FragmentGenerator.hpp:79
void setMatchPattern(const MolecularGraph::SharedPointer &ptn)
Sets the bond substructure match pattern of this rule.
unsigned int getID() const
Returns the rule identifier.
void setID(unsigned int id)
Sets the rule identifier.
const MolecularGraph::SharedPointer & getMatchPattern() const
Returns the bond substructure match pattern of this rule.
FragmentationRule(const MolecularGraph::SharedPointer &match_ptn, unsigned int id)
Constructs the fragmentation rule.
Generic rule-based molecule fragmentation engine that splits a molecular graph along bonds matching u...
Definition: FragmentGenerator.hpp:62
void removeFragmentationRule(std::size_t idx)
Removes the fragmentation rule at index idx.
void addExcludePattern(const MolecularGraph::SharedPointer &match_ptn, unsigned int rule_id)
Registers a rule-specific exclude pattern.
FragmentLinkList::const_iterator ConstFragmentLinkIterator
A constant iterator over the generated fragment links.
Definition: FragmentGenerator.hpp:276
ConstFragmentLinkIterator getFragmentLinksBegin() const
Returns a constant iterator pointing to the first fragment link.
ExcludePatternList::iterator ExcludePatternIterator
A mutable iterator over the registered exclude patterns.
Definition: FragmentGenerator.hpp:271
FragmentationRule & getFragmentationRule(std::size_t idx)
Returns the fragmentation rule at index idx.
bool splitBondsIncluded() const
Tells whether the split (cleaved) bonds are retained in the output fragments.
FragmentationRuleIterator getFragmentationRulesBegin()
Returns a mutable iterator pointing to the first registered fragmentation rule.
ConstFragmentationRuleIterator getFragmentationRulesBegin() const
Returns a constant iterator pointing to the first registered fragmentation rule.
void clearExcludePatterns()
Removes all registered exclude patterns.
FragmentationRuleIterator getFragmentationRulesEnd()
Returns a mutable iterator pointing one past the last registered fragmentation rule.
std::shared_ptr< FragmentGenerator > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated FragmentGenerator instances.
Definition: FragmentGenerator.hpp:68
const FragmentLink & getFragmentLink(std::size_t idx) const
Returns the fragment link at index idx.
ConstFragmentationRuleIterator getFragmentationRulesEnd() const
Returns a constant iterator pointing one past the last registered fragmentation rule.
const ExcludePattern & getExcludePattern(std::size_t idx) const
Returns the exclude pattern at index idx.
ConstExcludePatternIterator getExcludePatternsEnd() const
Returns a constant iterator pointing one past the last registered exclude pattern.
virtual ~FragmentGenerator()
Virtual destructor.
Definition: FragmentGenerator.hpp:292
ConstFragmentLinkIterator getFragmentLinksEnd() const
Returns a constant iterator pointing one past the last fragment link.
std::size_t getNumFragmentLinks() const
Returns the number of fragment links produced by the most recent generate() call.
FragmentationRuleList::const_iterator ConstFragmentationRuleIterator
A constant iterator over the registered fragmentation rules.
Definition: FragmentGenerator.hpp:256
const FragmentFilterFunction & getFragmentFilterFunction() const
Returns the predicate used to filter the generated fragments.
void setFragmentFilterFunction(const FragmentFilterFunction &func)
Sets the predicate used to filter the generated fragments (fragments for which the predicate returns ...
const FragmentationRule & getFragmentationRule(std::size_t idx) const
Returns the fragmentation rule at index idx.
std::size_t getNumExcludePatterns() const
Returns the number of registered exclude patterns.
std::size_t getNumFragmentationRules() const
Returns the number of registered fragmentation rules.
FragmentGenerator(const FragmentGenerator &gen)
Constructs a copy of the FragmentGenerator instance gen.
FragmentGenerator & operator=(const FragmentGenerator &gen)
Replaces the state of this generator by a copy of the state of gen.
ExcludePatternIterator getExcludePatternsBegin()
Returns a mutable iterator pointing to the first registered exclude pattern.
void addFragmentationRule(const MolecularGraph::SharedPointer &match_ptn, unsigned int rule_id)
Registers a new fragmentation rule by its bond substructure match pattern and rule ID.
ConstExcludePatternIterator getExcludePatternsBegin() const
Returns a constant iterator pointing to the first registered exclude pattern.
FragmentGenerator()
Constructs the FragmentGenerator instance.
void addExcludePattern(const ExcludePattern &excl_ptn)
Appends a copy of the pre-built exclude pattern excl_ptn.
ExcludePattern & getExcludePattern(std::size_t idx)
Returns the exclude pattern at index idx.
std::function< bool(const MolecularGraph &)> FragmentFilterFunction
Type of a predicate accepting/rejecting a generated fragment.
Definition: FragmentGenerator.hpp:73
void addExcludePattern(const MolecularGraph::SharedPointer &match_ptn)
Registers a generic exclude pattern (applies to all fragmentation rules).
void includeSplitBonds(bool include)
Specifies whether the split (cleaved) bonds shall be retained in the output fragments.
FragmentationRuleList::iterator FragmentationRuleIterator
A mutable iterator over the registered fragmentation rules.
Definition: FragmentGenerator.hpp:261
void addFragmentationRule(const FragmentationRule &rule)
Appends a copy of the pre-built fragmentation rule rule.
void clearFragmentationRules()
Removes all registered fragmentation rules.
void generate(const MolecularGraph &molgraph, FragmentList &frag_list, bool append=false)
Performs the fragmentation of molgraph and appends the resulting fragments to frag_list.
ExcludePatternIterator getExcludePatternsEnd()
Returns a mutable iterator pointing one past the last registered exclude pattern.
void removeExcludePattern(std::size_t idx)
Removes the exclude pattern at index idx.
ExcludePatternList::const_iterator ConstExcludePatternIterator
A constant iterator over the registered exclude patterns.
Definition: FragmentGenerator.hpp:266
Data structure for the storage of Chem::Fragment objects.
Definition: FragmentList.hpp:49
Concrete Chem::MolecularGraph implementation that stores references to a selectable subset of atoms a...
Definition: Fragment.hpp:57
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
Subgraph-isomorphism search of a query molecular graph against a target molecular graph,...
Definition: SubstructureSearch.hpp:74
CDPL_CHEM_API void splitIntoFragments(const MolecularGraph &molgraph, FragmentList &frag_list, const Util::BitSet &split_bond_mask, bool append=false)
Splits the molecular graph molgraph into connected fragments by removing the bonds flagged in split_b...
boost::dynamic_bitset BitSet
Dynamic bitset class.
Definition: BitSet.hpp:46
The namespace of the Chemical Data Processing Library.