RDDepictor.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2003-2010 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 #ifndef _RDDEPICTOR_H_
00012 #define _RDDEPICTOR_H_
00013 
00014 #include <RDGeneral/types.h>
00015 #include <list>
00016 #include <GraphMol/ROMol.h>
00017 #include "EmbeddedFrag.h"
00018 
00019 namespace RDKit {
00020   class ROMol;
00021 }
00022 
00023 namespace RDDepict {
00024 
00025   //! \brief Generate 2D coordinates (a depiction) for a molecule
00026   /*! 
00027 
00028     \param mol the molecule were are interested in
00029 
00030     \param coordMap a map of int to Point2D, between atom IDs and
00031     their locations.  This is the container the user needs to fill if
00032     he/she wants to specify coordinates for a portion of the molecule,
00033     defaults to 0
00034 
00035     \param canonOrient canonicalize the orientation so that the long
00036     axes align with the x-axis etc.
00037 
00038     \param clearConfs clear all existing conformations on the molecule
00039     before adding the 2D coordinates instead of simply adding to the
00040     list
00041                           
00042     \param nFlipsPerSample - the number of rotatable bonds that are
00043     flipped at random for each sample
00044 
00045     \param nSamples - the number of samples
00046 
00047     \param sampleSeed - seed for the random sampling process
00048 
00049     \param permuteDeg4Nodes - try permuting the drawing order of bonds around
00050           atoms with four neighbors in order to improve the depiction
00051 
00052     \return ID of the conformation added to the molecule cotaining the
00053     2D coordinates
00054 
00055   */
00056   unsigned int compute2DCoords(RDKit::ROMol &mol,
00057                                const RDGeom::INT_POINT2D_MAP *coordMap=0,
00058                                bool canonOrient=false,
00059                                bool clearConfs=true,
00060                                unsigned int nFlipsPerSample=0,
00061                                unsigned int nSamples=0,
00062                                int sampleSeed=0,
00063                                bool permuteDeg4Nodes=false);
00064 
00065   //! \brief Compute the 2D coordinates such the interatom distances
00066   //   mimic those in a distance matrix
00067   /*!
00068 
00069     This function generates 2D coordinates such that the inter-atom
00070     distances mimic those specified via dmat. This is done by randomly
00071     sampling(flipping) the rotatable bonds in the molecule and
00072     evaluating a cost function which contains two components. The
00073     first component is the sum of inverse of the squared inter-atom
00074     distances, this helps in spreading the atoms far from each
00075     other. The second component is the sum of squares of the
00076     difference in distance between those in dmat and the generated
00077     structure.  The user can adjust the relative importance of the two
00078     components via a adjustable paramter (see below)
00079 
00080     ARGUMENTS:
00081 
00082     \param mol - molecule to generate coordinates for
00083 
00084     \param dmat - the distance matrix we want to mimic, this is a
00085     symmetric N by N matrix where N is the number of atoms in mol. All
00086     negative entries in dmat are ignored.
00087 
00088     \param canonOrient - canonicalize the orientation after the 2D
00089     embedding is done
00090 
00091     \param clearConfs - clear any previously existing conformations on
00092     mol before adding a conformation
00093 
00094     \param weightDistMat - A value between 0.0 and 1.0, this
00095     determines the importance of mimicing the the inter atoms
00096     distances in dmat. (1.0 - weightDistMat) is the weight associated
00097     to spreading out the structure (density) in the cost function
00098 
00099     \param nFlipsPerSample - the number of rotatable bonds that are
00100     flipped at random for each sample
00101 
00102     \param nSamples - the number of samples
00103 
00104     \param sampleSeed - seed for the random sampling process
00105 
00106     \param permuteDeg4Nodes - try permuting the drawing order of bonds around
00107           atoms with four neighbors in order to improve the depiction
00108 
00109     \return ID of the conformation added to the molecule cotaining the
00110     2D coordinates
00111 
00112 
00113   */
00114   unsigned int compute2DCoordsMimicDistMat(RDKit::ROMol &mol,
00115                                            const DOUBLE_SMART_PTR *dmat=0,
00116                                            bool canonOrient=true,
00117                                            bool clearConfs=true,
00118                                            double weightDistMat=0.5,
00119                                            unsigned int nFlipsPerSample=3,
00120                                            unsigned int nSamples=100,
00121                                            int sampleSeed=25,
00122                                            bool permuteDeg4Nodes=true);
00123 };
00124 
00125 #endif