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 #ifndef _RD_MOLFRAGMENTER_H__
11 #define _RD_MOLFRAGMENTER_H__
12 
13 #include <istream>
14 #include <GraphMol/ROMol.h>
15 
16 namespace RDKit {
17  namespace MolFragmenter{
19  unsigned int atom1Label,atom2Label;
20  unsigned int atom1Type,atom2Type;
23  };
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  */
50  ROMol *fragmentOnBonds(const ROMol &mol,const std::vector<unsigned int> &bondIndices,
51  bool addDummies=true,
52  const std::vector< std::pair<unsigned int,unsigned int> > *dummyLabels=0,
53  const std::vector< Bond::BondType > *bondTypes=0,
54  std::vector<unsigned int> *nCutsPerAtom=0);
55  //! \overload
56  ROMol *fragmentOnBonds(const ROMol &mol,const std::vector<FragmenterBondType> &bondPatterns,
57  const std::map<unsigned int,ROMOL_SPTR> *atomEnvirons=0,
58  std::vector<unsigned int> *nCutsPerAtom=0);
59  void fragmentOnSomeBonds(const ROMol &mol,const std::vector<unsigned int> &bondIndices,
60  std::vector<ROMOL_SPTR> &resMols,
61  unsigned int maxToCut=1,
62  bool addDummies=true,
63  const std::vector< std::pair<unsigned int,unsigned int> > *dummyLabels=0,
64  const std::vector< Bond::BondType > *bondTypes=0,
65  std::vector<std::vector<unsigned int> > *nCutsPerAtom=0);
66 
67 
68  //! \brief Fragments a molecule by breaking all BRICS bonds
69  /*!
70  \return a new ROMol with the modifications
71  The client is responsible for deleting this molecule.
72 
73  */
74  ROMol *fragmentOnBRICSBonds(const ROMol &mol);
75 
76  void constructFragmenterAtomTypes(std::istream *inStream,std::map<unsigned int,std::string> &defs,
77  std::string comment="//",bool validate=true,
78  std::map<unsigned int,ROMOL_SPTR> *environs=0);
79  void constructFragmenterAtomTypes(const std::string &str,std::map<unsigned int,std::string> &defs,
80  std::string comment="//",bool validate=true,
81  std::map<unsigned int,ROMOL_SPTR> *environs=0);
82  void constructBRICSAtomTypes(std::map<unsigned int,std::string> &defs,
83  std::map<unsigned int,ROMOL_SPTR> *environs=0);
84  void constructFragmenterBondTypes(std::istream *inStream,
85  const std::map<unsigned int,std::string> &atomTypes,
86  std::vector<FragmenterBondType> &defs,
87  std::string comment="//",bool validate=true,
88  bool labelByConnector=true);
89  void constructFragmenterBondTypes(const std::string &str,
90  const std::map<unsigned int,std::string> &atomTypes,
91  std::vector<FragmenterBondType> &defs,
92  std::string comment="//",bool validate=true,
93  bool labelByConnector=true);
94  void constructBRICSBondTypes(std::vector<FragmenterBondType> &defs);
95  }
96 }
97 #endif
ROMol * fragmentOnBRICSBonds(const ROMol &mol)
Fragments a molecule by breaking all BRICS bonds.
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)
Defines the primary molecule class ROMol as well as associated typedefs.
BondType
the type of Bond
Definition: Bond.h:55
ROMol is a molecule class that is intended to have a fixed topology.
Definition: ROMol.h:105
void constructBRICSBondTypes(std::vector< FragmenterBondType > &defs)
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.
void constructBRICSAtomTypes(std::map< unsigned int, std::string > &defs, std::map< unsigned int, ROMOL_SPTR > *environs=0)
void constructFragmenterAtomTypes(std::istream *inStream, std::map< unsigned int, std::string > &defs, std::string comment="//", bool validate=true, std::map< unsigned int, ROMOL_SPTR > *environs=0)
boost::shared_ptr< ROMol > ROMOL_SPTR
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:28
void constructFragmenterBondTypes(std::istream *inStream, const std::map< unsigned int, std::string > &atomTypes, std::vector< FragmenterBondType > &defs, std::string comment="//", bool validate=true, bool labelByConnector=true)