RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
WorkSpace.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// Manages all models used in simulation, coordinates updates of all registered
14// Observer objects (scoring functions and transforms)
15// In this version, the number of models in the workspace is fixed in the
16// constructor, and can't be changed. Models can still be null however.
17//
18// Design Pattern: Workspace objects are the Subject in the Observer pattern
19// (Design Patterns, Gamma et al, Addison Wesley, p293).
20
21#ifndef _RBTWORKSPACE_H_
22#define _RBTWORKSPACE_H_
23
24#include "rxdock/BaseMolecularFileSink.h"
25#include "rxdock/Config.h"
26#include "rxdock/DockingSite.h"
27#include "rxdock/Filter.h"
28#include "rxdock/Model.h"
29#include "rxdock/ParamHandler.h"
30#include "rxdock/Population.h"
31#include "rxdock/Subject.h"
32
33namespace rxdock {
34
35class BaseSF; // Forward definition
36class BaseTransform; // Forward definition
37
38class WorkSpace : public Subject, public ParamHandler {
39public:
40 // Class type string
41 static const std::string _CT;
42 // Parameter names
43 static const std::string _NAME;
44
46 // Constructors/destructors
47
48 WorkSpace(unsigned int nModels = 2);
49 virtual ~WorkSpace();
50
52 // Public methods
54
55 // Get/set workspace name
56 RBTDLL_EXPORT std::string GetName() const;
57 RBTDLL_EXPORT void SetName(const std::string &);
58
59 // Model handling
60
61 // Returns number of models in workspace
62 RBTDLL_EXPORT unsigned int GetNumModels() const;
63 // Returns vector of all models in workspace
64 RBTDLL_EXPORT ModelList GetModels() const;
65 // Returns a specific (numbered) model
66 // Throws BadArgument if iModel out of range
67 RBTDLL_EXPORT ModelPtr GetModel(unsigned int iModel) const;
68
69 // Replace an existing model
70 // Throws BadArgument if iModel out of range
71 void SetModel(unsigned int iModel, ModelPtr spModel);
72
73 // Returns vector of models, starting from index iModel
74 ModelList GetModels(unsigned int iModel) const;
75 // Append a number of models to the workspace, increasing the total number of
76 // models
77 void AddModels(ModelList modelList);
78 // Replace a number of existing models
79 // iModel is the index of the first model to replace
80 // Throws BadArgument if iModel out of range or modelList too large
81 void SetModels(unsigned int iModel, ModelList modelList);
82 // Removes a number of models from the workspace
83 // Removes from index iModel to end of model list
84 void RemoveModels(unsigned int iModel);
85
86 // Model I/O
87 // Get/set the molecular file sink (for outputting ligands)
88 MolecularFileSinkPtr GetSink() const;
89 RBTDLL_EXPORT void SetSink(MolecularFileSinkPtr);
90 // Saves models to file sink
91 // If bSaveScores is true, write component scores also
92 // Base workspace does nothing
93 // It is up to subclasses to decide what action to take
94 virtual void Save(bool bSaveScores = true);
95 // Get/set the history file sink
96 MolecularFileSinkPtr GetHistorySink() const;
97 RBTDLL_EXPORT void SetHistorySink(MolecularFileSinkPtr);
98 // Saves models to file sink
99 // If bSaveScores is true, write component scores also
100 // Base workspace does nothing
101 // It is up to subclasses to decide what action to take
102 virtual void SaveHistory(bool bSaveScores = true);
103
104 // Get/Set the scoring function
105 // SetSF automatically registers the scoring function with the workspace
106 RBTDLL_EXPORT BaseSF *GetSF() const;
107 RBTDLL_EXPORT void SetSF(BaseSF *);
108
109 // Get/Set the transform
110 // SetTransform automatically registers the transform with the workspace
111 BaseTransform *GetTransform() const;
112 RBTDLL_EXPORT void SetTransform(BaseTransform *);
113
114 // Run the simulation!
115 virtual void Run();
116
117 // Population handling
118 // DM 30 Oct 2001 - provide a home for persistent populations
119 void SetPopulation(PopulationPtr population);
120 PopulationPtr GetPopulation() const;
121 void ClearPopulation();
122
123 // Docking site handling
124 // DM 09 Apr 2002 - workspace now manages the docking site
125 RBTDLL_EXPORT DockingSitePtr GetDockingSite() const;
126 RBTDLL_EXPORT void SetDockingSite(DockingSitePtr spDockSite);
127
128 // Filter handling
129 // BGD 27 Jan 2003 - SetFilter automotically registers the Filter
130 // with the workspace
131 FilterPtr GetFilter() const;
132 RBTDLL_EXPORT void SetFilter(FilterPtr spFilter);
133
134protected:
136 // Protected methods
138
139private:
141 // Private methods
143
144 WorkSpace(const WorkSpace &); // Copy constructor disabled by default
145
146 WorkSpace &
147 operator=(const WorkSpace &); // Copy assignment disabled by default
148
149protected:
151 // Protected data
153
154private:
156 // Private data
158 ModelList m_models;
159 MolecularFileSinkPtr m_spSink;
160 MolecularFileSinkPtr m_spHisSink;
161 BaseSF *m_SF;
162 BaseTransform *m_transform;
163 PopulationPtr m_population;
164 DockingSitePtr m_spDockSite;
165 FilterPtr m_spFilter;
166};
167
168// Useful typedefs
169typedef SmartPtr<WorkSpace> WorkSpacePtr; // Smart pointer
170
171} // namespace rxdock
172
173#endif //_RBTWORKSPACE_H_
Definition BaseSF.h:28
Definition BaseTransform.h:29
Definition ParamHandler.h:30
Definition Subject.h:35
Definition WorkSpace.h:38