RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
BaseMolecularFileSink.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// Abstract base class for molecular file-based output. Provides hooks for
14// handling multiple models/conformations being rendered.
15// Derived classes must provide a Render method.
16
17#ifndef _RBTBASEMOLECULARFILESINK_H_
18#define _RBTBASEMOLECULARFILESINK_H_
19
20#include "rxdock/BaseFileSink.h"
21#include "rxdock/Model.h"
22
23#include <nlohmann/json.hpp>
24
25using json = nlohmann::json;
26
27namespace rxdock {
28
30public:
32 // Constructors/destructors
33 // BaseMolecularFileSink(const char* fileName, ModelPtr spModel);
34 BaseMolecularFileSink(const std::string &fileName, ModelPtr spModel,
35 bool bUseModelSegmentNames = true);
36
37 virtual ~BaseMolecularFileSink(); // Default destructor
38
39 friend void to_json(json &j, const BaseMolecularFileSink &baseBiMolFSink);
40 friend void from_json(const json &j, BaseMolecularFileSink &baseBiMolFSink);
41
43 // Public methods
45
46 // Derived classes should override
47 // Controls whether file type can support the writing of multiple
48 // conformations/models to a single file
49 virtual bool isMultiConfSupported() { return false; }
50
51 // Get/set the Model that is linked to the sink
52 ModelPtr GetModel() const;
53 // DM 21 Apr 1999 - if bUseModelSegmentNames is true, the model segment names
54 // are rendered if bUseModelSegmentNames is false, incremental numeric segment
55 // IDs are rendered
56 RBTDLL_EXPORT void SetModel(ModelPtr spModel,
57 bool bUseModelSegmentNames = false);
58
59 // DM 21 Apr 1999 - change the segment ID counter
60 // Set to nSegmentId-1 as the counter gets incremented before each Render
61 void SetNextSegmentId(int nSegmentId) {
62 m_nSegmentId = nSegmentId - 1;
63 m_bUseModelSegmentNames = false;
64 }
65
66 // Get/set the multi-conformer status
67 // With MultiConf = false, each call to Render should immediately Write the
68 // cache to the file With MultiConf = true, each call to Render should
69 // continue to fill the cache with atom records The cache is only written by
70 // an explicit call to WriteMultiConf, or by the base FileSink destructor
71 bool GetMultiConf() const;
72 void SetMultiConf(bool bMultiConf);
73 // Force writing the file following several multi-conf Renders
74 void WriteMultiConf();
75
76 ModelList GetSolvent() const;
77 void SetSolvent(ModelList solventList);
78
79protected:
81 // Protected methods
83 void Reset(); // Reset the atom, residue and segment numbering
84
85private:
87 // Private methods
89
90 BaseMolecularFileSink(); // Disable default constructor
92 const BaseMolecularFileSink &); // Copy constructor disabled by default
93 BaseMolecularFileSink &operator=(
94 const BaseMolecularFileSink &); // Copy assignment disabled by default
95
96protected:
98 // Protected data
100 int m_nAtomId; // Next available atom number
101 int m_nSubunitId; // Next available subunit number
102 int m_nSegmentId; // Next available segment number
103 // DM 21 Apr 1999 - if true, output the atom segment names in the model
104 // If false, output incremental segment IDs
105 bool m_bUseModelSegmentNames;
106
107private:
109 // Private data
111 ModelPtr m_spModel;
112 ModelList m_solventList;
113 bool m_bMultiConf;
114};
115
116void to_json(json &j, const BaseMolecularFileSink &baseBiMolFSink);
117void from_json(const json &j, BaseMolecularFileSink &baseBiMolFSink);
118
119// Useful typedefs
121
122} // namespace rxdock
123
124#endif //_RBTBASEMOLECULARFILESINK_H_
Definition BaseFileSink.h:31
Definition BaseMolecularFileSink.h:29