RDKit
Open-source cheminformatics and machine learning.
RGroupMatch.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2017 Novartis Institutes for BioMedical Research
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #ifndef RGROUP_MATCH_DATA
11 #define RGROUP_MATCH_DATA
12 #include "RGroupData.h"
13 
14 namespace RDKit {
15 typedef boost::shared_ptr<RGroupData> RData;
16 typedef std::map<int, RData> R_DECOMP;
17 
18 //! RGroupMatch is the decomposition for a single molecule
19 struct RGroupMatch {
20  size_t core_idx; // index of the matching core
22  R_DECOMP rgroups; // rlabel->RGroupData mapping
23  RWMOL_SPTR matchedCore; // Core with dummy or query atoms and bonds matched
24 
25  RGroupMatch(size_t core_index, size_t numberMissingUserRGroups,
26  R_DECOMP input_rgroups, RWMOL_SPTR matchedCore)
27  : core_idx(core_index),
29  rgroups(std::move(input_rgroups)),
30  matchedCore(std::move(matchedCore)) {}
31 
32  std::string toString() const {
33  auto rGroupsString = std::accumulate(
34  rgroups.cbegin(), rgroups.cend(), std::string(),
35  [](std::string s, const std::pair<int, RData>& rgroup) {
36  return std::move(s) + "\n\t(" + std::to_string(rgroup.first) + ':' +
37  rgroup.second->toString() + ')';
38  });
39  std::stringstream ss;
40  ss << "Match coreIdx " << core_idx << " missing count "
41  << numberMissingUserRGroups << " " << rGroupsString;
42  return ss.str();
43  }
44 };
45 
46 } // namespace RDKit
47 #endif
Std stuff.
Definition: Abbreviations.h:19
boost::shared_ptr< RGroupData > RData
Definition: RGroupMatch.h:15
std::map< int, RData > R_DECOMP
Definition: RGroupMatch.h:16
boost::shared_ptr< RWMol > RWMOL_SPTR
Definition: RWMol.h:216
RGroupMatch is the decomposition for a single molecule.
Definition: RGroupMatch.h:19
size_t numberMissingUserRGroups
Definition: RGroupMatch.h:21
RWMOL_SPTR matchedCore
Definition: RGroupMatch.h:23
std::string toString() const
Definition: RGroupMatch.h:32
RGroupMatch(size_t core_index, size_t numberMissingUserRGroups, R_DECOMP input_rgroups, RWMOL_SPTR matchedCore)
Definition: RGroupMatch.h:25