12 #ifndef RDKIT_RGROUPDECOMP_H
13 #define RDKIT_RGROUPDECOMP_H
15 #include "../RDKitBase.h"
26 : success(success), score(score) {}
31 typedef std::map<std::string, ROMOL_SPTR>
RGroupRow;
40 for (
const auto &rl : mapping) {
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;
53 struct RGroupDecompData;
95 const std::vector<ROMOL_SPTR> &cores,
const std::vector<ROMOL_SPTR> &mols,
96 RGroupRows &rows, std::vector<unsigned int> *unmatched =
nullptr,
101 const std::vector<ROMOL_SPTR> &cores,
const std::vector<ROMOL_SPTR> &mols,
102 RGroupColumns &columns, std::vector<unsigned int> *unmatched =
nullptr,
107 double timeout,
bool throwOnTimeout =
true) {
111 auto t1 = std::chrono::steady_clock::now();
112 std::chrono::duration<double> elapsed = t1 - t0;
113 if (elapsed.count() >= timeout) {
114 if (throwOnTimeout) {
115 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())
RGroupColumns getRGroupsAsColumns() const
return rgroups in column order group[attachment_point][row] = ROMol
const RGroupDecompositionParameters & params() const
RGroupDecomposition(const ROMol &core, const RGroupDecompositionParameters ¶ms=RGroupDecompositionParameters())
int add(const ROMol &mol)
RGroupDecompositionProcessResult processAndScore()
std::vector< std::string > getRGroupLabels() const
return the current group labels
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
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
RGroupDecompositionProcessResult(const bool success, const double score)
RGroupMatch is the decomposition for a single molecule.