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
34 /**
35 * \param typ the 'type' of monomer this represents:
36 * * UNKNOWN default for base class
37 * * PDBRESIDUE set when AtomPDBResidueInfo is instantiated
38 * * OTHER
39 * \param nm the atom name (e.g. "CA" using PDB atom naming)
40 * \param residueName the residue name (e.g. "ALA")
41 * \param resNum the residue number (e.g. 12)
42 * \param chainId the chain identifier (e.g. "A", "Heavy", "PEPTIDE1")
43 * \param monomerClass further classification of the monomer (e.g, "LGRP", "LINK")
44 */
45 AtomMonomerInfo(AtomMonomerType typ, std::string nm = "", std::string residueName = "",
46 int resNum = 0, std::string chainId = "", std::string monomerClass = "")
47 : d_monomerType(typ), d_name(std::move(nm)), d_residueNumber(resNum),
48 d_chainId(std::move(chainId)), d_monomerClass(std::move(monomerClass)),
49 d_residueName(std::move(residueName)) {}
50 AtomMonomerInfo(const AtomMonomerInfo &other) = default;
51
52 const std::string &getName() const { return d_name; }
53 void setName(const std::string &nm) { d_name = nm; }
54 AtomMonomerType getMonomerType() const { return d_monomerType; }
55 void setMonomerType(AtomMonomerType typ) { d_monomerType = typ; }
56 const std::string &getChainId() const { return d_chainId; }
57 void setChainId(const std::string &val) { d_chainId = val; }
58 int getResidueNumber() const { return d_residueNumber; }
59 void setResidueNumber(int val) { d_residueNumber = val; }
60 const std::string &getResidueName() const { return d_residueName; }
61 void setResidueName(const std::string &val) { d_residueName = val; }
62 const std::string &getMonomerClass() const { return d_monomerClass; }
63 void setMonomerClass(const std::string &val) { d_monomerClass = val; }
64
65 virtual AtomMonomerInfo *copy() const { return new AtomMonomerInfo(*this); }
66
67 private:
68 AtomMonomerType d_monomerType{UNKNOWN};
69 std::string d_name{""};
70 int d_residueNumber = 0;
71 std::string d_chainId = "";
72 std::string d_monomerClass = "";
73 std::string d_residueName = "";
74};
75
76//! Captures atom-level information about peptide residues
78 public:
80 AtomPDBResidueInfo(const AtomPDBResidueInfo &other) = default;
81
82 AtomPDBResidueInfo(const std::string &atomName, int serialNumber = 0,
83 std::string altLoc = "", std::string residueName = "",
84 int residueNumber = 0, std::string chainId = "",
85 std::string insertionCode = "", double occupancy = 1.0,
86 double tempFactor = 0.0, bool isHeteroAtom = false,
87 unsigned int secondaryStructure = 0,
88 unsigned int segmentNumber = 0,
89 std::string monomerClass = "")
90 : AtomMonomerInfo(PDBRESIDUE, atomName, residueName, residueNumber, chainId,
91 monomerClass),
92 d_serialNumber(serialNumber),
93 d_altLoc(std::move(altLoc)),
94 d_insertionCode(std::move(insertionCode)),
95 d_occupancy(occupancy),
96 d_tempFactor(tempFactor),
97 df_heteroAtom(isHeteroAtom),
98 d_secondaryStructure(secondaryStructure),
99 d_segmentNumber(segmentNumber) {}
100
101 int getSerialNumber() const { return d_serialNumber; }
102 void setSerialNumber(int val) { d_serialNumber = val; }
103 const std::string &getAltLoc() const { return d_altLoc; }
104 void setAltLoc(const std::string &val) { d_altLoc = val; }
105 const std::string &getInsertionCode() const { return d_insertionCode; }
106 void setInsertionCode(const std::string &val) { d_insertionCode = val; }
107 double getOccupancy() const { return d_occupancy; }
108 void setOccupancy(double val) { d_occupancy = val; }
109 double getTempFactor() const { return d_tempFactor; }
110 void setTempFactor(double val) { d_tempFactor = val; }
111 bool getIsHeteroAtom() const { return df_heteroAtom; }
112 void setIsHeteroAtom(bool val) { df_heteroAtom = val; }
113 unsigned int getSecondaryStructure() const { return d_secondaryStructure; }
114 void setSecondaryStructure(unsigned int val) { d_secondaryStructure = val; }
115 unsigned int getSegmentNumber() const { return d_segmentNumber; }
116 void setSegmentNumber(unsigned int val) { d_segmentNumber = val; }
117
118 AtomMonomerInfo *copy() const override {
119 return static_cast<AtomMonomerInfo *>(new AtomPDBResidueInfo(*this));
120 }
121
122 private:
123 // the fields here are from the PDB definition
124 // (http://www.wwpdb.org/documentation/format33/sect9.html#ATOM) [9 Aug, 2013]
125 // element and charge are not present since the atom itself stores that
126 // information
127 unsigned int d_serialNumber = 0;
128 std::string d_altLoc = "";
129 std::string d_insertionCode = "";
130 double d_occupancy = 1.0;
131 double d_tempFactor = 0.0;
132 // additional, non-PDB fields:
133 bool df_heteroAtom = false; // is this from a HETATM record?
134 unsigned int d_secondaryStructure = 0;
135 unsigned int d_segmentNumber = 0;
136};
137}; // namespace RDKit
138//! allows AtomPDBResidueInfo objects to be dumped to streams
140 std::ostream &target, const RDKit::AtomPDBResidueInfo &apri);
141
142#endif
RDKIT_GRAPHMOL_EXPORT std::ostream & operator<<(std::ostream &target, const RDKit::AtomPDBResidueInfo &apri)
allows AtomPDBResidueInfo objects to be dumped to streams
AtomMonomerInfo(AtomMonomerType typ, std::string nm="", std::string residueName="", int resNum=0, std::string chainId="", std::string monomerClass="")
Definition MonomerInfo.h:45
void setName(const std::string &nm)
Definition MonomerInfo.h:53
int getResidueNumber() const
Definition MonomerInfo.h:58
const std::string & getName() const
Definition MonomerInfo.h:52
void setResidueName(const std::string &val)
Definition MonomerInfo.h:61
const std::string & getChainId() const
Definition MonomerInfo.h:56
AtomMonomerInfo(const AtomMonomerInfo &other)=default
void setChainId(const std::string &val)
Definition MonomerInfo.h:57
virtual AtomMonomerInfo * copy() const
Definition MonomerInfo.h:65
const std::string & getMonomerClass() const
Definition MonomerInfo.h:62
void setMonomerType(AtomMonomerType typ)
Definition MonomerInfo.h:55
void setResidueNumber(int val)
Definition MonomerInfo.h:59
const std::string & getResidueName() const
Definition MonomerInfo.h:60
AtomMonomerType getMonomerType() const
Definition MonomerInfo.h:54
void setMonomerClass(const std::string &val)
Definition MonomerInfo.h:63
Captures atom-level information about peptide residues.
Definition MonomerInfo.h:77
void setIsHeteroAtom(bool val)
AtomPDBResidueInfo(const AtomPDBResidueInfo &other)=default
double getTempFactor() const
void setOccupancy(double val)
AtomMonomerInfo * copy() const override
void setSecondaryStructure(unsigned int val)
double getOccupancy() const
void setInsertionCode(const std::string &val)
void setAltLoc(const std::string &val)
const std::string & getInsertionCode() const
void setSerialNumber(int val)
unsigned int getSegmentNumber() const
unsigned int getSecondaryStructure() const
void setSegmentNumber(unsigned int val)
const std::string & getAltLoc() const
void setTempFactor(double val)
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, std::string monomerClass="")
Definition MonomerInfo.h:82
#define RDKIT_GRAPHMOL_EXPORT
Definition export.h:257
Std stuff.