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 
147 
148 
149 
150 
151 
152 
153 
154 
155 
156  AtomHandle InsertAtom(ResidueHandle residue, const String& name,
157  const geom::Vec3& pos, const String& ele="",
158  Real occupancy=1.0, Real b_factor=0.0,
159  bool is_hetatm=false);
160 
170 
171  AtomHandle InsertAtom(ResidueHandle residue, AtomHandle atom);
172 
175  AtomHandle InsertAltAtom(ResidueHandle residue, const String& name,
176  const String& alt_group, const geom::Vec3& pos,
177  const String& ele="", Real occ=1.0,
178  Real b_factor=0.0);
179 
183 
184  AtomHandle InsertAltAtom(ResidueHandle residue, AtomHandle atom,
185  const String& alt_group);
186 
187 
198  void AddAltAtomPos(const String& group, const AtomHandle& atom,
199  const geom::Vec3& position, Real occ=1.0,
200  Real b_factor=0.0);
201  //\}
202 
207  BondHandle Connect(const AtomHandle& first, const AtomHandle& second);
208  BondHandle Connect(const AtomHandle& first, const AtomHandle& second,
209  unsigned char bond_order);
210  BondHandle Connect(const AtomHandle& first, const AtomHandle& second,
211  Real len, Real theta, Real phi);
212  BondHandle Connect(const AtomHandle& first, const AtomHandle& second,
213  Real len, Real theta, Real phi,
214  unsigned char bond_order);
215 
216  void RenameResidue(ResidueHandle res, const String& new_name);
217 
218  void SetResidueNumber(ResidueHandle res, const ResNum& num);
219 
220  void RenameChain(ChainHandle chain, const String& new_name);
221 
226  void SetChainType(ChainHandle chain, const ChainType type);
227 
232  void SetChainDescription(ChainHandle chain, const String desc);
233 
237  void DeleteAllAtoms(ResidueHandle res);
238 
246  void DeleteAtom(const AtomHandle& atom);
247 
249  TorsionHandle AddTorsion(const String& name, const AtomHandle& a1,
250  const AtomHandle& a2, const AtomHandle& a3,
251  const AtomHandle& a4);
255  void DeleteChain(const ChainHandle& chain);
256 
262  void DeleteResidue(const ResidueHandle& residue_handle);
263 
265  void ReorderResidues(const ChainHandle& chain);
266 
268  void ReorderAllResidues();
269 
279  void RenumberAllResidues(int start, bool keep_spacing);
280 
281 
282 
296  void RenumberChain(const ChainHandle& chain, int start, bool keep_spacing);
297 
299  EditMode GetMode() const {return mode_;}
300 
302  EntityHandle GetEntity() const {return ent_;}
303 
305  void RenameAtom(AtomHandle atom, const String& new_name);
306 protected:
307  EditorBase(const EntityHandle& ent, EditMode mode);
308  void UpdateTrace();
311 };
312 
313 }} //ns
314 
315 #endif