RDKit
Open-source cheminformatics and machine learning.
RGroupUtils.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_UTILS
11 #define RGROUP_UTILS
12 
13 #include <GraphMol/RDKitBase.h>
14 #include "RGroupDecomp.h"
15 
16 #include <map>
17 namespace RDKit {
18 
19 RDKIT_RGROUPDECOMPOSITION_EXPORT extern const std::string RLABEL;
20 RDKIT_RGROUPDECOMPOSITION_EXPORT extern const std::string RLABEL_TYPE;
23 RDKIT_RGROUPDECOMPOSITION_EXPORT extern const std::string done;
24 RDKIT_RGROUPDECOMPOSITION_EXPORT extern const std::string
26 
27 const unsigned int EMPTY_CORE_LABEL = -100000;
28 
29 // Various places where rgroups can be labeled
30 // the order of precedence
31 enum class Labelling {
38 };
39 
40 //! return the user friendly name for the given labelling
41 std::string labellingToString(Labelling type);
42 
43 //! Get the RLabels,atom mapping for the current molecule
44 std::map<int, Atom *> getRlabels(const RWMol &mol);
45 
46 //! Remove the user labels from the atom
47 void clearInputLabels(Atom *atom);
48 
49 //! Set the rgroup label for the current atom, this also sets the
50 /// appropriate MDL or other label
51 bool setLabel(Atom *atom, int label, std::set<int> &labels, int &maxLabel,
52  bool relabel, Labelling type);
53 
54 //! Returns true if the core has a dummy atom
55 bool hasDummy(const RWMol &core);
56 
57 //! Returns true if the core atom is either an atom with multiple
58 /// connections or an atom with a single connection that has no user
59 /// defined rgroup label
61 
62 //! Return true if the atom has a user-defined R group label
63 bool isUserRLabel(const Atom &atom);
64 
65 // ! Return true if the atom is a terminal dummy R group (user labelled or
66 // unlabelled)
67 bool isDummyRGroupAttachment(const Atom &atom);
68 
69 //! Returns true if the core atom is either a dummy atom with multiple
70 /// connections or a dummy atom with a single connection that has no user
71 /// defined rgroup label
73  if (atom.getAtomicNum()) {
74  return false;
75  }
77 }
78 
79 //! Returns a JSON form
80 /// The prefix argument is added to each line in the output
82  const RGroupRow &rgr, const std::string &prefix = "");
83 //! Returns a JSON form
84 /// The prefix argument is added to each line in the output
86  const RGroupRows &rgr, const std::string &prefix = "");
87 //! Returns a JSON form
88 /// The prefix argument is added to each line in the output
90  const RGroupColumn &rgr, const std::string &prefix = "");
91 //! Returns a JSON form
92 /// The prefix argument is added to each line in the output
94  const RGroupColumns &rgr, const std::string &prefix = "");
95 
96 } // namespace RDKit
97 
98 #endif
pulls in the core RDKit functionality
The class for representing atoms.
Definition: Atom.h:68
int getAtomicNum() const
returns our atomic number
Definition: Atom.h:126
RWMol is a molecule class that is intended to be edited.
Definition: RWMol.h:32
#define RDKIT_RGROUPDECOMPOSITION_EXPORT
Definition: export.h:401
Std stuff.
Definition: Abbreviations.h:19
RDKIT_RGROUPDECOMPOSITION_EXPORT const std::string RLABEL_CORE_INDEX
std::map< int, Atom * > getRlabels(const RWMol &mol)
Get the RLabels,atom mapping for the current molecule.
std::string labellingToString(Labelling type)
return the user friendly name for the given labelling
RDKIT_RGROUPDECOMPOSITION_EXPORT const std::string done
RDKIT_RGROUPDECOMPOSITION_EXPORT const std::string UNLABELED_CORE_ATTACHMENT
std::map< std::string, ROMOL_SPTR > RGroupRow
Definition: RGroupDecomp.h:29
std::vector< ROMOL_SPTR > RGroupColumn
Definition: RGroupDecomp.h:32
bool isDummyRGroupAttachment(const Atom &atom)
bool setLabel(Atom *atom, int label, std::set< int > &labels, int &maxLabel, bool relabel, Labelling type)
void clearInputLabels(Atom *atom)
Remove the user labels from the atom.
std::map< std::string, RGroupColumn > RGroupColumns
Definition: RGroupDecomp.h:35
bool isAtomWithMultipleNeighborsOrNotDummyRGroupAttachment(const Atom &atom)
RDKIT_RGROUPDECOMPOSITION_EXPORT const std::string RLABEL
bool hasDummy(const RWMol &core)
Returns true if the core has a dummy atom.
RDKIT_RGROUPDECOMPOSITION_EXPORT const std::string SIDECHAIN_RLABELS
RDKIT_RGROUPDECOMPOSITION_EXPORT std::string toJSON(const RGroupRow &rgr, const std::string &prefix="")
bool isAnyAtomWithMultipleNeighborsOrNotUserRLabel(const Atom &atom)
Definition: RGroupUtils.h:72
RDKIT_RGROUPDECOMPOSITION_EXPORT const std::string RLABEL_TYPE
const unsigned int EMPTY_CORE_LABEL
Definition: RGroupUtils.h:27
bool isUserRLabel(const Atom &atom)
Return true if the atom has a user-defined R group label.
std::vector< RGroupRow > RGroupRows
Definition: RGroupDecomp.h:34