RDKit
Open-source cheminformatics and machine learning.
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>
16 
17 namespace RDKit {
18 namespace MolFragmenter {
20  unsigned int atom1Label, atom2Label;
21  unsigned int atom1Type, atom2Type;
24 };
25 
26 //! \brief Fragments a molecule by breaking a set of bonds
27 //!
28 /*!
29 
30  \param mol - the molecule to be modified
31  \param bondIndices - indices of the bonds to be broken
32 
33  optional:
34  \param addDummies - toggles addition of dummy atoms to indicate where
35  bonds were broken
36  \param dummyLabels - used to provide the labels to be used for the dummies.
37  the first element in each pair is the label for the dummy
38  that replaces the bond's beginAtom, the second is for the
39  dummy that replaces the bond's endAtom. If not provided, the
40  dummies are labeled with atom indices.
41  \param bondTypes - used to provide the bond type to use between the
42  fragments and the dummy atoms. If not provided, defaults to single.
43  \param nCutsPerAtom - used to return the number of bonds that were
44  cut at each atom. Should be nAtoms long.
45 
46  \return a new ROMol with the modifications
47  The client is responsible for deleting this molecule.
48 
49 */
51  const ROMol &mol, const std::vector<unsigned int> &bondIndices,
52  bool addDummies = true,
53  const std::vector<std::pair<unsigned int, unsigned int> > *dummyLabels = 0,
54  const std::vector<Bond::BondType> *bondTypes = 0,
55  std::vector<unsigned int> *nCutsPerAtom = 0);
56 //! \overload
58  const ROMol &mol, const std::vector<FragmenterBondType> &bondPatterns,
59  const std::map<unsigned int, ROMOL_SPTR> *atomEnvirons = 0,
60  std::vector<unsigned int> *nCutsPerAtom = 0);
62  const ROMol &mol, const std::vector<unsigned int> &bondIndices,
63  std::vector<ROMOL_SPTR> &resMols, unsigned int maxToCut = 1,
64  bool addDummies = true,
65  const std::vector<std::pair<unsigned int, unsigned int> > *dummyLabels = 0,
66  const std::vector<Bond::BondType> *bondTypes = 0,
67  std::vector<std::vector<unsigned int> > *nCutsPerAtom = 0);
68 
69 //! \brief Fragments a molecule by breaking all BRICS bonds
70 /*!
71  \return a new ROMol with the modifications
72  The client is responsible for deleting this molecule.
73 
74 */
76 
78  std::istream *inStream, std::map<unsigned int, std::string> &defs,
79  const std::string &comment = "//", bool validate = true,
80  std::map<unsigned int, ROMOL_SPTR> *environs = 0);
82  const std::string &str, std::map<unsigned int, std::string> &defs,
83  const std::string &comment = "//", bool validate = true,
84  std::map<unsigned int, ROMOL_SPTR> *environs = 0);
85 RDKIT_CHEMTRANSFORMS_EXPORT void constructBRICSAtomTypes(std::map<unsigned int, std::string> &defs,
86  std::map<unsigned int, ROMOL_SPTR> *environs = 0);
88  std::istream *inStream,
89  const std::map<unsigned int, std::string> &atomTypes,
90  std::vector<FragmenterBondType> &defs, const std::string &comment = "//",
91  bool validate = true, bool labelByConnector = true);
93  const std::string &str,
94  const std::map<unsigned int, std::string> &atomTypes,
95  std::vector<FragmenterBondType> &defs, const std::string &comment = "//",
96  bool validate = true, bool labelByConnector = true);
97 RDKIT_CHEMTRANSFORMS_EXPORT void constructBRICSBondTypes(std::vector<FragmenterBondType> &defs);
98 }
99 }
100 #endif
RDKIT_CHEMTRANSFORMS_EXPORT void constructBRICSAtomTypes(std::map< unsigned int, std::string > &defs, std::map< unsigned int, ROMOL_SPTR > *environs=0)
Defines the primary molecule class ROMol as well as associated typedefs.
BondType
the type of Bond
Definition: Bond.h:56
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=0)
RDKIT_CHEMTRANSFORMS_EXPORT void constructBRICSBondTypes(std::vector< FragmenterBondType > &defs)
boost::shared_ptr< ROMol > ROMOL_SPTR
Std stuff.
Definition: Atom.h:30
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)
#define RDKIT_CHEMTRANSFORMS_EXPORT
Definition: export.h:73
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=0, const std::vector< Bond::BondType > *bondTypes=0, std::vector< std::vector< unsigned int > > *nCutsPerAtom=0)
RDKIT_CHEMTRANSFORMS_EXPORT ROMol * fragmentOnBRICSBonds(const ROMol &mol)
Fragments a molecule by breaking all BRICS bonds.
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=0, const std::vector< Bond::BondType > *bondTypes=0, std::vector< unsigned int > *nCutsPerAtom=0)
Fragments a molecule by breaking a set of bonds.