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