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-2020 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);
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 
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 
108 
114 
120 
126 
130 
133 
134  const AtomImplList& GetAtomList() const;
135 
137  return atom_list_;
138  }
139 
140  Real GetMass() const;
143 
145 
146 
147  void DeleteAtom(const AtomImplPtr& atom);
148  void DeleteAtoms(const String& atom_name);
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 
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 
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 
215 
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 
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 
axis-aligned cuboid
Three dimensional vector class, using Real precision.
Definition: vec3.hh:48
base class for the implementation
EntityVisitor interface.
ChemType GetChemType() const
void AddTorsion(const TorsionImplP &torsion)
void SetNumber(const ResNum &num)
Definition: residue_impl.hh:64
String GetStringProperty(Prop::ID prop_id) const
EntityImplPtr GetEntity() const
std::vector< String > GetAltAtomGroupNames(const AtomImplPtr &atom) const
void SetSecStructure(SecStructure ss)
Set secondary structure type.
int GetIntProperty(Prop::ID prop_id) const
TorsionImplP GetPsiTorsion() const
Get psi torsion.
ChainImplPtr GetChain() const
Real GetAltAtomOcc(const AtomImplPtr &atom, const String &group) const
std::vector< String > GetAltAtomGroupNames() const
AtomImplPtr InsertAltAtom(const String &name, const String &alt_group, const geom::Vec3 &pos, const String &ele, Real occ, Real b_factor)
ResidueImpl(const EntityImplPtr &ent, const ChainImplPtr &ch, const ResNum &num, const ResidueKey &key)
SecStructure GetSecStructure() const
Get secondary structure type. By default, the residue is in COIL conformation.
void SetCentralAtom(const AtomImplPtr &a)
bool SwitchAtomPos(const String &group)
void SetKey(const ResidueKey &key)
Definition: residue_impl.hh:70
TorsionImplP GetOmegaTorsion() const
Retrieve omega torsion between this and the previous residue.
geom::Vec3 GetAltAtomPos(const AtomImplPtr &atom, const String &group) const
void DeleteAtom(const AtomImplPtr &atom)
AtomImplPtr InsertAtom(const AtomImplPtr &atom)
insert new residue with exactly the same parameters as atom, but no bonds
TorsionImplP GetPhiTorsion() const
Get phi torsion.
void SetOneLetterCode(const char olc)
geom::AlignedCuboid GetBounds() const
const ResidueKey & GetKey() const
Definition: residue_impl.hh:66
TorsionImplP FindTorsion(const String &torsion_name) const
Real GetAltAtomBFactor(const AtomImplPtr &atom, const String &group) const
void AddAltAtomPos(const String &group, const AtomImplPtr &atom, const geom::Vec3 &position, Real occ, Real b_factor)
const String & GetCurrentAltGroupName() const
int GetAtomCount() const
Get number of atoms of this residue.
geom::Vec3 GetCenterOfMass() const
String GetQualifiedName() const
Get fully qualified name of the residue, including chain name, residue name and number.
AtomImplPtr FindAtom(const String &aname) const
Find atom by name.
geom::Vec3 GetCentralNormal() const
void SetProtein(bool protein)
AtomImplPtr GetCentralAtom() const
void Apply(EntityVisitor &v)
ChemClass GetChemClass() const
TorsionImplList & GetTorsionList()
Get all torsions this residue is involved in.
const AtomImplList & GetAtomList() const
void SetChemClass(ChemClass cc)
Real GetAverageBFactor() const
retrieve average temperature factor of residue.
const TorsionImplList & GetTorsionList() const
void SetChemType(ChemType ct)
void DeleteAtoms(const String &atom_name)
int GetBondCount() const
Get number of bonds of this residue.
const ResNum & GetNumber() const
Definition: residue_impl.hh:63
AtomImplPtr InsertAtom(const String &name, const geom::Vec3 &pos, const String &ele)
AtomImplList & GetAtomList()
geom::Vec3 GetCenterOfAtoms() const
bool HasAltAtomGroup(const String &group) const
Test if residue has alternative atoms with a certain name.
const String & GetName() const
Get name of residue. At the moment an alias for GetKey.
Real GetFloatProperty(Prop::ID prop_id) const
float Real
Definition: base.hh:44
std::string String
Definition: base.hh:54
std::vector< TorsionImplP > TorsionImplList
boost::shared_ptr< AtomImpl > AtomImplPtr
Definition: atom_impl_fw.hh:33
boost::shared_ptr< TorsionImpl > TorsionImplP
std::vector< AtomImplPtr > AtomImplList
Definition: atom_impl_fw.hh:38
boost::shared_ptr< ChainImpl > ChainImplPtr
boost::weak_ptr< EntityImpl > EntityImplW
boost::weak_ptr< ChainImpl > ChainImplW
boost::shared_ptr< EntityImpl > EntityImplPtr
std::map< String, AtomGroup > AtomEntryGroups
Definition: atom_group.hh:48
String ResidueKey
Definition: base.dox:1
ID
Defined properties.
Definition: property_id.hh:41
Secondary structure types as defined by DSSP. For convenience, the enum values match the characters u...