RDKit
Open-source cheminformatics and machine learning.
Rings.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2008 Greg Landrum and Rational Discovery LLC
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 
11 //! \file Rings.h
12 //! \brief utility functionality for working with ring systems
13 
14 #ifndef _RDRINGS_H_
15 #define _RDRINGS_H_
16 
17 #include <vector>
18 #include <map>
19 #include <boost/dynamic_bitset_fwd.hpp>
20 
21 namespace RDKit {
22 class ROMol;
23 };
24 
25 namespace RingUtils {
26 typedef std::vector<int> INT_VECT;
27 typedef std::vector<std::vector<int> > VECT_INT_VECT;
28 typedef std::map<int, std::vector<int> > INT_INT_VECT_MAP;
29 
30 //! Pick a set of rings that are fused together and contain a specified ring
31 /*!
32 
33  \param curr the ID for the irng that should be in the fused system
34  \param neighMap adjacency lists for for all rings in the molecule.
35  See documentation for makeNeighMap
36  \param res used to return the results: a list of rings that are fused
37  with curr in them
38  \param done a bit vector recording the rings that are already dealt with
39  this also can be used to avoid any rings that should not be included
40  in
41  the fused system
42  \param depth used to track recursion depth
43 
44 */
45 void pickFusedRings(int curr, const INT_INT_VECT_MAP &neighMap, INT_VECT &res,
46  boost::dynamic_bitset<> &done, int depth = 0);
47 
48 //! \brief For each ring in bring compute and strore the ring that are fused
49 //! (share atleast one bond with it).
50 /*!
51  Useful both for the keulization stuff and aromaticity perception.
52 
53  \param brings list of rings - each ring is specified as a list of bond IDs
54  \param neighMap an STL map into which the results are stored. Each entry in
55  the
56  map is indexed by the ring ID and the conents are the list
57  rings (rather their IDs) that are fused with this ring
58  \param maxSize if this is >0, rings that are larger than the threshold
59  will not be considered as candidates to be neighbors
60 
61 */
62 void makeRingNeighborMap(const VECT_INT_VECT &brings,
63  INT_INT_VECT_MAP &neighMap, unsigned int maxSize = 0);
64 
65 //! converts a list of atom indices into a list of bond indices
66 /*!
67 
68  \param res list of ring - each ring is a list of atom ids
69  \param brings reference to a list of rings to the write the results to
70  each ring here is list of bonds ids
71  \param mol the molecule of interest
72 
73  <b>Assumptions:</b>
74  - each list of atom ids in "res" form a legitimate ring
75  - each of these list of ordered such that a ring can be traversed
76 */
77 void convertToBonds(const VECT_INT_VECT &res, VECT_INT_VECT &brings,
78  const RDKit::ROMol &mol);
79 };
80 
81 #endif
void pickFusedRings(int curr, const INT_INT_VECT_MAP &neighMap, INT_VECT &res, boost::dynamic_bitset<> &done, int depth=0)
Pick a set of rings that are fused together and contain a specified ring.
void convertToBonds(const VECT_INT_VECT &res, VECT_INT_VECT &brings, const RDKit::ROMol &mol)
converts a list of atom indices into a list of bond indices
ROMol is a molecule class that is intended to have a fixed topology.
Definition: ROMol.h:103
std::vector< INT_VECT > VECT_INT_VECT
Definition: types.h:202
std::vector< int > INT_VECT
Definition: types.h:188
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:29
void makeRingNeighborMap(const VECT_INT_VECT &brings, INT_INT_VECT_MAP &neighMap, unsigned int maxSize=0)
For each ring in bring compute and strore the ring that are fused (share atleast one bond with it)...
std::map< int, INT_VECT > INT_INT_VECT_MAP
Definition: types.h:223