scoringFunction.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: scoringFunction.h,v 1.2 2006/05/21 18:15:28 anker Exp $
00005 
00006 #ifndef BALL_SCORING_COMMON_SCORINGFUNCTION_H
00007 #define BALL_SCORING_COMMON_SCORINGFUNCTION_H
00008 
00009 #include <BALL/KERNEL/system.h>
00010 #include <BALL/DATATYPE/options.h>
00011 #include <BALL/DATATYPE/string.h>
00012 #include <BALL/SCORING/COMMON/baseFunction.h>
00013 #include <BALL/SCORING/COMMON/scoringComponent.h>
00014 
00015 namespace BALL
00016 {
00017 
00018   class ScoringComponent;
00019 
00020   class ScoringFunction
00021   {
00022 
00023     public:
00024 
00025     struct Option
00026     {
00027 
00030       static const char* VERBOSITY;
00031 
00034       static const char* BASE_FUNCTION_TYPE;
00035 
00036     };
00037 
00038 
00039     struct Default
00040     {
00041 
00044       static const Size VERBOSITY;
00045 
00048       static const Size BASE_FUNCTION_TYPE;
00049 
00050     };
00051 
00053     ScoringFunction()
00054       ;
00055 
00057     ScoringFunction(const ScoringFunction& sf)
00058       ;
00059 
00061     ScoringFunction(Molecule& receptor, Molecule& ligand)
00062       ;
00063 
00065     ScoringFunction(Molecule& receptor, Molecule& ligand,
00066         const Options& options)
00067       ;
00068 
00070     virtual ~ScoringFunction()
00071       ;
00072 
00074     virtual void clear()
00075       ;
00076 
00078     ScoringFunction& operator = (const ScoringFunction& sf)
00079       ;
00080 
00082     bool setup()
00083       ;
00084 
00086     bool setup(Molecule& receptor, Molecule& ligand)
00087       ;
00088 
00090     bool setup(Molecule& receptor, Molecule& ligand, const Options& options)
00091       ;
00092 
00094     virtual bool specificSetup()
00095       throw(Exception::TooManyErrors);
00096 
00098     void setMaximumNumberOfErrors(Size nr)
00099       ;
00100 
00102     Size getMaximumNumberOfErrors() const
00103       ;
00104 
00106     void setFirstMolecule(Molecule& molecule1) 
00107       ;
00108 
00110     Molecule* getFirstMolecule() const
00111       ;
00112 
00114     void setSecondMolecule(Molecule& molecule2) 
00115       ;
00116 
00118     Molecule* getSecondMolecule() const
00119       ;
00120 
00124     void setReceptor(Molecule& receptor) 
00125       ;
00126 
00130     Molecule* getReceptor() const
00131       ;
00132 
00136     void setLigand(Molecule& ligand) 
00137       ;
00138 
00142     Molecule* getLigand() const
00143       ;
00144 
00146     void setIntercept(double intercept)
00147       ;
00148 
00150     double getIntercept() const
00151       ;
00152 
00154     void setBaseFunction(ScoringBaseFunction& base_function)
00155       ;
00156 
00160     ScoringBaseFunction* getBaseFunction() const
00161       ;
00162 
00164     void insertComponent(ScoringComponent* component, float coefficient = 1.0f)
00165       ;
00166 
00172     void removeComponent(const ScoringComponent* component)
00173       ;
00174 
00181     void removeComponent(const String& name)
00182       ;
00183 
00188     void setCoefficient(const ScoringComponent* component, float coefficient)
00189       ;
00190 
00196     void setCoefficient(const String& name, float coefficient)
00197       ;
00198 
00202     bool getCoefficient(const ScoringComponent* component,
00203         float& coefficient) const
00204       ;
00205 
00209     bool getCoefficient(const String& name, float& coefficient) const
00210       ;
00211 
00213     ScoringComponent* getComponent(const String& name) const
00214       ;
00215 
00217     ScoringComponent* getComponent(const Size index) const
00218       ;
00219 
00221     double calculateScore()
00222       ;
00223 
00225     const HashSet<const Atom*>& getUnassignedAtoms() const
00226       ;
00227 
00229     HashSet<const Atom*>& getUnassignedAtoms()
00230       ;
00231 
00233     Options options;
00234 
00235 
00236     protected:
00237 
00238     /*_ The first molecule of the complex, being the receptor in
00239         receptor/ligand complexes
00240       */
00241     Molecule* molecule1_;
00242 
00243     /*_ The second molecule of the complex, being the ligand in
00244         receptor/ligand complexes
00245       */
00246     Molecule* molecule2_;
00247 
00248     //_ The name of the scoring function
00249     String name_;
00250 
00251     //_ The overall score of the scoring function
00252     double score_;
00253 
00254     //_ The intercept necessary for calculating the score
00255     double intercept_;
00256 
00257     /*_ The base funcion for scoring simple terms
00258     */
00259     ScoringBaseFunction* base_function_;
00260 
00261     /*_ A list of components comprising the scoring function, along with
00262         the coefficients for each term necessary for calculating the final
00263         score.
00264     */
00265     std::vector< std::pair<ScoringComponent*, float> > components_;
00266 
00267     //_ Atoms, for which the setup of the force field fails
00268     HashSet<const Atom*> unassigned_atoms_;
00269 
00270     //_ Max number of unassigned atoms
00271     Size max_number_of_errors_;
00272 
00273     //_ Actual number of countde errors
00274     Size number_of_errors_;
00275 
00276 
00277   };
00278 
00279 } // namespace BALL
00280 
00281 #endif // BALL_SCORING_COMMON_SCORINGFUNCTION_H