OpenStructure
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-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_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 
95 
97  const ResNum& num);
98 
113 
114  ResidueHandle AppendResidue(ChainHandle chain, ResidueHandle residue, bool deep=false);
115 
132  const ResNum& num,
133  const ResidueKey& k);
134 
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 
176 
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 
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 
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 
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
Three dimensional vector class, using Real precision.
Definition: vec3.hh:48
Handle to atom datatype.
Definition: atom_handle.hh:37
chemical bond
Definition: bond_handle.hh:35
linear chain of residues
Definition: chain_handle.hh:52
base class for entity editors
Definition: editor_base.hh:46
void RenumberChain(const ChainHandle &chain, int start, bool keep_spacing)
renumber residues of one chain
ResidueHandle InsertResidueBefore(ChainHandle chain, int index, const ResNum &num, const ResidueKey &k)
void Prune()
Removes all residues and chains in the attached entity that don't contain any atoms.
void DeleteBonds(const BondHandleList &bonds)
AtomHandle InsertAltAtom(ResidueHandle residue, const String &name, const String &alt_group, const geom::Vec3 &pos, const String &ele="", Real occ=1.0, Real b_factor=0.0)
Insert new atom with alternative position indicator.
void RenumberChain(ChainHandle chain, const ResNumList &new_numbers)
void RenumberAllResidues(int start, bool keep_spacing)
renumber residues of all chains
ChainHandle InsertChain(const String &chain_name, ChainHandle chain, bool deep=false)
create new chain
TorsionHandle AddTorsion(const String &name, const AtomHandle &a1, const AtomHandle &a2, const AtomHandle &a3, const AtomHandle &a4)
Add named torsion to entity.
void RenameResidue(ResidueHandle res, const String &new_name)
ResidueHandle InsertResidueAfter(ChainHandle chain, int index, const ResNum &num, const ResidueKey &k)
insert residue into chain
void DeleteResidue(const ResidueHandle &residue_handle)
Delete residue.
BondHandle Connect(const AtomHandle &first, const AtomHandle &second, Real len, Real theta, Real phi)
void DeleteChain(const ChainHandle &chain)
delete chain
AtomHandle InsertAltAtom(ResidueHandle residue, AtomHandle atom, const String &alt_group)
Insert new atom with alternative position indicator.
EntityHandle GetEntity() const
\ brief return entity this editor works on
Definition: editor_base.hh:327
ResidueHandle AppendResidue(ChainHandle chain, ResidueHandle residue, bool deep=false)
void SetChainType(ChainHandle chain, const ChainType type)
Assign type of chain according to ChainType.
AtomHandle InsertAtom(ResidueHandle residue, AtomHandle atom)
Insert new atom.
void DeleteAllAtoms(ResidueHandle res)
Delete all atoms of residue.
void DeleteAtom(const AtomHandle &atom)
Delete specific atom from this residue.
BondHandle Connect(const AtomHandle &first, const AtomHandle &second)
connect two atoms with bond
BondHandle Connect(const AtomHandle &first, const AtomHandle &second, unsigned char bond_order)
void SetChainDescription(ChainHandle chain, const String desc)
Assign a description to a chain.
void ReorderAllResidues()
reorder residues of all chains based on their residue number
void SetResidueNumber(ResidueHandle res, const ResNum &num)
BondHandle Connect(const AtomHandle &first, const AtomHandle &second, Real len, Real theta, Real phi, unsigned char bond_order)
EditMode GetMode() const
Get edit mode of editor.
Definition: editor_base.hh:324
void ReorderResidues(const ChainHandle &chain)
reorder residues of given chain based on their residue number
void RenameAtom(AtomHandle atom, const String &new_name)
change the name of the atom to the new name
void AddAltAtomPos(const String &group, const AtomHandle &atom, const geom::Vec3 &position, Real occ=1.0, Real b_factor=0.0)
Add alternative atom position.
ChainHandle InsertChain(const String &chain_name)
create new chain
void DeleteBond(const BondHandle &bond)
void DeleteAtoms(const AtomHandleList &atoms)
ResidueHandle AppendResidue(ChainHandle chain, const ResidueKey &k, const ResNum &num)
ResidueHandle AppendResidue(ChainHandle chain, const ResidueKey &k)
void RenameChain(ChainHandle chain, const String &new_name)
EditorBase(const EntityHandle &ent, EditMode mode)
Protein or molecule.
Named torsion (dihedral) angle.
float Real
Definition: base.hh:44
std::string String
Definition: base.hh:54
#define DLLEXPORT_OST_MOL
std::vector< AtomHandle > AtomHandleList
std::vector< ResNum > ResNumList
std::vector< BondHandle > BondHandleList
String ResidueKey
Definition: base.dox:1