RDKit
Open-source cheminformatics and machine learning.
RDDepictor.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2003-2010 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 #ifndef _RDDEPICTOR_H_
12 #define _RDDEPICTOR_H_
13 
14 #include <RDGeneral/types.h>
15 #include <list>
16 #include <GraphMol/ROMol.h>
17 #include "EmbeddedFrag.h"
18 
19 namespace RDKit {
20  class ROMol;
21 }
22 
23 namespace RDDepict {
24 
25  //! \brief Generate 2D coordinates (a depiction) for a molecule
26  /*!
27 
28  \param mol the molecule were are interested in
29 
30  \param coordMap a map of int to Point2D, between atom IDs and
31  their locations. This is the container the user needs to fill if
32  he/she wants to specify coordinates for a portion of the molecule,
33  defaults to 0
34 
35  \param canonOrient canonicalize the orientation so that the long
36  axes align with the x-axis etc.
37 
38  \param clearConfs clear all existing conformations on the molecule
39  before adding the 2D coordinates instead of simply adding to the
40  list
41 
42  \param nFlipsPerSample - the number of rotatable bonds that are
43  flipped at random for each sample
44 
45  \param nSamples - the number of samples
46 
47  \param sampleSeed - seed for the random sampling process
48 
49  \param permuteDeg4Nodes - try permuting the drawing order of bonds around
50  atoms with four neighbors in order to improve the depiction
51 
52  \return ID of the conformation added to the molecule cotaining the
53  2D coordinates
54 
55  */
56  unsigned int compute2DCoords(RDKit::ROMol &mol,
57  const RDGeom::INT_POINT2D_MAP *coordMap=0,
58  bool canonOrient=false,
59  bool clearConfs=true,
60  unsigned int nFlipsPerSample=0,
61  unsigned int nSamples=0,
62  int sampleSeed=0,
63  bool permuteDeg4Nodes=false);
64 
65  //! \brief Compute the 2D coordinates such the interatom distances
66  // mimic those in a distance matrix
67  /*!
68 
69  This function generates 2D coordinates such that the inter-atom
70  distances mimic those specified via dmat. This is done by randomly
71  sampling(flipping) the rotatable bonds in the molecule and
72  evaluating a cost function which contains two components. The
73  first component is the sum of inverse of the squared inter-atom
74  distances, this helps in spreading the atoms far from each
75  other. The second component is the sum of squares of the
76  difference in distance between those in dmat and the generated
77  structure. The user can adjust the relative importance of the two
78  components via a adjustable paramter (see below)
79 
80  ARGUMENTS:
81 
82  \param mol - molecule to generate coordinates for
83 
84  \param dmat - the distance matrix we want to mimic, this is a
85  symmetric N by N matrix where N is the number of atoms in mol. All
86  negative entries in dmat are ignored.
87 
88  \param canonOrient - canonicalize the orientation after the 2D
89  embedding is done
90 
91  \param clearConfs - clear any previously existing conformations on
92  mol before adding a conformation
93 
94  \param weightDistMat - A value between 0.0 and 1.0, this
95  determines the importance of mimicing the the inter atoms
96  distances in dmat. (1.0 - weightDistMat) is the weight associated
97  to spreading out the structure (density) in the cost function
98 
99  \param nFlipsPerSample - the number of rotatable bonds that are
100  flipped at random for each sample
101 
102  \param nSamples - the number of samples
103 
104  \param sampleSeed - seed for the random sampling process
105 
106  \param permuteDeg4Nodes - try permuting the drawing order of bonds around
107  atoms with four neighbors in order to improve the depiction
108 
109  \return ID of the conformation added to the molecule cotaining the
110  2D coordinates
111 
112 
113  */
114  unsigned int compute2DCoordsMimicDistMat(RDKit::ROMol &mol,
115  const DOUBLE_SMART_PTR *dmat=0,
116  bool canonOrient=true,
117  bool clearConfs=true,
118  double weightDistMat=0.5,
119  unsigned int nFlipsPerSample=3,
120  unsigned int nSamples=100,
121  int sampleSeed=25,
122  bool permuteDeg4Nodes=true);
123 };
124 
125 #endif
boost::shared_array< double > DOUBLE_SMART_PTR
Definition: EmbeddedFrag.h:26
unsigned int compute2DCoordsMimicDistMat(RDKit::ROMol &mol, const DOUBLE_SMART_PTR *dmat=0, bool canonOrient=true, bool clearConfs=true, double weightDistMat=0.5, unsigned int nFlipsPerSample=3, unsigned int nSamples=100, int sampleSeed=25, bool permuteDeg4Nodes=true)
Compute the 2D coordinates such the interatom distances.
Defines the primary molecule class ROMol as well as associated typedefs.
ROMol is a molecule class that is intended to have a fixed topology.
Definition: ROMol.h:105
std::map< int, Point2D > INT_POINT2D_MAP
Definition: point.h:533
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:28
unsigned int compute2DCoords(RDKit::ROMol &mol, const RDGeom::INT_POINT2D_MAP *coordMap=0, bool canonOrient=false, bool clearConfs=true, unsigned int nFlipsPerSample=0, unsigned int nSamples=0, int sampleSeed=0, bool permuteDeg4Nodes=false)
Generate 2D coordinates (a depiction) for a molecule.