OpenStructure
residue_impl.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_RESIDUE_IMPL_HH
20 #define OST_RESIDUE_IMPL_HH
21 
22 #include <boost/enable_shared_from_this.hpp>
23 
24 #include <ost/geom/geom.hh>
25 
26 #include <ost/mol/residue_prop.hh>
28 
33 #include <ost/mol/sec_structure.hh>
36 #include <ost/mol/chem_class.hh>
37 
38 #include <ost/generic_property.hh>
39 #include <ost/mol/property_id.hh>
40 
41 namespace ost { namespace mol { namespace impl {
42 
43 
47  public boost::enable_shared_from_this<ResidueImpl>
48 
49 {
50 public:
51  ResidueImpl(const EntityImplPtr& ent, const ChainImplPtr& ch,
52  const ResNum& num, const ResidueKey& key);
53 
54  AtomImplPtr InsertAtom(const String& name, const geom::Vec3& pos,
55  const String& ele);
58  AtomImplPtr InsertAtom(const AtomImplPtr& atom);
59  AtomImplPtr InsertAltAtom(const String& name, const String& alt_group,
60  const geom::Vec3& pos, const String& ele);
61  const ResNum& GetNumber() const {return num_;}
62  void SetNumber(const ResNum& num) {num_=num;}
63 
64  const ResidueKey& GetKey() const {
65  return key_;
66  }
67 
68  void SetKey(const ResidueKey& key) {
69  key_=key;
70  }
71 
72  ChainImplPtr GetChain() const;
73 
75 
77 
78  char GetOneLetterCode() const;
79 
80  void SetOneLetterCode(const char olc);
81 
88  AtomImplPtr FindAtom(const String& aname) const;
89 
90  void Apply(EntityVisitor& v);
91 
93  int GetAtomCount() const;
94 
96  int GetBondCount() const;
97 
98  EntityImplPtr GetEntity() const;
99 
104  TorsionImplP GetPhiTorsion() const;
105 
111 
116  TorsionImplP GetPsiTorsion() const;
117 
121 
123  void SetSecStructure(SecStructure ss);
124 
125  const AtomImplList& GetAtomList() const;
126 
128  return atom_list_;
129  }
130 
131  Real GetMass() const;
132  geom::Vec3 GetCenterOfMass() const;
134 
136 
137 
138  void DeleteAtom(const AtomImplPtr& atom);
139  void DeleteAtoms(const String& atom_name);
140  void DeleteAllAtoms();
141 
142  void AddTorsion(const TorsionImplP& torsion);
143 
145  return torsion_list_;
146  }
148  bool HasAltAtomGroup(const String& group) const;
149 
150  std::vector<String> GetAltAtomGroupNames() const;
151 
152  std::vector<String> GetAltAtomGroupNames(const AtomImplPtr& atom) const;
153  bool HasAltAtoms() const;
154 
156  Real GetAverageBFactor() const;
157 
158  bool SwitchAtomPos(const String& group);
159 
160  void AddAltAtomPos(const String& group,
161  const AtomImplPtr& atom,
162  const geom::Vec3& position);
163  geom::Vec3 GetAltAtomPos(const AtomImplPtr& atom, const String& group) const;
164 
165 
167  return curr_group_;
168  }
169  int GetIndex() const;
170 
174  String GetQualifiedName() const;
175 
177  const String& GetName() const {
178  return key_;
179  }
180 
183  return torsion_list_;
184  }
185 
187  chem_class_=cc;
188  }
190  return chem_class_;
191  }
192 
193  TorsionImplP FindTorsion(const String& torsion_name) const;
194 
195 
196  String GetStringProperty(Prop::ID prop_id) const;
197 
198  Real GetFloatProperty(Prop::ID prop_id) const;
199 
200  int GetIntProperty(Prop::ID prop_id) const;
201 
202  void SetProtein(bool protein) { protein_=protein; }
203 
204  bool IsProtein() const { return protein_; }
205 
206  bool IsLigand() const { return ligand_; }
207  void SetIsLigand(bool flag) { ligand_=flag; }
208 private:
209  void AddAltAtom(const String& group, const AtomImplPtr& atom,
210  const geom::Vec3& position);
211  void RemoveAltPositionsForAtom(const AtomImplPtr& atom);
212  String curr_group_;
213  AtomEntryGroups alt_groups_;
214  EntityImplW ent_;
215  ChainImplW chain_;
216  ResNum num_;
217  ResidueKey key_;
218  AtomImplList atom_list_;
219  TorsionImplList torsion_list_;
220  SecStructure sec_structure_;
221  ChemClass chem_class_;
222  char olc_;
223  // whether the residue is part of the protein.
224  bool protein_;
225  bool ligand_;
226 };
227 
228 }}} // ns
229 
230 #endif
231