RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
MdlFileSink.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// Class for writing Model's to MDL SD and MOL files
14
15#ifndef _RBTMDLFILESINK_H_
16#define _RBTMDLFILESINK_H_
17
18#include "rxdock/BaseMolecularFileSink.h"
19#include "rxdock/ElementFileSource.h"
20
21#include <nlohmann/json.hpp>
22
23using json = nlohmann::json;
24
25namespace rxdock {
26
27// DM 19 June 2006
28// Map to keep track of logical atom IDs as they are rendered to file
29// This avoids the need for the atoms in the Model to have consecutive
30// atom IDs. The rendering of enabled solvent models is now supported
31// correctly.
32// Key = Atom* pointer
33// Value = logical atom ID as rendered to file
34// Logical atom IDs are consecutive for all atoms rendered
35// The actual atom ID (Atom::GetAtomId()) is unchanged
36typedef std::map<Atom *, unsigned int, AtomPtrCmp_Ptr> AtomIdMap;
37
39public:
41 // Constructors/destructors
42 RBTDLL_EXPORT MdlFileSink(const std::string &fileName, ModelPtr spModel);
43
44 virtual ~MdlFileSink(); // Default destructor
45
46 friend void to_json(json &j, const MdlFileSink &mdlFileSink);
47 friend void from_json(const json &j, MdlFileSink &mdlFileSink);
48
50 // Public methods
52 //
53 //
55 // Override public methods from BaseFileSink
56 virtual void Render();
57
58protected:
60 // Protected methods
62
63private:
65 // Private methods
67 void RenderAtomList(const AtomList &atomList);
68 void RenderBondList(const BondList &bondList);
69 void RenderData(const StringVariantMap &dataMap);
70
71 MdlFileSink(); // Disable default constructor
72 MdlFileSink(const MdlFileSink &); // Copy constructor disabled by
73 // default
75 operator=(const MdlFileSink &); // Copy assignment disabled by default
76
77protected:
79 // Protected data
81
82private:
84 // Private data
86 ElementFileSourcePtr m_spElementData;
87 // DM 27 Apr 1999 - default behaviour is for the first Render to overwrite any
88 // existing file then subsequent Renders to append.
89 bool m_bFirstRender;
90 AtomIdMap m_atomIdMap; // Keep track of logical atom IDs as rendered to
91 // file
92};
93
94void to_json(json &j, const MdlFileSink &mdlFileSink);
95void from_json(const json &j, MdlFileSink &mdlFileSink);
96
97// Useful typedefs
98typedef SmartPtr<MdlFileSink> MdlFileSinkPtr; // Smart pointer
99
100void RenumberScaffold(AtomList &atomList);
101
102} // namespace rxdock
103
104#endif //_RBTMDLFILESINK_H_
Definition BaseMolecularFileSink.h:29
Definition MdlFileSink.h:38