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 #ifndef _RD_MONOMERINFO_H
16 #define _RD_MONOMERINFO_H
17 
18 #include <string>
19 #include <boost/shared_ptr.hpp>
20 
21 namespace RDKit {
22 
23 //! The abstract base class for atom-level monomer info
25  public:
26  typedef enum { UNKNOWN = 0, PDBRESIDUE, OTHER } AtomMonomerType;
27 
28  virtual ~AtomMonomerInfo(){};
29 
30  AtomMonomerInfo() : d_monomerType(UNKNOWN), d_name(""){};
31  AtomMonomerInfo(AtomMonomerType typ, const std::string &nm = "")
32  : d_monomerType(typ), d_name(nm){};
34  : d_monomerType(other.d_monomerType), d_name(other.d_name){};
35 
36  const std::string &getName() const { return d_name; };
37  void setName(const std::string &nm) { d_name = nm; };
38  AtomMonomerType getMonomerType() const { return d_monomerType; };
39  void setMonomerType(AtomMonomerType typ) { d_monomerType = typ; };
40 
41  virtual AtomMonomerInfo *copy() const { return new AtomMonomerInfo(*this); }
42 
43  private:
44  AtomMonomerType d_monomerType;
45  std::string d_name;
46 };
47 
48 //! Captures atom-level information about peptide residues
50  public:
53  : AtomMonomerInfo(other),
54  d_serialNumber(other.d_serialNumber),
55  d_altLoc(other.d_altLoc),
56  d_residueName(other.d_residueName),
57  d_residueNumber(other.d_residueNumber),
58  d_chainId(other.d_chainId),
59  d_insertionCode(other.d_insertionCode),
60  d_occupancy(other.d_occupancy),
61  d_tempFactor(other.d_tempFactor),
62  df_heteroAtom(other.df_heteroAtom),
63  d_secondaryStructure(other.d_secondaryStructure),
64  d_segmentNumber(other.d_segmentNumber){};
65 
66  AtomPDBResidueInfo(const std::string &atomName, int serialNumber = 0,
67  const std::string &altLoc = "",
68  const std::string &residueName = "", int residueNumber = 0,
69  const std::string &chainId = "",
70  const std::string &insertionCode = "",
71  double occupancy = 1.0, double tempFactor = 0.0,
72  bool isHeteroAtom = false,
73  unsigned int secondaryStructure = 0,
74  unsigned int segmentNumber = 0)
75  : AtomMonomerInfo(PDBRESIDUE, atomName),
76  d_serialNumber(serialNumber),
77  d_altLoc(altLoc),
78  d_residueName(residueName),
79  d_residueNumber(residueNumber),
80  d_chainId(chainId),
81  d_insertionCode(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 
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;
121  std::string d_altLoc;
122  std::string d_residueName;
123  int d_residueNumber;
124  std::string d_chainId;
125  std::string d_insertionCode;
126  double d_occupancy;
127  double d_tempFactor;
128  // additional, non-PDB fields:
129  bool df_heteroAtom; // is this from a HETATM record?
130  unsigned int d_secondaryStructure;
131  unsigned int d_segmentNumber;
132 };
133 };
134 //! allows AtomPDBResidueInfo objects to be dumped to streams
135 std::ostream &operator<<(std::ostream &target,
136  const RDKit::AtomPDBResidueInfo &apri);
137 
138 #endif
AtomMonomerType getMonomerType() const
Definition: MonomerInfo.h:38
const std::string & getResidueName() const
Definition: MonomerInfo.h:92
AtomMonomerInfo(const AtomMonomerInfo &other)
Definition: MonomerInfo.h:33
void setName(const std::string &nm)
Definition: MonomerInfo.h:37
std::ostream & operator<<(std::ostream &target, const RDKit::AtomPDBResidueInfo &apri)
allows AtomPDBResidueInfo objects to be dumped to streams
void setSerialNumber(int val)
Definition: MonomerInfo.h:89
The abstract base class for atom-level monomer info.
Definition: MonomerInfo.h:24
void setResidueNumber(int val)
Definition: MonomerInfo.h:95
void setInsertionCode(const std::string &val)
Definition: MonomerInfo.h:99
void setAltLoc(const std::string &val)
Definition: MonomerInfo.h:91
unsigned int getSecondaryStructure() const
Definition: MonomerInfo.h:106
double getTempFactor() const
Definition: MonomerInfo.h:102
const std::string & getAltLoc() const
Definition: MonomerInfo.h:90
void setMonomerType(AtomMonomerType typ)
Definition: MonomerInfo.h:39
void setChainId(const std::string &val)
Definition: MonomerInfo.h:97
double getOccupancy() const
Definition: MonomerInfo.h:100
AtomMonomerInfo * copy() const
Definition: MonomerInfo.h:111
const std::string & getInsertionCode() const
Definition: MonomerInfo.h:98
void setSegmentNumber(unsigned int val)
Definition: MonomerInfo.h:109
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:29
AtomPDBResidueInfo(const AtomPDBResidueInfo &other)
Definition: MonomerInfo.h:52
void setOccupancy(double val)
Definition: MonomerInfo.h:101
void setIsHeteroAtom(bool val)
Definition: MonomerInfo.h:105
void setSecondaryStructure(unsigned int val)
Definition: MonomerInfo.h:107
const std::string & getChainId() const
Definition: MonomerInfo.h:96
virtual AtomMonomerInfo * copy() const
Definition: MonomerInfo.h:41
int getResidueNumber() const
Definition: MonomerInfo.h:94
virtual ~AtomMonomerInfo()
Definition: MonomerInfo.h:28
const std::string & getName() const
Definition: MonomerInfo.h:36
bool getIsHeteroAtom() const
Definition: MonomerInfo.h:104
Captures atom-level information about peptide residues.
Definition: MonomerInfo.h:49
AtomMonomerInfo(AtomMonomerType typ, const std::string &nm="")
Definition: MonomerInfo.h:31
int getSerialNumber() const
Definition: MonomerInfo.h:88
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:66
void setTempFactor(double val)
Definition: MonomerInfo.h:103
unsigned int getSegmentNumber() const
Definition: MonomerInfo.h:108
void setResidueName(const std::string &val)
Definition: MonomerInfo.h:93