Crippen.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2004-2007 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 /*! \file Crippen.h
00012 
00013   \brief Use MolDescriptors.h in client code.
00014 
00015 */
00016 #ifndef __RD_CRIPPEN_H__
00017 #define __RD_CRIPPEN_H__
00018 
00019 #include <string>
00020 #include <vector>
00021 #include <boost/smart_ptr.hpp>
00022 
00023 namespace RDKit {
00024   class ROMol;
00025   namespace Descriptors {
00026     const std::string crippenVersion="1.2.0";
00027 
00028     //! generate atomic contributions to the Wildman-Crippen LogP and MR
00029     //! estimates for a molecule
00030     /*!
00031       Uses an atom-based scheme based on the values in the paper:
00032         S. A. Wildman and G. M. Crippen JCICS 39 868-873 (1999)
00033 
00034       \param mol           the molecule of interest
00035       \param logpContribs  used to return the logp contributions, must
00036                            be equal in length to the number of atoms
00037       \param mrContribs    used to return the MR contributions, must
00038                            be equal in length to the number of atoms
00039       \param force         forces the value to be recalculated instead
00040                            of pulled from the cache
00041           
00042     */
00043     void getCrippenAtomContribs(const ROMol &mol,
00044                                 std::vector<double> &logpContribs,
00045                                 std::vector<double> &mrContribs,
00046                                 bool force=false);
00047     
00048 
00049     //! generate Wildman-Crippen LogP and MR estimates for a molecule
00050     /*!
00051       Uses an atom-based scheme based on the values in the paper:
00052         S. A. Wildman and G. M. Crippen JCICS 39 868-873 (1999)
00053 
00054       \param mol        the molecule of interest
00055       \param logp       used to return the logp estimate
00056       \param mr         used to return the MR estimate
00057       \param includeHs  (optional) if this is true (the default), a
00058           copy of \c mol is made and Hs are added to it.  If false,
00059           Hs that are not explicitly present in the graph will not
00060           be included.
00061       \param force      forces the value to be recalculated instead of
00062                         pulled from the cache
00063           
00064     */
00065     void calcCrippenDescriptors(const ROMol &mol,double &logp,double &mr,
00066                                 bool includeHs=true,bool force=false);
00067     
00068     //! a class used to store Crippen parameters
00069     class CrippenParams {
00070     public:
00071       boost::shared_ptr<const ROMol> dp_pattern;
00072       std::string label;
00073       std::string smarts;
00074       double logp;
00075       double mr;
00076       ~CrippenParams();
00077     };
00078 
00079     //! singleton class for retrieving Crippen parameters
00080     /*!
00081       Use the singleton like this:
00082       
00083       \verbatim
00084       CrippenParamCollection *params=CrippenParamCollection::getParams();
00085       \endverbatim
00086 
00087       If you have your own parameter data, it can be supplied as a string:
00088       \verbatim
00089       CrippenParamCollection *params=CrippenParamCollection::getParams(myParamData);
00090       \endverbatim
00091       You are responsible for making sure that the data is in the correct
00092       format (see Crippen.cpp for an example).
00093       
00094     */
00095     class CrippenParamCollection {
00096     public:
00097       typedef std::vector<CrippenParams> ParamsVect;
00098       static CrippenParamCollection *getParams(const std::string &paramData="");
00099       ParamsVect::const_iterator begin() const { return d_params.begin(); };
00100       ParamsVect::const_iterator end() const { return d_params.end(); };
00101       
00102     private:
00103       //! to force this to be a singleton, the constructor must be private
00104       CrippenParamCollection(const std::string &paramData);
00105       static class CrippenParamCollection *ds_instance;    //!< the singleton
00106       ParamsVect d_params;                                 //!< the parameters
00107     };
00108   } // end of namespace Descriptors
00109 }
00110 
00111 #endif