File: Rings.h

package info (click to toggle)
rdkit 201809.1%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 123,688 kB
  • sloc: cpp: 230,509; python: 70,501; java: 6,329; ansic: 5,427; sql: 1,899; yacc: 1,739; lex: 1,243; makefile: 445; xml: 229; fortran: 183; sh: 123; cs: 93
file content (90 lines) | stat: -rw-r--r-- 3,459 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
//
//  Copyright (C) 2004-2008 Greg Landrum and Rational Discovery LLC
//
//   @@ 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.
//

//! \file Rings.h
//! \brief utility functionality for working with ring systems

#include <RDGeneral/export.h>
#ifndef _RDRINGS_H_
#define _RDRINGS_H_

#include <vector>
#include <map>
#include <boost/dynamic_bitset_fwd.hpp>

namespace RDKit {
class ROMol;
};

namespace RingUtils {
typedef std::vector<int> INT_VECT;
typedef std::vector<std::vector<int>> VECT_INT_VECT;
typedef std::map<int, std::vector<int>> INT_INT_VECT_MAP;

//! Pick a set of rings that are fused together and contain a specified ring
/*!

   \param curr      the ID for the irng that should be in the fused system
   \param neighMap  adjacency lists for for all rings in the molecule.
           See documentation for makeNeighMap
   \param res       used to return the results: a list of rings that are fused
           with curr in them
   \param done      a bit vector recording the rings that are already dealt with
           this also can be used to avoid any rings that should not be included
   in
           the fused system
   \param depth used to track recursion depth

*/
RDKIT_GRAPHMOL_EXPORT void pickFusedRings(int curr,
                                          const INT_INT_VECT_MAP &neighMap,
                                          INT_VECT &res,
                                          boost::dynamic_bitset<> &done,
                                          int depth = 0);

//! \brief For each ring in bring compute and strore the ring that are fused
//! (share atleast one bond with it).
/*!
  Useful both for the keulization stuff and aromaticity perception.

  \param brings   list of rings - each ring is specified as a list of bond IDs
  \param neighMap an STL map into which the results are stored. Each entry in
  the
              map is indexed by the ring ID and the conents are the list
              rings (rather their IDs) that are fused with this ring
  \param maxSize if this is >0, rings that are larger than the threshold
                 will not be considered as candidates to be neighbors
  \param maxOverlapSize if this is >0, rings that overlap by more bonds than
                        this will not be considered to be neighbors

*/
RDKIT_GRAPHMOL_EXPORT void makeRingNeighborMap(const VECT_INT_VECT &brings,
                                               INT_INT_VECT_MAP &neighMap,
                                               unsigned int maxSize = 0,
                                               unsigned int maxOverlapSize = 0);

//! converts a list of atom indices into a list of bond indices
/*!

   \param res    list of ring - each ring is a list of atom ids
   \param brings reference to a list of rings to the write the results to
                 each ring here is list of bonds ids
   \param mol    the molecule of interest

  <b>Assumptions:</b>
   - each list of atom ids in "res" form a legitimate ring
   - each of these list of ordered such that a ring can be traversed
*/
RDKIT_GRAPHMOL_EXPORT void convertToBonds(const VECT_INT_VECT &res,
                                          VECT_INT_VECT &brings,
                                          const RDKit::ROMol &mol);
};  // namespace RingUtils

#endif