12#ifndef RDKIT_RGROUPDECOMP_H
13#define RDKIT_RGROUPDECOMP_H
15#include "../RDKitBase.h"
26 : success(success), score(score) {}
41 d_map[
rl.second] = std::make_pair(
false, (
rl.first > 0));
44 bool has(
int label)
const {
return d_map.find(label) != d_map.end(); }
45 bool getIsUsed(
int label)
const {
return d_map.at(label).first; }
46 void setIsUsed(
int label) { d_map[label].first =
true; }
50 std::map<int, std::pair<bool, bool>> d_map;
53struct RGroupDecompData;
63 int getMatchingCoreInternal(
RWMol &mol,
const RCore *&rcore,
64 std::vector<MatchVectType> &matches);
65 static void labelAtomBondIndices(
RWMol &mol);
66 void setTargetAtomBondIndices(
ROMol &mol,
bool includeBondsToRLabels)
const;
88 std::vector<MatchVectType> *matches =
nullptr);
114 const std::vector<ROMOL_SPTR> &cores,
const std::vector<ROMOL_SPTR> &mols,
120 const std::vector<ROMOL_SPTR> &cores,
const std::vector<ROMOL_SPTR> &mols,
130 auto t1 = std::chrono::steady_clock::now();
131 std::chrono::duration<double>
elapsed =
t1 - t0;
132 if (
elapsed.count() >= timeout) {
134 throw std::runtime_error(
"operation timed out");
RGroupRows getRGroupsAsRows() const
return rgroups in row order group[row][attachment_point] = ROMol
RGroupDecomposition(const std::vector< ROMOL_SPTR > &cores, const RGroupDecompositionParameters ¶ms=RGroupDecompositionParameters())
const RGroupDecompositionParameters & params() const
RGroupColumns getRGroupsAsColumns() const
return rgroups in column order group[attachment_point][row] = ROMol
RGroupDecomposition(const ROMol &core, const RGroupDecompositionParameters ¶ms=RGroupDecompositionParameters())
int add(const ROMol &mol)
RGroupDecompositionProcessResult processAndScore()
int getMatchingCoreIdx(const ROMol &mol, std::vector< MatchVectType > *matches=nullptr)
std::vector< std::string > getRGroupLabels() const
return the current group labels
RWMol is a molecule class that is intended to be edited.
void setIsUsed(int label)
bool getIsUsed(int label) const
bool isUserDefined(int label) const
UsedLabelMap(const std::map< int, int > &mapping)
bool has(int label) const
#define RDKIT_RGROUPDECOMPOSITION_EXPORT
bool rdvalue_is(const RDValue_cast_t)
std::map< std::string, ROMOL_SPTR > RGroupRow
std::vector< ROMOL_SPTR > RGroupColumn
std::map< std::string, RGroupColumn > RGroupColumns
bool checkForTimeout(const std::chrono::steady_clock::time_point &t0, double timeout, bool throwOnTimeout=true)
RDKIT_RGROUPDECOMPOSITION_EXPORT unsigned int RGroupDecompose(const std::vector< ROMOL_SPTR > &cores, const std::vector< ROMOL_SPTR > &mols, RGroupRows &rows, std::vector< unsigned int > *unmatched=nullptr, const RGroupDecompositionParameters &options=RGroupDecompositionParameters())
std::vector< RGroupRow > RGroupRows
boost::shared_ptr< RWMol > RWMOL_SPTR
RCore is the core common to a series of molecules.
RGroupDecompositionProcessResult(const bool success, const double score)
RGroupMatch is the decomposition for a single molecule.