groupcontrib.h Source File

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

groupcontrib.h
Go to the documentation of this file.

    00001 /**********************************************************************
    00002 groupcontrib.h - Handle group contribution algorithms.
    00003
    00004 Copyright (C) 2007      by Tim Vandermeersch
    00005               2001-2007 by Stephen Jelfs
    00006               2001-2007 by Joerg Kurt Wegner, me@cheminformatics.eu
    00007
    00008 Original version: JOELib2, http://joelib.sf.net
    00009
    00010 This file is part of the Open Babel project.
    00011 For more information, see <http://openbabel.org/>
    00012
    00013 This program is free software; you can redistribute it and/or modify
    00014 it under the terms of the GNU General Public License as published by
    00015 the Free Software Foundation version 2 of the License.
    00016
    00017 This program is distributed in the hope that it will be useful,
    00018 but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00020 GNU General Public License for more details.
    00021 ***********************************************************************/
    00022
    00023 #ifndef OB_GROUPCONTRIB_H
    00024 #define OB_GROUPCONTRIB_H
    00025
    00026 #include <openbabel/mol.h>
    00027 #include <openbabel/parsmart.h>
    00028 #include <openbabel/descriptor.h>
    00029
    00030 // This macro is used in DLL builds. If it has not
    00031 // been set in babelconfig.h, define it as nothing.
    00032 #ifndef OBDESC
    00033         #define OBDESC
    00034 #endif
    00035
    00036 namespace OpenBabel
    00037 {
    00038
    00045 class OBDESC OBGroupContrib : public OBDescriptor
    00046 {
    00047 public:
    00048
    00054
    00055   OBGroupContrib(const char* ID, const char* filename, const char* descr)
    00056     : OBDescriptor(ID, false), _filename(filename), _descr(descr){}
    00057
    00058   virtual const char* Description();
    00059
    00060   virtual OBGroupContrib* MakeInstance(const std::vector<std::string>& textlines)
    00061   {
    00062     return new OBGroupContrib(textlines[1].c_str(),textlines[2].c_str(),textlines[3].c_str());
    00063   }
    00064
    00065
    00066   virtual double Predict(OBBase* pOb, std::string* param=NULL);
    00067
    00068  private:
    00069   bool ParseFile();
    00070
    00071   const char* _filename;
    00072   const char* _descr;
    00073   std::vector<std::pair<OBSmartsPattern*, double> > _contribsHeavy;
    00074   std::vector<std::pair<OBSmartsPattern*, double> > _contribsHydrogen;
    00075 };
    00076
    00077 /* The classes OBLogp, OBPSA and OBMR have been replaced by instances of
    00078 OBGroupContrib with different IDs.
    00079 So instead of:
    00080       OBLogp logP;
    00081       cout << "logP  " << logP.Predict(mol) << endl;
    00082 use:
    00083       OBDescriptor* pDesc = OBDescriptor::FindType("logP")
    00084       if(pDesc)
    00085         cout << "logP  " << pDesc->Predict(&mol) << endl;
    00086 */
    00087 } // end namespace OpenBabel
    00088
    00089 #endif // OB_GROUPCONTRIB_H
    00090

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines