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, bool clearConfs = true,
59  unsigned int nFlipsPerSample = 0,
60  unsigned int nSamples = 0, int sampleSeed = 0,
61  bool permuteDeg4Nodes = false);
62 
63 //! \brief Compute the 2D coordinates such the interatom distances
64 // mimic those in a distance matrix
65 /*!
66 
67  This function generates 2D coordinates such that the inter-atom
68  distances mimic those specified via dmat. This is done by randomly
69  sampling(flipping) the rotatable bonds in the molecule and
70  evaluating a cost function which contains two components. The
71  first component is the sum of inverse of the squared inter-atom
72  distances, this helps in spreading the atoms far from each
73  other. The second component is the sum of squares of the
74  difference in distance between those in dmat and the generated
75  structure. The user can adjust the relative importance of the two
76  components via a adjustable paramter (see below)
77 
78  ARGUMENTS:
79 
80  \param mol - molecule to generate coordinates for
81 
82  \param dmat - the distance matrix we want to mimic, this is a
83  symmetric N by N matrix where N is the number of atoms in mol. All
84  negative entries in dmat are ignored.
85 
86  \param canonOrient - canonicalize the orientation after the 2D
87  embedding is done
88 
89  \param clearConfs - clear any previously existing conformations on
90  mol before adding a conformation
91 
92  \param weightDistMat - A value between 0.0 and 1.0, this
93  determines the importance of mimicing the the inter atoms
94  distances in dmat. (1.0 - weightDistMat) is the weight associated
95  to spreading out the structure (density) in the cost function
96 
97  \param nFlipsPerSample - the number of rotatable bonds that are
98  flipped at random for each sample
99 
100  \param nSamples - the number of samples
101 
102  \param sampleSeed - seed for the random sampling process
103 
104  \param permuteDeg4Nodes - try permuting the drawing order of bonds around
105  atoms with four neighbors in order to improve the depiction
106 
107  \return ID of the conformation added to the molecule cotaining the
108  2D coordinates
109 
110 
111 */
112 unsigned int compute2DCoordsMimicDistMat(
113  RDKit::ROMol &mol, const DOUBLE_SMART_PTR *dmat = 0,
114  bool canonOrient = true, bool clearConfs = true, double weightDistMat = 0.5,
115  unsigned int nFlipsPerSample = 3, unsigned int nSamples = 100,
116  int sampleSeed = 25, bool permuteDeg4Nodes = true);
117 };
118 
119 #endif
boost::shared_array< double > DOUBLE_SMART_PTR
Definition: EmbeddedFrag.h:25
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:103
std::map< int, Point2D > INT_POINT2D_MAP
Definition: point.h:511
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:29
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.