mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Enable chemist-friendly depiction of R-groups (#6866)
* - added a convenience function to relabel R-groups in a chemist-friendly fashion - exposed functionality to MinimalLib through a JSON option at molecule creation time - added relevant unit tests * changes in response to review * added missing library * fixed Python test --------- Co-authored-by: ptosco <paolo.tosco@novartis.com>
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
#include <GraphMol/ChemReactions/Reaction.h>
|
||||
#include <GraphMol/ChemReactions/ReactionParser.h>
|
||||
#include <GraphMol/ChemReactions/SanitizeRxn.h>
|
||||
#include <GraphMol/RGroupDecomposition/RGroupUtils.h>
|
||||
#include <RDGeneral/RDLog.h>
|
||||
|
||||
#include <sstream>
|
||||
@@ -104,6 +105,7 @@ RWMol *mol_from_input(const std::string &input,
|
||||
bool setAromaticity = true;
|
||||
bool fastFindRings = true;
|
||||
bool assignStereo = true;
|
||||
bool mappedDummiesAreRGroups = false;
|
||||
RWMol *res = nullptr;
|
||||
boost::property_tree::ptree pt;
|
||||
if (!details_json.empty()) {
|
||||
@@ -117,6 +119,7 @@ RWMol *mol_from_input(const std::string &input,
|
||||
LPT_OPT_GET(setAromaticity);
|
||||
LPT_OPT_GET(fastFindRings);
|
||||
LPT_OPT_GET(assignStereo);
|
||||
LPT_OPT_GET(mappedDummiesAreRGroups);
|
||||
}
|
||||
try {
|
||||
if (input.find("M END") != std::string::npos) {
|
||||
@@ -170,6 +173,9 @@ RWMol *mol_from_input(const std::string &input,
|
||||
if (mergeQueryHs) {
|
||||
MolOps::mergeQueryHs(*res);
|
||||
}
|
||||
if (mappedDummiesAreRGroups) {
|
||||
relabelMappedDummies(*res);
|
||||
}
|
||||
} catch (...) {
|
||||
delete res;
|
||||
res = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user