NCBI C++ ToolKit
residue.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: residue.hpp 33815 2007-05-04 17:18:18Z kazimird $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Authors: Paul Thiessen
27 *
28 * File Description:
29 * Classes to hold residues
30 *
31 * ===========================================================================
32 */
33 
34 #ifndef CN3D_RESIDUE__HPP
35 #define CN3D_RESIDUE__HPP
36 
37 #include <corelib/ncbistl.hpp>
38 
39 #include <map>
40 #include <string>
41 
44 
45 #include "structure_base.hpp"
46 
47 BEGIN_SCOPE(Cn3D)
48 
49 typedef std::list< ncbi::CRef< ncbi::objects::CResidue_graph > > ResidueGraphList;
50 
51 // a Residue is a set of bonds that connect one residue of a larger Molecule.
52 // Its constructor is where most of the work of decoding the ASN1 graph is done,
53 // based on the standard and local residue dictionaries. Each Residue also holds
54 // information (AtomInfo) about the nature of the atoms it contains.
55 
56 class Bond;
57 
58 class Residue : public StructureBase
59 {
60 public:
61  Residue(StructureBase *parent,
62  const ncbi::objects::CResidue& residue, int moleculeID,
64  const ResidueGraphList& localDictionary,
65  int nResidues, int moleculeType);
66  ~Residue(void);
67 
68  // public data
69  int id;
70  static const char NO_CODE;
71  char code;
73  nameGraph, // 'name' field from residue-graph dictionary
74  namePDB; // 'name' in Residue, supposed to correspond to PDB-assigned residue number
75  static const int NO_ALPHA_ID;
76  int alphaID; // ID of "alpha" atom (C-alpha or P)
77 
78  // residue type
79  enum eType {
80  eDNA = ncbi::objects::CResidue_graph::eResidue_type_deoxyribonucleotide,
81  eRNA = ncbi::objects::CResidue_graph::eResidue_type_ribonucleotide,
82  eAminoAcid = ncbi::objects::CResidue_graph::eResidue_type_amino_acid,
83  eOther = ncbi::objects::CResidue_graph::eResidue_type_other
84  };
86 
87  // atom type
90  eAlphaBackboneAtom, // C-alpha or P
91  ePartialBackboneAtom, // for unbranched backbone trace
92  eCompleteBackboneAtom, // all backbone atoms
93  eUnknownAtom // anything that's not known to be of an amino acid or nucleotide
94  };
95 
96  typedef struct {
100  unsigned int glName;
101  const Residue *residue; // convenient way to go from atom->residue
103  } AtomInfo;
104 
105  typedef std::list < const Bond * > BondList;
107 
108  // public methods
109  bool HasCode(void) const { return (code != NO_CODE); }
110  bool HasName(void) const { return (!nameGraph.empty()); }
111  bool IsNucleotide(void) const { return (type == eDNA || type == eRNA); }
112  bool IsAminoAcid(void) const { return (type == eAminoAcid); }
113  bool Draw(const AtomSet *atomSet) const;
114 
115  typedef std::map < int , const AtomInfo * > AtomInfoMap;
116 
117 private:
118  AtomInfoMap atomInfos; // mapped by Atom-id
120 
121 public:
122  // # atoms in the graph for this residue
123  int NAtomsInGraph(void) const { return atomInfos.size(); }
124  // # atoms in this residue with real coordinates in any model
125  int NAtomsWithAnyCoords(void) const { return nAtomsWithAnyCoords; }
126 
127  const AtomInfoMap& GetAtomInfos(void) const { return atomInfos; }
128  const AtomInfo * GetAtomInfo(int aID) const
129  {
130  AtomInfoMap::const_iterator info=atomInfos.find(aID);
131  if (info != atomInfos.end()) return (*info).second;
132  ERR_POST(ncbi::Warning << "Residue #" << id << ": can't find atom #" << aID);
133  return NULL;
134  }
135 };
136 
137 END_SCOPE(Cn3D)
138 
139 #endif // CN3D_RESIDUE__HPP
User-defined methods of the data storage class.
User-defined methods of the data storage class.
static const CBiostruc_residue_graph_set * standardDictionary
Definition: bond.hpp:50
CRef –.
Definition: ncbiobj.hpp:618
CResidue_graph –.
bool IsNucleotide(void) const
Definition: residue.hpp:111
static const char NO_CODE
Definition: residue.hpp:70
std::string namePDB
Definition: residue.hpp:74
int id
Definition: residue.hpp:69
eType type
Definition: residue.hpp:85
int NAtomsWithAnyCoords(void) const
Definition: residue.hpp:125
const AtomInfo * GetAtomInfo(int aID) const
Definition: residue.hpp:128
bool HasName(void) const
Definition: residue.hpp:110
static const int NO_ALPHA_ID
Definition: residue.hpp:75
eAtomClassification
Definition: residue.hpp:88
@ eSideChainAtom
Definition: residue.hpp:89
@ ePartialBackboneAtom
Definition: residue.hpp:91
@ eAlphaBackboneAtom
Definition: residue.hpp:90
@ eCompleteBackboneAtom
Definition: residue.hpp:92
bool HasCode(void) const
Definition: residue.hpp:109
int alphaID
Definition: residue.hpp:76
std::map< int, const AtomInfo * > AtomInfoMap
Definition: residue.hpp:115
bool IsAminoAcid(void) const
Definition: residue.hpp:112
const AtomInfoMap & GetAtomInfos(void) const
Definition: residue.hpp:127
int NAtomsInGraph(void) const
Definition: residue.hpp:123
BondList bonds
Definition: residue.hpp:106
std::list< const Bond * > BondList
Definition: residue.hpp:105
char code
Definition: residue.hpp:71
AtomInfoMap atomInfos
Definition: residue.hpp:118
int nAtomsWithAnyCoords
Definition: residue.hpp:119
std::string nameGraph
Definition: residue.hpp:73
string
Definition: cgiapp.hpp:687
#define NULL
Definition: ncbistd.hpp:225
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
Definition: ncbidiag.hpp:186
void Warning(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1191
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
@ eOther
Something else.
Definition: unicode.hpp:59
static MDB_envinfo info
Definition: mdb_load.c:37
std::list< ncbi::CRef< ncbi::objects::CResidue_graph > > ResidueGraphList
Definition: molecule.hpp:58
Magic spell ;-) needed for some weird compilers... very empiric.
The NCBI C++/STL use hints.
bool isIonizableProton
Definition: residue.hpp:102
unsigned int glName
Definition: residue.hpp:100
std::string name
Definition: residue.hpp:97
const Residue * residue
Definition: residue.hpp:101
eAtomClassification classification
Definition: residue.hpp:99
Definition: inftrees.h:24
Definition: type.c:6
Modified on Thu Jun 13 17:28:23 2024 by modify_doxy.py rev. 669887