OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #include <ost/mol/chem_type.hh>
38 
39 #include <ost/generic_property.hh>
40 #include <ost/mol/property_id.hh>
41 
42 namespace ost { namespace mol { namespace impl {
43 
44 
48  public boost::enable_shared_from_this<ResidueImpl>
49 
50 {
51 public:
52  ResidueImpl(const EntityImplPtr& ent, const ChainImplPtr& ch,
53  const ResNum& num, const ResidueKey& key);
54 
55  AtomImplPtr InsertAtom(const String& name, const geom::Vec3& pos,
56  const String& ele);
59  AtomImplPtr InsertAtom(const AtomImplPtr& atom);
60  AtomImplPtr InsertAltAtom(const String& name, const String& alt_group,
61  const geom::Vec3& pos, const String& ele,
62  Real occ, Real b_factor);
63  const ResNum& GetNumber() const {return num_;}
64  void SetNumber(const ResNum& num) {num_=num;}
65 
66  const ResidueKey& GetKey() const {
67  return key_;
68  }
69 
70  void SetKey(const ResidueKey& key) {
71  key_=key;
72  }
73 
74  ChainImplPtr GetChain() const;
75 
83  void SetCentralAtom(const AtomImplPtr& a);
84 
86 
87  char GetOneLetterCode() const;
88 
89  void SetOneLetterCode(const char olc);
90 
97  AtomImplPtr FindAtom(const String& aname) const;
98 
99  void Apply(EntityVisitor& v);
100 
102  int GetAtomCount() const;
103 
105  int GetBondCount() const;
106 
107  EntityImplPtr GetEntity() const;
108 
113  TorsionImplP GetPhiTorsion() const;
114 
120 
125  TorsionImplP GetPsiTorsion() const;
126 
130 
132  void SetSecStructure(SecStructure ss);
133 
134  const AtomImplList& GetAtomList() const;
135 
137  return atom_list_;
138  }
139 
140  Real GetMass() const;
141  geom::Vec3 GetCenterOfMass() const;
143 
145 
146 
147  void DeleteAtom(const AtomImplPtr& atom);
148  void DeleteAtoms(const String& atom_name);
149  void DeleteAllAtoms();
150 
151  void AddTorsion(const TorsionImplP& torsion);
152 
154  return torsion_list_;
155  }
157  bool HasAltAtomGroup(const String& group) const;
158 
159  std::vector<String> GetAltAtomGroupNames() const;
160 
161  std::vector<String> GetAltAtomGroupNames(const AtomImplPtr& atom) const;
162  bool HasAltAtoms() const;
163 
165  Real GetAverageBFactor() const;
166 
167  bool SwitchAtomPos(const String& group);
168 
169  void AddAltAtomPos(const String& group,
170  const AtomImplPtr& atom,
171  const geom::Vec3& position,
172  Real occ, Real b_factor);
173  geom::Vec3 GetAltAtomPos(const AtomImplPtr& atom, const String& group) const;
174  Real GetAltAtomOcc(const AtomImplPtr& atom, const String& group) const;
175  Real GetAltAtomBFactor(const AtomImplPtr& atom, const String& group) const;
176 
177 
179  return curr_group_;
180  }
181  int GetIndex() const;
182 
186  String GetQualifiedName() const;
187 
189  const String& GetName() const {
190  return key_;
191  }
192 
195  return torsion_list_;
196  }
197 
199  chem_class_=cc;
200  }
202  return chem_class_;
203  }
205  return chem_type_;
206  }
208  chem_type_=ct;
209  }
210 
211  TorsionImplP FindTorsion(const String& torsion_name) const;
212 
213 
214  String GetStringProperty(Prop::ID prop_id) const;
215 
216  Real GetFloatProperty(Prop::ID prop_id) const;
217 
218  int GetIntProperty(Prop::ID prop_id) const;
219 
220  void SetProtein(bool protein) { protein_=protein; }
221 
222  bool IsProtein() const { return protein_; }
223 
224  bool IsLigand() const { return ligand_; }
225  void SetIsLigand(bool flag) { ligand_=flag; }
226 
227  void UpdateTransformedPos();
228 
229 private:
230  void AddAltAtom(const String& group, const AtomImplPtr& atom,
231  const geom::Vec3& position, Real occ, Real b_factor);
232  void RemoveAltPositionsForAtom(const AtomImplPtr& atom);
233 
234  String curr_group_;
235  AtomEntryGroups alt_groups_;
236  EntityImplW ent_;
237  ChainImplW chain_;
238  ResNum num_;
239  ResidueKey key_;
240  AtomImplList atom_list_;
241  TorsionImplList torsion_list_;
242  SecStructure sec_structure_;
243  ChemClass chem_class_;
244  ChemType chem_type_;
245  char olc_;
246  // whether the residue is part of the protein.
247  // TODO: this should be fixed to be a enum'ed type aka
248  // RESIDUE_TYPE type_;
249  // where enum is one of protein, ligand, dna, lipid, etc
250  bool protein_;
251  bool ligand_;
252  AtomImplPtr central_atom_;
253 
254 };
255 
256 }}} // ns
257 
258 #endif
259