File: ChemTransforms.h

package info (click to toggle)
rdkit 201203-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 37,840 kB
  • sloc: cpp: 93,902; python: 51,897; java: 5,192; ansic: 3,497; xml: 2,499; sql: 1,641; yacc: 1,518; lex: 1,076; makefile: 325; fortran: 183; sh: 153; cs: 51
file content (121 lines) | stat: -rw-r--r-- 4,824 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//
//  Copyright (C) 2006-2011 Greg Landrum
//
//   @@ All Rights Reserved @@
//  This file is part of the RDKit.
//  The contents are covered by the terms of the BSD license
//  which is included in the file license.txt, found at the root
//  of the RDKit source tree.
//
#ifndef _RD_CHEMTRANSFORMS_H__
#define _RD_CHEMTRANSFORMS_H__

#include <boost/smart_ptr.hpp>
#include <vector>

namespace RDKit{
  class ROMol;
  typedef boost::shared_ptr<ROMol>    ROMOL_SPTR;

  //! \brief Returns a copy of an ROMol with the atoms and bonds that 
  //!      match a pattern removed.
  /*!
      \param mol       the ROMol of interest
      \param query     the query ROMol
      \param replaceAll  if this is set all matches of the query to the substructure will
                         be removed. Default is to only remove the first.

      \return a copy of \c mol with the matching atoms and bonds (if any)
              removed.		       
  */
  ROMol *deleteSubstructs(const ROMol &mol, const ROMol &query,
			  bool replaceAll=false);

  //! \brief Returns a list of copies of an ROMol with the atoms and bonds that 
  //!      match a pattern replaced with the atoms contained in another molecule.
  /*!
     Bonds are created between the joining atom in the existing molecule
     and the atoms in the new molecule. So, using SMILES instead of molecules:
            replaceSubstructs('OC(=O)NCCNC(=O)O','C(=O)O','[X]') ->
	          ['[X]NCCNC(=O)O','OC(=O)NCCN[X]']
            replaceSubstructs('OC(=O)NCCNC(=O)O','C(=O)O','[X]',true) ->
	          ['[X]NCCN[X]']
     Chains should be handled "correctly":
            replaceSubstructs('CC(=O)C','C(=O)','[X]') ->
	          ['C[X]C']
     As should rings:
            replaceSubstructs('C1C(=O)C1','C(=O)','[X]') ->
	          ['C1[X]C1']
     And higher order branches:
            replaceSubstructs('CC(=O)(C)C','C(=O)','[X]') ->
	          ['C[X](C)C']
     Note that the client is responsible for making sure that the
       resulting molecule actually makes sense - this function does not
       perform sanitization.

      \param mol         the ROMol of interest
      \param query       the query ROMol
      \param replacement the ROMol to be inserted
      \param replaceAll  if this is true, only a single result, with all occurances
                         of the substructure replaced, will be returned.

      \return a vector of pointers to copies of \c mol with the matching atoms
          and bonds (if any) replaced

  */
  std::vector<ROMOL_SPTR> replaceSubstructs(const ROMol &mol, const ROMol &query,
					    const ROMol &replacement,
					    bool replaceAll=false);

  //! \brief Returns a copy of an ROMol with the atoms and bonds that 
  //!      don't fall within a substructure match removed.
  //!
  //!   dummy atoms are left to indicate attachment points.
  //!
  /*!
      \param mol       the ROMol of interest
      \param coreQuery a query ROMol to be used to match the core

      \return a copy of \c mol with the non-matching atoms and bonds (if any)
              removed and dummies at the connection points.		       
  */
  ROMol *replaceSidechains(const ROMol &mol, const ROMol &coreQuery);
			  
  //! \brief Returns a copy of an ROMol with the atoms and bonds that 
  //!      do fall within a substructure match removed.
  //!
  //!   dummy atoms are left to indicate attachment points.
  //!
  /*!
      Note that this is essentially identical to the replaceSidechains function, except we
      invert the query and replace the atoms that *do* match the query.

      \param mol            - the ROMol of interest
      \param coreQuery      - a query ROMol to be used to match the core
      \param replaceDummies - if set, atoms matching dummies in the core will also be replaced
      \param labelByIndex  - if set, the dummy atoms at attachment points are labelled with the
                             index+1 of the corresponding atom in the core
      \param requireDummyMatch - if set, only side chains that are connected to atoms in
                                 the core that have attached dummies will be considered.
                                 Molecules that have sidechains that are attached
                                 at other points will be rejected (NULL returned).

      \return a copy of \c mol with the non-matching atoms and bonds (if any)
              removed and dummies at the connection points. The client is responsible
              for deleting this molecule. If the core query is not matched, NULL is returned.
  */
  ROMol *replaceCore(const ROMol &mol, const ROMol &coreQuery,
                     bool replaceDummies=true,bool labelByIndex=false,
                     bool requireDummyMatch=false);
        

  ROMol *MurckoDecompose(const ROMol &mol);

  
}

#endif