RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
MolFragmenter.h
Go to the documentation of this file.
1//
2// Copyright (C) 2013 Greg Landrum
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#include <RDGeneral/export.h>
11#ifndef _RD_MOLFRAGMENTER_H__
12#define _RD_MOLFRAGMENTER_H__
13
14#include <istream>
15#include <GraphMol/ROMol.h>
17
18namespace RDKit {
19namespace MolFragmenter {
26
27//! \brief Fragments a molecule by breaking a set of bonds
28//!
29/*!
30
31 \param mol - the molecule to be modified
32 \param bondIndices - indices of the bonds to be broken
33
34 optional:
35 \param addDummies - toggles addition of dummy atoms to indicate where
36 bonds were broken
37 \param dummyLabels - used to provide the labels to be used for the dummies.
38 the first element in each pair is the label for the dummy
39 that replaces the bond's beginAtom, the second is for the
40 dummy that replaces the bond's endAtom. If not provided, the
41 dummies are labeled with atom indices.
42 \param bondTypes - used to provide the bond type to use between the
43 fragments and the dummy atoms. If not provided, defaults to single.
44 \param nCutsPerAtom - used to return the number of bonds that were
45 cut at each atom. Should be nAtoms long.
46
47 \return a new ROMol with the modifications
48 The client is responsible for deleting this molecule.
49
50*/
52 const ROMol &mol, const std::vector<unsigned int> &bondIndices,
53 bool addDummies = true,
54 const std::vector<std::pair<unsigned int, unsigned int>> *dummyLabels =
55 nullptr,
56 const std::vector<Bond::BondType> *bondTypes = nullptr,
57 std::vector<unsigned int> *nCutsPerAtom = nullptr);
58//! \overload
60 const ROMol &mol, const std::vector<FragmenterBondType> &bondPatterns,
61 const std::map<unsigned int, ROMOL_SPTR> *atomEnvirons = nullptr,
62 std::vector<unsigned int> *nCutsPerAtom = nullptr);
64 const ROMol &mol, const std::vector<unsigned int> &bondIndices,
65 std::vector<ROMOL_SPTR> &resMols, unsigned int maxToCut = 1,
66 bool addDummies = true,
67 const std::vector<std::pair<unsigned int, unsigned int>> *dummyLabels =
68 nullptr,
69 const std::vector<Bond::BondType> *bondTypes = nullptr,
70 std::vector<std::vector<unsigned int>> *nCutsPerAtom = nullptr);
71
72//! \brief Fragments a molecule by breaking all BRICS bonds
73/*!
74 \return a new ROMol with the modifications
75 The client is responsible for deleting this molecule.
76
77*/
79
81 std::istream *inStream, std::map<unsigned int, std::string> &defs,
82 const std::string &comment = "//", bool validate = true,
83 std::map<unsigned int, ROMOL_SPTR> *environs = nullptr);
85 const std::string &str, std::map<unsigned int, std::string> &defs,
86 const std::string &comment = "//", bool validate = true,
87 std::map<unsigned int, ROMOL_SPTR> *environs = nullptr);
89 std::map<unsigned int, std::string> &defs,
90 std::map<unsigned int, ROMOL_SPTR> *environs = nullptr);
92 std::istream *inStream,
93 const std::map<unsigned int, std::string> &atomTypes,
94 std::vector<FragmenterBondType> &defs, const std::string &comment = "//",
95 bool validate = true, bool labelByConnector = true);
97 const std::string &str,
98 const std::map<unsigned int, std::string> &atomTypes,
99 std::vector<FragmenterBondType> &defs, const std::string &comment = "//",
100 bool validate = true, bool labelByConnector = true);
102 std::vector<FragmenterBondType> &defs);
103} // namespace MolFragmenter
104
105// n.b. AtomProperty must resolve to an unsigned integer value on an atom
106// property
107// clang-format off
110 Isotope,
112 AtomType,
114);
115// clang-format on
116
118 MolzipLabel label = MolzipLabel::AtomMapNumber;
119 std::vector<std::string> atomSymbols;
120 std::string atomProperty;
121 bool enforceValenceRules = true;
122 bool generateCoordinates = false;
123};
124
125RDKIT_CHEMTRANSFORMS_EXPORT std::unique_ptr<ROMol> molzip(
126 const ROMol &a, const ROMol &b,
127 const MolzipParams &params = MolzipParams());
128
129RDKIT_CHEMTRANSFORMS_EXPORT std::unique_ptr<ROMol> molzip(
130 const ROMol &a, const MolzipParams &params = MolzipParams());
131
132//! \brief Creates a molecule from an R group decomposition
133/*!
134 *
135 * @param decomposition - A list of molecules that comprises an R group
136 * decomposition. The core must be the first molecule in the list. If
137 * generateCoordinates is set in the parameters then aligned depiction
138 * coordinates will be set on the returned molecule and the input decomposition
139 *
140 * optional:
141 * @param params - molzip parameters
142 *
143 * @return the zipped molecule
144 */
145RDKIT_CHEMTRANSFORMS_EXPORT std::unique_ptr<ROMol> molzip(
146 std::vector<ROMOL_SPTR> &decomposition,
147 const MolzipParams &params = MolzipParams());
148
149//! \brief Molzip an RGroupRow back into the original molecule if possible
150/*! This correctly handles broken cycles that can happend during arbitrary
151 * RGroup Decomposition.
152 *
153 * @param row - rgroup row as returned by the rgroup decompisition
154 *
155 * optional:
156 * @param params - molzip parameters
157 *
158 * @return - the zipped molecule
159 */
160RDKIT_CHEMTRANSFORMS_EXPORT std::unique_ptr<ROMol> molzip(
161 const std::map<std::string, ROMOL_SPTR> &row,
162 const MolzipParams &params = MolzipParams());
163
164} // namespace RDKit
165#endif
#define BETTER_ENUM_CLASS(Enum, Underlying,...)
Definition BetterEnums.h:18
Defines the primary molecule class ROMol as well as associated typedefs.
BondType
the type of Bond
Definition Bond.h:56
#define RDKIT_CHEMTRANSFORMS_EXPORT
Definition export.h:57
RDKIT_CHEMTRANSFORMS_EXPORT void fragmentOnSomeBonds(const ROMol &mol, const std::vector< unsigned int > &bondIndices, std::vector< ROMOL_SPTR > &resMols, unsigned int maxToCut=1, bool addDummies=true, const std::vector< std::pair< unsigned int, unsigned int > > *dummyLabels=nullptr, const std::vector< Bond::BondType > *bondTypes=nullptr, std::vector< std::vector< unsigned int > > *nCutsPerAtom=nullptr)
RDKIT_CHEMTRANSFORMS_EXPORT void constructBRICSBondTypes(std::vector< FragmenterBondType > &defs)
RDKIT_CHEMTRANSFORMS_EXPORT void constructFragmenterAtomTypes(std::istream *inStream, std::map< unsigned int, std::string > &defs, const std::string &comment="//", bool validate=true, std::map< unsigned int, ROMOL_SPTR > *environs=nullptr)
RDKIT_CHEMTRANSFORMS_EXPORT ROMol * fragmentOnBonds(const ROMol &mol, const std::vector< unsigned int > &bondIndices, bool addDummies=true, const std::vector< std::pair< unsigned int, unsigned int > > *dummyLabels=nullptr, const std::vector< Bond::BondType > *bondTypes=nullptr, std::vector< unsigned int > *nCutsPerAtom=nullptr)
Fragments a molecule by breaking a set of bonds.
RDKIT_CHEMTRANSFORMS_EXPORT ROMol * fragmentOnBRICSBonds(const ROMol &mol)
Fragments a molecule by breaking all BRICS bonds.
RDKIT_CHEMTRANSFORMS_EXPORT void constructFragmenterBondTypes(std::istream *inStream, const std::map< unsigned int, std::string > &atomTypes, std::vector< FragmenterBondType > &defs, const std::string &comment="//", bool validate=true, bool labelByConnector=true)
RDKIT_CHEMTRANSFORMS_EXPORT void constructBRICSAtomTypes(std::map< unsigned int, std::string > &defs, std::map< unsigned int, ROMOL_SPTR > *environs=nullptr)
Std stuff.
bool rdvalue_is(const RDValue_cast_t)
RDKIT_CHEMTRANSFORMS_EXPORT std::unique_ptr< ROMol > molzip(const ROMol &a, const ROMol &b, const MolzipParams &params=MolzipParams())
boost::shared_ptr< ROMol > ROMOL_SPTR
std::string atomProperty
std::vector< std::string > atomSymbols