RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
Filter.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// Reads a file that contains a list of filters that determine
14// when to terminate with a given ligand, and another filter to determine
15// when to write the current conformation to the output.
16
17#ifndef _RBT_FILTER_H_
18#define _RBT_FILTER_H_
19
20#include "rxdock/BaseObject.h"
21#include "rxdock/Context.h"
22#include "rxdock/FilterExpression.h"
23
24#include <nlohmann/json.hpp>
25
26using json = nlohmann::json;
27
28namespace rxdock {
29
30class FilterExpressionVisitor;
31
32class Filter : public BaseObject {
33public:
34 static const std::string _CT;
35 RBTDLL_EXPORT Filter(std::string strfilter, bool filter = false);
37 // Destructor
39 virtual ~Filter();
40
41 friend void to_json(json &j, const Filter &filter);
42 friend void from_json(const json &j, Filter &filter);
43
44 // Override Observer pure virtual
45 // Notify observer that subject has changed
46 virtual void Update(Subject *theChangedSubject);
47
48 void SetupReceptor(); // Called by Update when receptor is changed
49 void SetupLigand(); // Called by Update when ligand is changed
50 void SetupScore(); // Called by Update when either model has changed
51 RBTDLL_EXPORT bool Write(); // Output conformation?
52 RBTDLL_EXPORT bool Terminate(); // Finished with ligand?
53 ModelPtr GetReceptor() const;
54 ModelPtr GetLigand() const;
55 void SetMaxNRuns(int n) { maxnruns = n; }
56
58 // Private methods
60
61protected:
62 Filter(); // Default constructor disabled
63
64private:
65 void ReadFilters();
66
67 int filteridx, nTermFilters, nWriteFilters, nruns, maxnruns;
68 FilterExpressionList terminationFilters;
69 FilterExpressionList writtingFilter;
70 ModelPtr m_spReceptor;
71 ModelPtr m_spLigand;
72 ContextPtr contextp;
73};
74
75void to_json(json &j, const Filter &filter);
76void from_json(const json &j, Filter &filter);
77
78// Useful typedefs
79typedef SmartPtr<Filter> FilterPtr; // Smart pointer
80typedef std::vector<FilterPtr> FilterList;
81// Vector of smart pointers
82typedef FilterList::iterator FilterListIter;
83typedef FilterList::const_iterator FilterListConstIter;
84
85} // namespace rxdock
86
87#endif //_Filter_H_
Definition BaseObject.h:32
Definition Filter.h:32
Definition Subject.h:35