RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
SFAgg.h
1/***********************************************************************
2 * The rDock program was developed from 1998 - 2006 by the software team
3 * at RiboTargets (subsequently Vernalis (R&D) Ltd).
4 * In 2006, the software was licensed to the University of York for
5 * maintenance and distribution.
6 * In 2012, Vernalis and the University of York agreed to release the
7 * program as Open Source software.
8 * This version is licensed under GNU-LGPL version 3.0 with support from
9 * the University of Barcelona.
10 * http://rdock.sourceforge.net/
11 ***********************************************************************/
12
13// Scoring Function aggregate class. Manages collection of child scoring
14// functions.
15
16#ifndef _RBTSFAGG_H_
17#define _RBTSFAGG_H_
18
19#include "rxdock/BaseSF.h"
20
21#include <nlohmann/json.hpp>
22
23using json = nlohmann::json;
24
25namespace rxdock {
26
27// Only check SF aggregate assertions in debug build
28#ifdef _NDEBUG
29const Bool SFAGG_CHECK = false;
30#else
31const bool SFAGG_CHECK = true;
32#endif //_NDEBUG
33
34// Useful typedefs
35
36class SFAgg : public BaseSF {
37public:
38 // Static data member for class type (i.e. "SFAgg")
39 static const std::string _CT;
40
42 // Constructors/destructors
43 RBTDLL_EXPORT SFAgg(const std::string &strName = GetMetaDataPrefix() +
44 "score");
45 virtual ~SFAgg();
46
47 friend void to_json(json &j, const SFAgg &sfAgg);
48 friend void from_json(const json &j, SFAgg &sfAgg);
49
51 // Public methods
53
54 // Returns all child component scores as a string-variant map
55 // Key = fully qualified component name, value = weighted score
56 //(for saving in a Model's data fields)
57 virtual void ScoreMap(StringVariantMap &scoreMap) const;
58
59 // Aggregate handling methods
60 virtual void Add(BaseSF *);
61 virtual void Remove(BaseSF *);
62 virtual bool isAgg() const;
63 virtual unsigned int GetNumSF() const;
64 virtual BaseSF *GetSF(unsigned int iSF) const;
65
66 // WorkSpace handling methods
67 // Register scoring function with a workspace
68 // Aggregate version registers all children, but NOT itself
69 //(Aggregates are just containers, and have no need for model information
70 virtual void Register(WorkSpace *);
71 // Unregister with a workspace
72 // Aggregate version unregisters all children, but NOT itself
73 virtual void Unregister();
74
75 // Override Observer pure virtual
76 // Notify observer that subject has changed
77 // Does nothing in SFAgg as aggregates do not require updating
78 virtual void Update(Subject *theChangedSubject);
79
80 // Request Handling method
81 virtual void HandleRequest(RequestPtr spRequest);
82
83 // Virtual function for dumping scoring function details to an output stream
84 // Called by operator <<
85 virtual void Print(std::ostream &s) const;
86
87protected:
89 // Protected methods
91 virtual double RawScore() const;
92
93private:
95 // Private methods
97 SFAgg(const SFAgg &); // Copy constructor disabled by default
98 SFAgg &operator=(const SFAgg &); // Copy assignment disabled by default
99
100protected:
102 // Protected data
104
105private:
107 // Private data
109 BaseSFList m_sf;
110 int m_nNonHLigandAtoms; // for normalised scores (score / non-H ligand atoms)
111};
112
113void to_json(json &j, const SFAgg &sfAgg);
114void from_json(const json &j, SFAgg &sfAgg);
115
116// Useful typedefs
117typedef SmartPtr<SFAgg> SFAggPtr; // Smart pointer
118typedef std::vector<SFAggPtr> SFAggList; // Vector of smart pointers
119typedef SFAggList::iterator SFAggListIter;
120typedef SFAggList::const_iterator SFAggListConstIter;
121
122} // namespace rxdock
123
124#endif //_RBTSFAGG_H_
Definition BaseSF.h:28
Definition SFAgg.h:36
Definition Subject.h:35
Definition WorkSpace.h:38