13#include "../RDKitBase.h"
19#include <boost/scoped_ptr.hpp>
29 std::vector<boost::shared_ptr<ROMol>>
mols;
34 std::unique_ptr<ExplicitBitVect>
49 void add(boost::shared_ptr<ROMol> newMol,
50 const std::vector<int> &rlabel_attachments) {
52 for (
auto &mol :
mols) {
53 if (newMol.get() == mol.get()) {
58 if (
mols.size() > 0) {
60 if (isMolHydrogen(*newMol)) {
74 std::copy(rlabel_attachments.begin(), rlabel_attachments.end(),
77 mols.push_back(newMol);
78 static const std::regex remove_isotopes_regex(
"\\[\\d*\\*\\]");
83 remove_isotopes_regex,
"*"));
100 std::map<int, int> rlabelsUsedCount;
102 for (ROMol::AtomIterator atIt =
combinedMol->beginAtoms();
107 rlabelsUsedCount[rlabel] += 1;
110 return rlabelsUsedCount;
114 auto attachmentString = std::accumulate(
116 [](std::string s,
int a) {
117 return s.empty() ? std::to_string(a)
118 : std::move(s) +
',' + std::to_string(a);
120 std::stringstream ss;
121 ss <<
"RG " << attachmentString <<
" " << getSmiles();
126 void computeIsHydrogen() {
127 for (
const auto &mol :
mols) {
128 if (!isMolHydrogen(*mol)) {
136 bool isMolHydrogen(ROMol &mol) {
137 for (ROMol::AtomIterator atIt = mol.beginAtoms(); atIt != mol.endAtoms();
140 if (atom->getAtomicNum() > 1) {
152 std::string getSmiles()
const {
The class for representing atoms.
bool getPropIfPresent(const std::string &key, T &res) const
RWMol is a molecule class that is intended to be edited.
RDKIT_RDGENERAL_EXPORT const std::string internalRgroupSmiles
RDKIT_CHEMTRANSFORMS_EXPORT ROMol * combineMols(const ROMol &mol1, const ROMol &mol2, RDGeom::Point3D offset=RDGeom::Point3D(0, 0, 0))
Combined two molecules to create a new one.
RDKIT_SMILESPARSE_EXPORT std::string MolToSmiles(const ROMol &mol, const SmilesWriteParams ¶ms)
returns canonical SMILES for a molecule
RDKIT_RGROUPDECOMPOSITION_EXPORT const std::string RLABEL
RDKIT_RGROUPDECOMPOSITION_EXPORT const std::string SIDECHAIN_RLABELS
A single rgroup attached to a given core.
boost::shared_ptr< RWMol > combinedMol
std::vector< boost::shared_ptr< ROMol > > mols
std::set< int > attachments
std::vector< int > fingerprintOnBits
std::map< int, int > getNumBondsToRlabels() const
bool multiple_attachments
std::string toString() const
std::vector< std::string > smilesVect
void add(boost::shared_ptr< ROMol > newMol, const std::vector< int > &rlabel_attachments)
std::unique_ptr< ExplicitBitVect > fingerprint