ChemTransforms.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2006-2008 Greg Landrum
00003 //
00004 //   @@ All Rights Reserved  @@
00005 //
00006 #ifndef _RD_CHEMTRANSFORMS_H__
00007 #define _RD_CHEMTRANSFORMS_H__
00008 
00009 #include <boost/smart_ptr.hpp>
00010 #include <vector>
00011 
00012 namespace RDKit{
00013   class ROMol;
00014   typedef boost::shared_ptr<ROMol>    ROMOL_SPTR;
00015 
00016   //! \brief Returns a copy of an ROMol with the atoms and bonds that 
00017   //!      match a pattern removed.
00018   /*!
00019       \param mol       the ROMol of interest
00020       \param query     the query ROMol
00021       \param replaceAll  if this is set all matches of the query to the substructure will
00022                          be removed. Default is to only remove the first.
00023 
00024       \return a copy of \c mol with the matching atoms and bonds (if any)
00025               removed.                 
00026   */
00027   ROMol *deleteSubstructs(const ROMol &mol, const ROMol &query,
00028                           bool replaceAll=false);
00029 
00030   //! \brief Returns a list of copies of an ROMol with the atoms and bonds that 
00031   //!      match a pattern replaced with the atoms contained in another molecule.
00032   /*!
00033      Bonds are created between the joining atom in the existing molecule
00034      and the atoms in the new molecule. So, using SMILES instead of molecules:
00035             replaceSubstructs('OC(=O)NCCNC(=O)O','C(=O)O','[X]') ->
00036                   ['[X]NCCNC(=O)O','OC(=O)NCCN[X]']
00037             replaceSubstructs('OC(=O)NCCNC(=O)O','C(=O)O','[X]',true) ->
00038                   ['[X]NCCN[X]']
00039      Chains should be handled "correctly":
00040             replaceSubstructs('CC(=O)C','C(=O)','[X]') ->
00041                   ['C[X]C']
00042      As should rings:
00043             replaceSubstructs('C1C(=O)C1','C(=O)','[X]') ->
00044                   ['C1[X]C1']
00045      And higher order branches:
00046             replaceSubstructs('CC(=O)(C)C','C(=O)','[X]') ->
00047                   ['C[X](C)C']
00048      Note that the client is responsible for making sure that the
00049        resulting molecule actually makes sense - this function does not
00050        perform sanitization.
00051 
00052       \param mol         the ROMol of interest
00053       \param query       the query ROMol
00054       \param replacement the ROMol to be inserted
00055       \param replaceAll  if this is true, only a single result, with all occurances
00056                          of the substructure replaced, will be returned.
00057 
00058       \return a vector of pointers to copies of \c mol with the matching atoms
00059           and bonds (if any) replaced
00060 
00061   */
00062   std::vector<ROMOL_SPTR> replaceSubstructs(const ROMol &mol, const ROMol &query,
00063                                             const ROMol &replacement,
00064                                             bool replaceAll=false);
00065 
00066   //! \brief Returns a copy of an ROMol with the atoms and bonds that 
00067   //!      don't fall within a substructure match removed.
00068   //!
00069   //!   dummy atoms are left to indicate attachment points.
00070   //!
00071   /*!
00072       \param mol       the ROMol of interest
00073       \param coreQuery a query ROMol to be used to match the core
00074 
00075       \return a copy of \c mol with the non-matching atoms and bonds (if any)
00076               removed and dummies at the connection points.                    
00077   */
00078   ROMol *replaceSidechains(const ROMol &mol, const ROMol &coreQuery);
00079                           
00080   //! \brief Returns a copy of an ROMol with the atoms and bonds that 
00081   //!      do fall within a substructure match removed.
00082   //!
00083   //!   dummy atoms are left to indicate attachment points.
00084   //!
00085   /*!
00086       Note that this is essentially identical to the replaceSidechains function, except we
00087       invert the query and replace the atoms that *do* match the query.
00088 
00089       \param mol            - the ROMol of interest
00090       \param coreQuery      - a query ROMol to be used to match the core
00091       \param replaceDummies - if set, atoms matching dummies in the core will also be replaced
00092       \param labelByIndex  - if set, the dummy atoms at attachment points are labelled with the
00093                              index+1 of the corresponding atom in the core
00094 
00095       \return a copy of \c mol with the non-matching atoms and bonds (if any)
00096               removed and dummies at the connection points. The client is responsible
00097               for deleting this molecule
00098   */
00099   ROMol *replaceCore(const ROMol &mol, const ROMol &coreQuery,
00100                      bool replaceDummies=true,bool labelByIndex=false);
00101         
00102 
00103 
00104 }
00105 
00106 #endif
00107 
00108 
00109 
00110 

Generated on Fri Apr 3 06:03:01 2009 for RDCode by  doxygen 1.5.6