RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
MdlFileSource.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// Handles retrieval of molecular info from MDL Mol and SD files.
14
15#ifndef _RBTMDLFILESOURCE_H_
16#define _RBTMDLFILESOURCE_H_
17
18#include "rxdock/BaseMolecularFileSource.h"
19#include "rxdock/ElementFileSource.h"
20
21#include <nlohmann/json.hpp>
22
23using json = nlohmann::json;
24
25namespace rxdock {
26
27const std::string IDS_MDL_RECDELIM = "$$$$";
28
30public:
31 // Constructors
32 // MdlFileSource(const char* fileName);
33 RBTDLL_EXPORT MdlFileSource(const std::string &fileName,
34 bool bPosIonisable = true,
35 bool bNegIonisable = true,
36 bool bImplHydrogens = true);
37
38 // Default destructor
39 virtual ~MdlFileSource();
40
41 friend void to_json(json &j, const MdlFileSource &mdlFileSrc);
42 friend void from_json(const json &j, MdlFileSource &mdlFileSrc);
43
45 // Override public methods from BaseMolecularDataSource
46 virtual bool isTitleListSupported() { return true; }
47 virtual bool isAtomListSupported() { return true; }
48 virtual bool isCoordinatesSupported() { return true; }
49 virtual bool isBondListSupported() { return true; }
50 // DM 12 May 1999 - support for data records
51 virtual bool isDataSupported() { return true; }
52
53protected:
54 // Pure virtual in BaseFileSource - needs to be defined here
55 virtual void Parse();
56
57private:
58 // Private methods
59 MdlFileSource(); // Disable default constructor
60 MdlFileSource(const MdlFileSource &); // Copy constructor disabled by default
62 operator=(const MdlFileSource &); // Copy assignment disabled by default
63
64 // Sets up all the atomic attributes that are not explicitly stored in the MDL
65 // file
66 void SetupAtomParams();
67
68 // Helper functions for SetupAtomParams()
69
70 // Sets hybridisation state and checks for Nsp3 next to sp2 special case
71 void SetupHybridState();
72
73 // Checks for valency within range
74 // Adds implicit hydrogens to C,N,S
75 // Defines vdW radius, correcting for extended atoms and H-bond donor
76 // hydrogens Defines formal "force-field" type string
77 void SetupTheRest();
78
79 void SetupPosIonisableGroups();
80 void SetupNegIonisableGroups();
81
82 void AddHydrogen(AtomPtr spAtom);
83
84 // SetupIonicGroups sets the "group charge" attribute of the atoms. The idea
85 // is that the "group charge" is file-format independent, and eliminates the
86 // need for the scoring function setup to have any knowledge of the input file
87 // format. For example, PSF files represent COO- as OC-C-OC (both oxygens
88 // charged) whereas SD files represent it as the formal resonance structure
89 // O=C-O-. For rDock we actually want the negative charge on the central
90 // carbon!
91 //
92 // It is envisaged each molecular file source will have a version of
93 // SetupIonicGroups to convert from the native representation to the rDock
94 // representation. The FormalCharge and PartialCharge attributes should be
95 // left untouched to allow the model to be rewritten back in the same format.
96 void SetupIonicGroups();
97 void SetupNSP3Plus(); // Helper function to set up protonated amines
98 void
99 SetupNSP2Plus(); // Helper function to set up guanidines, imidazoles, amidines
100 void SetupOTRIMinus(); // Helper function to set up deprotonated acids
101
102 // DM 4 June 1999 - Search for the separate fragments in the record
103 // and set distinct segment names for each one
104 void SetupSegmentNames();
105
106 // DM 2 Aug 1999 - remove all non-polar hydrogens
107 void RemoveNonPolarHydrogens();
108
109 // DM 8 Feb 2000 - setup atom and bond cyclic flags (previously in Model)
110 // Set the atom and bond cyclic flags for all atoms and bonds in the source
111 void SetCyclicFlags();
112
113 // Private data
115 m_spElementData; // Elemental data source for vdW radii etc
116 bool m_bPosIonisable; // If true, protonate Nsp3, and Nsp2 in imidazole and
117 // guanidinium
118 bool m_bNegIonisable; // If true, deprotonate Otri-Hsp3
119 bool m_bImplHydrogens; // If true, non-hydrogen bonding hydrogens are removed
120};
121
122void to_json(json &j, const MdlFileSource &mdlFileSrc);
123void from_json(const json &j, MdlFileSource &mdlFileSrc);
124
125// useful typedefs
126typedef SmartPtr<MdlFileSource> MdlFileSourcePtr; // Smart pointer
127
128} // namespace rxdock
129
130#endif //_RBTMDLFILESOURCE_H_
Definition BaseMolecularFileSource.h:29
Definition MdlFileSource.h:29