Rings.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2004-2008 Greg Landrum and Rational Discovery LLC
00003 //
00004 //   @@ All Rights Reserved @@
00005 //  This file is part of the RDKit.
00006 //  The contents are covered by the terms of the BSD license
00007 //  which is included in the file license.txt, found at the root
00008 //  of the RDKit source tree.
00009 //
00010 
00011 //! \file Rings.h
00012 //! \brief utility functionality for working with ring systems
00013 
00014 #ifndef _RDRINGS_H_
00015 #define _RDRINGS_H_
00016 
00017 #include <vector>
00018 #include <map>
00019 #include <boost/dynamic_bitset_fwd.hpp>
00020 
00021 namespace RDKit {
00022   class ROMol;
00023 };
00024 
00025 
00026 namespace RingUtils {
00027   typedef std::vector<int>  INT_VECT;
00028   typedef std::vector< std::vector<int> > VECT_INT_VECT;
00029   typedef std::map< int, std::vector<int> > INT_INT_VECT_MAP;
00030   
00031   //! Pick a set of rings that are fused together and contain a specified ring
00032   /*!
00033 
00034      \param curr      the ID for the irng that should be in the fused system
00035      \param neighMap  adjacency lists for for all rings in the molecule.
00036              See documentation for makeNeighMap 
00037      \param res       used to return the results: a list of rings that are fused
00038              with curr in them
00039      \param done      a bit vector recording the rings that are already dealt with
00040              this also can be used to avoid any rings that should not be included in
00041              the fused system
00042      \param depth used to track recursion depth       
00043    
00044   */
00045   void pickFusedRings(int curr, const INT_INT_VECT_MAP &neighMap, INT_VECT &res,
00046                       boost::dynamic_bitset<> &done,int depth=0);
00047 
00048   //! \brief For each ring in bring compute and strore the ring that are fused
00049   //! (share atleast one bond with it). 
00050   /*!
00051     Useful both for the keulization stuff and aromaticity perception. 
00052    
00053     \param brings   list of rings - each ring is specified as a list of bond IDs
00054     \param neighMap an STL map into which the results are stored. Each entry in the 
00055                 map is indexed by the ring ID and the conents are the list
00056                 rings (rather their IDs) that are fused with this ring
00057                 
00058   */
00059   void makeRingNeighborMap(const VECT_INT_VECT &brings, INT_INT_VECT_MAP &neighMap);
00060 
00061 
00062   //! converts a list of atom indices into a list of bond indices
00063   /*!
00064 
00065      \param res    list of ring - each ring is a list of atom ids
00066      \param brings reference to a list of rings to the write the results to
00067                    each ring here is list of bonds ids
00068      \param mol    the molecule of interest
00069      
00070     <b>Assumptions:</b>
00071      - each list of atom ids in "res" form a legitimate ring           
00072      - each of these list of ordered such that a ring can be traversed
00073   */
00074   void convertToBonds(const VECT_INT_VECT &res, VECT_INT_VECT &brings,
00075                       const RDKit::ROMol &mol);
00076 
00077 };
00078 
00079 #endif
00080