OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
editor_base.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_EDITOR_BASE_HS
20 #define OST_EDITOR_BASE_HS
21 /*
22  Author: Marco Biasini
23  */
24 
25 #include <ost/mol/module_config.hh>
26 
27 #include <ost/geom/geom.hh>
28 
29 #include "entity_handle.hh"
30 #include "residue_prop.hh"
31 #include "editor_type_fw.hh"
32 
33 namespace ost { namespace mol {
34 
47 public:
58  ChainHandle InsertChain(const String& chain_name);
59 
77  ChainHandle InsertChain(const String& chain_name, ChainHandle chain, bool deep=false);
78 
94  ResidueHandle AppendResidue(ChainHandle chain, const ResidueKey& k);
95 
96  ResidueHandle AppendResidue(ChainHandle chain, const ResidueKey& k,
97  const ResNum& num);
98 
113 
114  ResidueHandle AppendResidue(ChainHandle chain, ResidueHandle residue, bool deep=false);
115 
131  ResidueHandle InsertResidueBefore(ChainHandle chain, int index,
132  const ResNum& num,
133  const ResidueKey& k);
134 
140  ResidueHandle InsertResidueAfter(ChainHandle chain, int index,
141  const ResNum& num,
142  const ResidueKey& k);
143 
145 
146  AtomHandle InsertAtom(ResidueHandle residue, const String& name,
161  const geom::Vec3& pos, const String& ele="",
162  Real occupancy=1.0, Real b_factor=0.0,
163  bool is_hetatm=false);
164 
174 
175  AtomHandle InsertAtom(ResidueHandle residue, AtomHandle atom);
176 
179  AtomHandle InsertAltAtom(ResidueHandle residue, const String& name,
180  const String& alt_group, const geom::Vec3& pos,
181  const String& ele="", Real occ=1.0,
182  Real b_factor=0.0);
183 
187 
188  AtomHandle InsertAltAtom(ResidueHandle residue, AtomHandle atom,
189  const String& alt_group);
190 
191 
204  void AddAltAtomPos(const String& group, const AtomHandle& atom,
205  const geom::Vec3& position, Real occ=1.0,
206  Real b_factor=0.0);
207  //\}
208 
213  BondHandle Connect(const AtomHandle& first, const AtomHandle& second);
214  BondHandle Connect(const AtomHandle& first, const AtomHandle& second,
215  unsigned char bond_order);
216  BondHandle Connect(const AtomHandle& first, const AtomHandle& second,
217  Real len, Real theta, Real phi);
218  BondHandle Connect(const AtomHandle& first, const AtomHandle& second,
219  Real len, Real theta, Real phi,
220  unsigned char bond_order);
221 
222  void RenameResidue(ResidueHandle res, const String& new_name);
223 
224  void SetResidueNumber(ResidueHandle res, const ResNum& num);
225 
226  void RenameChain(ChainHandle chain, const String& new_name);
227 
232  void SetChainType(ChainHandle chain, const ChainType type);
233 
238  void SetChainDescription(ChainHandle chain, const String desc);
239 
243  void DeleteAllAtoms(ResidueHandle res);
244 
252  void DeleteAtom(const AtomHandle& atom);
256  void DeleteAtoms(const AtomHandleList& atoms);
257 
263  void DeleteBond(const BondHandle& bond);
264 
270  void DeleteBonds(const BondHandleList& bonds);
271 
273  TorsionHandle AddTorsion(const String& name, const AtomHandle& a1,
274  const AtomHandle& a2, const AtomHandle& a3,
275  const AtomHandle& a4);
279  void DeleteChain(const ChainHandle& chain);
280 
286  void DeleteResidue(const ResidueHandle& residue_handle);
287 
289  void ReorderResidues(const ChainHandle& chain);
290 
292  void ReorderAllResidues();
293 
303  void RenumberAllResidues(int start, bool keep_spacing);
304 
305 
306  void RenumberChain(ChainHandle chain, const ResNumList& new_numbers);
307 
321  void RenumberChain(const ChainHandle& chain, int start, bool keep_spacing);
322 
324  EditMode GetMode() const {return mode_;}
325 
327  EntityHandle GetEntity() const {return ent_;}
328 
330  void RenameAtom(AtomHandle atom, const String& new_name);
331 
334  void Prune();
335 
336 protected:
337  EditorBase(const EntityHandle& ent, EditMode mode);
338  void UpdateTrace();
341 };
342 
343 }} //ns
344 
345 #endif
String ResidueKey
std::string String
Definition: base.hh:54
Handle to atom datatype.
Definition: atom_handle.hh:37
float Real
Definition: base.hh:44
Protein or molecule.
std::vector< ResNum > ResNumList
EditMode GetMode() const
Get edit mode of editor.
Definition: editor_base.hh:324
linear chain of residues
Definition: chain_handle.hh:52
Three dimensional vector class, using Real precision.
Definition: vec3.hh:42
#define DLLEXPORT_OST_MOL
Named torsion (dihedral) angle.
std::vector< BondHandle > BondHandleList
chemical bond
Definition: bond_handle.hh:34
std::vector< AtomHandle > AtomHandleList
EntityHandle GetEntity() const
\ brief return entity this editor works on
Definition: editor_base.hh:327
base class for entity editors
Definition: editor_base.hh:46