RDKit: MonomerInfo.h Source File

| 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
26 class RDKIT_GRAPHMOL_EXPORT AtomMonomerInfo {
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
50 class RDKIT_GRAPHMOL_EXPORT AtomPDBResidueInfo : public AtomMonomerInfo {
51 public:
52 AtomPDBResidueInfo() : AtomMonomerInfo(PDBRESIDUE) {}
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
122 RDKIT_GRAPHMOL_EXPORT std::ostream &operator<<(
123 std::ostream &target, const RDKit::AtomPDBResidueInfo &apri);
124
125#endif
operator<<
RDKIT_GRAPHMOL_EXPORT std::ostream & operator<<(std::ostream &target, const RDKit::AtomPDBResidueInfo &apri)
allows AtomPDBResidueInfo objects to be dumped to streams
RDKit::AtomMonomerInfo::setName
void setName(const std::string &nm)
Definition MonomerInfo.h:38
RDKit::AtomMonomerInfo::~AtomMonomerInfo
virtual ~AtomMonomerInfo()
Definition MonomerInfo.h:30
RDKit::AtomMonomerInfo::AtomMonomerType
AtomMonomerType
Definition MonomerInfo.h:28
RDKit::AtomMonomerInfo::UNKNOWN
@ UNKNOWN
Definition MonomerInfo.h:28
RDKit::AtomMonomerInfo::PDBRESIDUE
@ PDBRESIDUE
Definition MonomerInfo.h:28
RDKit::AtomMonomerInfo::OTHER
@ OTHER
Definition MonomerInfo.h:28
RDKit::AtomMonomerInfo::getName
const std::string & getName() const
Definition MonomerInfo.h:37
RDKit::AtomMonomerInfo::AtomMonomerInfo
AtomMonomerInfo(const AtomMonomerInfo &other)=default
RDKit::AtomMonomerInfo::AtomMonomerInfo
AtomMonomerInfo(AtomMonomerType typ, std::string nm="")
Definition MonomerInfo.h:33
RDKit::AtomMonomerInfo::copy
virtual AtomMonomerInfo * copy() const
Definition MonomerInfo.h:42
RDKit::AtomMonomerInfo::setMonomerType
void setMonomerType(AtomMonomerType typ)
Definition MonomerInfo.h:40
RDKit::AtomMonomerInfo::AtomMonomerInfo
AtomMonomerInfo()=default
RDKit::AtomMonomerInfo::getMonomerType
AtomMonomerType getMonomerType() const
Definition MonomerInfo.h:39
RDKit::AtomPDBResidueInfo
Captures atom-level information about peptide residues.
Definition MonomerInfo.h:50
RDKit::AtomPDBResidueInfo::setIsHeteroAtom
void setIsHeteroAtom(bool val)
Definition MonomerInfo.h:92
RDKit::AtomPDBResidueInfo::AtomPDBResidueInfo
AtomPDBResidueInfo(const AtomPDBResidueInfo &other)=default
RDKit::AtomPDBResidueInfo::getTempFactor
double getTempFactor() const
Definition MonomerInfo.h:89
RDKit::AtomPDBResidueInfo::setResidueNumber
void setResidueNumber(int val)
Definition MonomerInfo.h:82
RDKit::AtomPDBResidueInfo::setOccupancy
void setOccupancy(double val)
Definition MonomerInfo.h:88
RDKit::AtomPDBResidueInfo::copy
AtomMonomerInfo * copy() const override
Definition MonomerInfo.h:98
RDKit::AtomPDBResidueInfo::setSecondaryStructure
void setSecondaryStructure(unsigned int val)
Definition MonomerInfo.h:94
RDKit::AtomPDBResidueInfo::getOccupancy
double getOccupancy() const
Definition MonomerInfo.h:87
RDKit::AtomPDBResidueInfo::setInsertionCode
void setInsertionCode(const std::string &val)
Definition MonomerInfo.h:86
RDKit::AtomPDBResidueInfo::setChainId
void setChainId(const std::string &val)
Definition MonomerInfo.h:84
RDKit::AtomPDBResidueInfo::getIsHeteroAtom
bool getIsHeteroAtom() const
Definition MonomerInfo.h:91
RDKit::AtomPDBResidueInfo::AtomPDBResidueInfo
AtomPDBResidueInfo()
Definition MonomerInfo.h:52
RDKit::AtomPDBResidueInfo::getResidueNumber
int getResidueNumber() const
Definition MonomerInfo.h:81
RDKit::AtomPDBResidueInfo::setAltLoc
void setAltLoc(const std::string &val)
Definition MonomerInfo.h:78
RDKit::AtomPDBResidueInfo::getInsertionCode
const std::string & getInsertionCode() const
Definition MonomerInfo.h:85
RDKit::AtomPDBResidueInfo::getChainId
const std::string & getChainId() const
Definition MonomerInfo.h:83
RDKit::AtomPDBResidueInfo::setSerialNumber
void setSerialNumber(int val)
Definition MonomerInfo.h:76
RDKit::AtomPDBResidueInfo::getSegmentNumber
unsigned int getSegmentNumber() const
Definition MonomerInfo.h:95
RDKit::AtomPDBResidueInfo::getSerialNumber
int getSerialNumber() const
Definition MonomerInfo.h:75
RDKit::AtomPDBResidueInfo::AtomPDBResidueInfo
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
RDKit::AtomPDBResidueInfo::setResidueName
void setResidueName(const std::string &val)
Definition MonomerInfo.h:80
RDKit::AtomPDBResidueInfo::getResidueName
const std::string & getResidueName() const
Definition MonomerInfo.h:79
RDKit::AtomPDBResidueInfo::getSecondaryStructure
unsigned int getSecondaryStructure() const
Definition MonomerInfo.h:93
RDKit::AtomPDBResidueInfo::setSegmentNumber
void setSegmentNumber(unsigned int val)
Definition MonomerInfo.h:96
RDKit::AtomPDBResidueInfo::getAltLoc
const std::string & getAltLoc() const
Definition MonomerInfo.h:77
RDKit::AtomPDBResidueInfo::setTempFactor
void setTempFactor(double val)
Definition MonomerInfo.h:90
export.h
RDKIT_GRAPHMOL_EXPORT
#define RDKIT_GRAPHMOL_EXPORT
Definition export.h:249
RDKit
Std stuff.
Definition Abbreviations.h:19