RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
MonomerInfo.h
Go to the documentation of this file.
1//
2// Copyright (C) 2013-2024 Greg Landrum and other RDKit contributors
3//
4// @@ All Rights Reserved @@
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10/*! \file MonomerInfo.h
11
12 \brief Defines Monomer information classes
13
14*/
15#include <RDGeneral/export.h>
16#ifndef RD_MONOMERINFO_H
17#define RD_MONOMERINFO_H
18
19#include <string>
20#include <utility>
21#include <boost/shared_ptr.hpp>
22
23namespace RDKit {
24
25//! The abstract base class for atom-level monomer info
27 public:
28 typedef enum { UNKNOWN = 0, PDBRESIDUE, OTHER } AtomMonomerType;
29
30 virtual ~AtomMonomerInfo() {}
31
32 AtomMonomerInfo() = default;
33 AtomMonomerInfo(AtomMonomerType typ, std::string nm = "")
34 : d_monomerType(typ), d_name(std::move(nm)) {}
35 AtomMonomerInfo(const AtomMonomerInfo &other) = default;
36
37 const std::string &getName() const { return d_name; }
38 void setName(const std::string &nm) { d_name = nm; }
39 AtomMonomerType getMonomerType() const { return d_monomerType; }
40 void setMonomerType(AtomMonomerType typ) { d_monomerType = typ; }
41
42 virtual AtomMonomerInfo *copy() const { return new AtomMonomerInfo(*this); }
43
44 private:
45 AtomMonomerType d_monomerType{UNKNOWN};
46 std::string d_name{""};
47};
48
49//! Captures atom-level information about peptide residues
51 public:
53 AtomPDBResidueInfo(const AtomPDBResidueInfo &other) = default;
54
55 AtomPDBResidueInfo(const std::string &atomName, int serialNumber = 0,
56 std::string altLoc = "", std::string residueName = "",
57 int residueNumber = 0, std::string chainId = "",
58 std::string insertionCode = "", double occupancy = 1.0,
59 double tempFactor = 0.0, bool isHeteroAtom = false,
60 unsigned int secondaryStructure = 0,
61 unsigned int segmentNumber = 0)
62 : AtomMonomerInfo(PDBRESIDUE, atomName),
63 d_serialNumber(serialNumber),
64 d_altLoc(std::move(altLoc)),
65 d_residueName(std::move(residueName)),
66 d_residueNumber(residueNumber),
67 d_chainId(std::move(chainId)),
68 d_insertionCode(std::move(insertionCode)),
69 d_occupancy(occupancy),
70 d_tempFactor(tempFactor),
71 df_heteroAtom(isHeteroAtom),
72 d_secondaryStructure(secondaryStructure),
73 d_segmentNumber(segmentNumber) {}
74
75 int getSerialNumber() const { return d_serialNumber; }
76 void setSerialNumber(int val) { d_serialNumber = val; }
77 const std::string &getAltLoc() const { return d_altLoc; }
78 void setAltLoc(const std::string &val) { d_altLoc = val; }
79 const std::string &getResidueName() const { return d_residueName; }
80 void setResidueName(const std::string &val) { d_residueName = val; }
81 int getResidueNumber() const { return d_residueNumber; }
82 void setResidueNumber(int val) { d_residueNumber = val; }
83 const std::string &getChainId() const { return d_chainId; }
84 void setChainId(const std::string &val) { d_chainId = val; }
85 const std::string &getInsertionCode() const { return d_insertionCode; }
86 void setInsertionCode(const std::string &val) { d_insertionCode = val; }
87 double getOccupancy() const { return d_occupancy; }
88 void setOccupancy(double val) { d_occupancy = val; }
89 double getTempFactor() const { return d_tempFactor; }
90 void setTempFactor(double val) { d_tempFactor = val; }
91 bool getIsHeteroAtom() const { return df_heteroAtom; }
92 void setIsHeteroAtom(bool val) { df_heteroAtom = val; }
93 unsigned int getSecondaryStructure() const { return d_secondaryStructure; }
94 void setSecondaryStructure(unsigned int val) { d_secondaryStructure = val; }
95 unsigned int getSegmentNumber() const { return d_segmentNumber; }
96 void setSegmentNumber(unsigned int val) { d_segmentNumber = val; }
97
98 AtomMonomerInfo *copy() const override {
99 return static_cast<AtomMonomerInfo *>(new AtomPDBResidueInfo(*this));
100 }
101
102 private:
103 // the fields here are from the PDB definition
104 // (http://www.wwpdb.org/documentation/format33/sect9.html#ATOM) [9 Aug, 2013]
105 // element and charge are not present since the atom itself stores that
106 // information
107 unsigned int d_serialNumber = 0;
108 std::string d_altLoc = "";
109 std::string d_residueName = "";
110 int d_residueNumber = 0;
111 std::string d_chainId = "";
112 std::string d_insertionCode = "";
113 double d_occupancy = 1.0;
114 double d_tempFactor = 0.0;
115 // additional, non-PDB fields:
116 bool df_heteroAtom = false; // is this from a HETATM record?
117 unsigned int d_secondaryStructure = 0;
118 unsigned int d_segmentNumber = 0;
119};
120}; // namespace RDKit
121//! allows AtomPDBResidueInfo objects to be dumped to streams
123 std::ostream &target, const RDKit::AtomPDBResidueInfo &apri);
124
125#endif
RDKIT_GRAPHMOL_EXPORT std::ostream & operator<<(std::ostream &target, const RDKit::AtomPDBResidueInfo &apri)
allows AtomPDBResidueInfo objects to be dumped to streams
The abstract base class for atom-level monomer info.
Definition MonomerInfo.h:26
void setName(const std::string &nm)
Definition MonomerInfo.h:38
const std::string & getName() const
Definition MonomerInfo.h:37
AtomMonomerInfo(const AtomMonomerInfo &other)=default
AtomMonomerInfo(AtomMonomerType typ, std::string nm="")
Definition MonomerInfo.h:33
virtual AtomMonomerInfo * copy() const
Definition MonomerInfo.h:42
void setMonomerType(AtomMonomerType typ)
Definition MonomerInfo.h:40
AtomMonomerType getMonomerType() const
Definition MonomerInfo.h:39
Captures atom-level information about peptide residues.
Definition MonomerInfo.h:50
void setIsHeteroAtom(bool val)
Definition MonomerInfo.h:92
AtomPDBResidueInfo(const AtomPDBResidueInfo &other)=default
double getTempFactor() const
Definition MonomerInfo.h:89
void setResidueNumber(int val)
Definition MonomerInfo.h:82
void setOccupancy(double val)
Definition MonomerInfo.h:88
AtomMonomerInfo * copy() const override
Definition MonomerInfo.h:98
void setSecondaryStructure(unsigned int val)
Definition MonomerInfo.h:94
double getOccupancy() const
Definition MonomerInfo.h:87
void setInsertionCode(const std::string &val)
Definition MonomerInfo.h:86
void setChainId(const std::string &val)
Definition MonomerInfo.h:84
bool getIsHeteroAtom() const
Definition MonomerInfo.h:91
void setAltLoc(const std::string &val)
Definition MonomerInfo.h:78
const std::string & getInsertionCode() const
Definition MonomerInfo.h:85
const std::string & getChainId() const
Definition MonomerInfo.h:83
void setSerialNumber(int val)
Definition MonomerInfo.h:76
unsigned int getSegmentNumber() const
Definition MonomerInfo.h:95
AtomPDBResidueInfo(const std::string &atomName, int serialNumber=0, std::string altLoc="", std::string residueName="", int residueNumber=0, std::string chainId="", std::string insertionCode="", double occupancy=1.0, double tempFactor=0.0, bool isHeteroAtom=false, unsigned int secondaryStructure=0, unsigned int segmentNumber=0)
Definition MonomerInfo.h:55
void setResidueName(const std::string &val)
Definition MonomerInfo.h:80
const std::string & getResidueName() const
Definition MonomerInfo.h:79
unsigned int getSecondaryStructure() const
Definition MonomerInfo.h:93
void setSegmentNumber(unsigned int val)
Definition MonomerInfo.h:96
const std::string & getAltLoc() const
Definition MonomerInfo.h:77
void setTempFactor(double val)
Definition MonomerInfo.h:90
#define RDKIT_GRAPHMOL_EXPORT
Definition export.h:233
Std stuff.