RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
BaseMolecularFileSource.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 data sources
14
15#ifndef _RBTBASEMOLECULARFILESOURCE_H_
16#define _RBTBASEMOLECULARFILESOURCE_H_
17
18#include "rxdock/BaseFileSource.h"
19#include "rxdock/BaseMolecularDataSource.h"
20#include "rxdock/ParameterFileSource.h"
21
22#include <nlohmann/json.hpp>
23
24using json = nlohmann::json;
25
26namespace rxdock {
27
30public:
31 // Constructors
32 // BaseMolecularFileSource(const char* fileName, const char* sourceName);
33 // Single-record version
34 RBTDLL_EXPORT BaseMolecularFileSource(const std::string &fileName,
35 const std::string &sourceName);
36 // Multi-record version, with record delimiter passed as an argument
37 BaseMolecularFileSource(const std::string &fileName,
38 const std::string &strRecDelim,
39 const std::string &sourceName);
40
41 // Destructor
43
44 friend void to_json(json &j, const BaseMolecularFileSource &baseMolFilSrc);
45 friend void from_json(const json &j, BaseMolecularFileSource &baseMolFilSrc);
46
47 // Pure virtual methods from BaseMolecularDataSource
48 void Reset();
49 int GetNumTitles();
50 int GetNumAtoms();
51 int GetNumBonds();
52 int GetNumSegments();
53
54 std::vector<std::string> GetTitleList();
55 AtomList GetAtomList();
56 BondList GetBondList();
57 SegmentMap GetSegmentMap();
58
59 // DM 12 May 1999 - support for data records (e.g. SD file)
60 // Get number of data fields
61 virtual int GetNumData();
62 // Get list of field names as string list
63 virtual std::vector<std::string> GetDataFieldList();
64 // Get all data as map of key=field name, value=variant (double,string or
65 // string list)
66 virtual StringVariantMap GetDataMap();
67 // Query as to whether a particular data field name is present
68 virtual bool isDataFieldPresent(const std::string &strDataField);
69 // Get a particular data value
70 virtual Variant GetDataValue(const std::string &strDataField);
71
72 // These methods allow filtering of the data source by segment name
73 // So for example, we could just read the segment named TAR from the source
74 // The filter modifies the behaviour of GetAtomList, GetBondList etc
75 SegmentMap GetSegmentFilterMap();
76 RBTDLL_EXPORT void SetSegmentFilterMap(const SegmentMap &segmentFilterMap);
77 void ClearSegmentFilterMap();
78 bool isSegmentFilterMapDefined();
79
80protected:
81 // Protected methods
82 void ClearMolCache(); // Clear the atom, bond and title lists
83 void RemoveAtom(AtomPtr spAtom); // DM 16 Feb 2000 - moved from MdlFileSource
84 void
85 RenumberAtomsAndBonds(); // DM 30 Oct 2000 - now independent from RemoveAtom
86 // Moved from MOL2FileSource - sets partial charges on a per-residue basis
87 // Automatically determines protonation states of ASP/GLU/HIS using Mandatory
88 // and Forbidden atoms in spParamSource
89 void SetupPartialIonicGroups(AtomList &atoms,
90 ParameterFileSourcePtr spParamSource);
91
92private:
93 // Private methods
94 BaseMolecularFileSource(); // Disable default constructor
96 const BaseMolecularFileSource &); // Copy constructor disabled by default
97 BaseMolecularFileSource &operator=(
98 const BaseMolecularFileSource &); // Copy assignment disabled by default
99
100 // Get methods with segment filter applied
101 int GetNumAtomsWithFilter();
102 int GetNumBondsWithFilter();
103 AtomList GetAtomListWithFilter();
104 BondList GetBondListWithFilter();
105
106protected:
107 // Protected data
108 std::vector<std::string> m_titleList;
109 AtomList m_atomList;
110 BondList m_bondList;
111 SegmentMap m_segmentMap;
112 StringVariantMap m_dataMap; // DM 12 May 1999 - for storing data records
113
114private:
115 // Private data
116 SegmentMap m_segmentFilterMap;
117};
118
119void to_json(json &j, const BaseMolecularFileSource &baseMolFilSrc);
120void from_json(const json &j, BaseMolecularFileSource &baseMolFilSrc);
121
122// useful typedefs
124 MolecularFileSourcePtr; // Smart pointer
125
126} // namespace rxdock
127
128#endif //_RBTBASEMOLECULARFILESOURCE_H_
Definition BaseFileSource.h:36
Definition BaseMolecularDataSource.h:25
Definition BaseMolecularFileSource.h:29
Definition Variant.h:30