FragCatParams.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2003-2006 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 #ifndef _RD_FRAG_CAT_PARAMS_H_
00011 #define _RD_FRAG_CAT_PARAMS_H_
00012 
00013 #include <Catalogs/CatalogParams.h>
00014 #include <string>
00015 #include <vector>
00016 #include <boost/shared_ptr.hpp>
00017 
00018 
00019 namespace RDKit {
00020   class ROMol;
00021   typedef std::vector< boost::shared_ptr<ROMol> > MOL_SPTR_VECT;
00022 
00023   //! container for user parameters used to create a fragment catalog
00024   class FragCatParams : public RDCatalog::CatalogParams {
00025     // FIX: this container is still missing all the CASE-type functional groups stuff
00026   public:
00027     FragCatParams() {
00028       d_typeStr = "Fragment Catalog Parameters";
00029       d_lowerFragLen = 0;
00030       d_upperFragLen = 0;
00031       d_tolerance = 1e-8;
00032       d_funcGroups.clear();
00033     }
00034     //! construct from a function-group file
00035     /*!
00036       \param lLen       the lower limit on fragment size
00037       \param uLen       the upper limit on fragment size
00038       \param fgroupFile the name of the function-group file
00039       \param tol        (optional) the eigenvalue tolerance to be used
00040                         when comparing fragments
00041     */
00042     FragCatParams(unsigned int lLen, unsigned int uLen, std::string fgroupFile, double tol=1e-08);
00043     //! copy constructor
00044     FragCatParams(const FragCatParams &other);
00045     //! construct from a pickle string (serialized representation)
00046     FragCatParams(const std::string &pickle);
00047 
00048     ~FragCatParams();
00049 
00050     //! returns our lower fragment length
00051     unsigned int getLowerFragLength() const { return d_lowerFragLen;}
00052     //! sets our lower fragment length
00053     void setLowerFragLength(unsigned int lFrLen) {d_lowerFragLen = lFrLen;}
00054     
00055     //! returns our upper fragment length
00056     unsigned int getUpperFragLength() const { return d_upperFragLen;}
00057     //! sets our upper fragment length
00058     void setUpperFragLength(unsigned int uFrLen) { d_upperFragLen = uFrLen;}
00059 
00060     //! returns our fragment-comparison tolerance
00061     double getTolerance() const {return d_tolerance;}
00062     //! sets our fragment-comparison tolerance
00063     void setTolerance(double val) { d_tolerance = val;}
00064 
00065     //! returns our number of functional groups
00066     unsigned int getNumFuncGroups() const {return d_funcGroups.size();}
00067 
00068     //! returns our std::vector of functional groups
00069     const MOL_SPTR_VECT &getFuncGroups() const;
00070 
00071     //! returns a pointer to a specific functional group
00072     const ROMol *getFuncGroup(unsigned int fid) const; 
00073 
00074     void toStream(std::ostream &) const;
00075     std::string Serialize() const;
00076     void initFromStream(std::istream &ss);
00077     void initFromString(const std::string &text);
00078   private:
00079     unsigned int d_lowerFragLen; 
00080     unsigned int d_upperFragLen;
00081 
00082     double d_tolerance; //!< tolerance value used when comparing subgraph discriminators
00083 
00084     MOL_SPTR_VECT d_funcGroups;
00085   };
00086 }
00087 
00088 #endif