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