OpenStructure
chain_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_CHAIN_IMPL_HH
20 #define OST_CHAIN_IMPL_HH
21 
22 #include <boost/enable_shared_from_this.hpp>
23 
24 #include <ost/mol/module_config.hh>
25 #include <ost/geom/geom.hh>
26 
27 #include <ost/mol/residue_prop.hh>
33 
34 #include <ost/generic_property.hh>
35 
36 #include <ost/mol/sec_structure.hh>
37 
38 namespace ost { namespace mol {namespace impl {
39 
42  public boost::enable_shared_from_this<ChainImpl>
43 {
44 public:
45  ChainImpl(const EntityImplPtr& e, const String& name);
46 
47  void SetName(const String& new_name);
48  String GetName() const;
49 
53 
54  ResidueImplPtr InsertResidueBefore(int index, const ResNum& n,
55  const ResidueKey& k);
56  ResidueImplPtr InsertResidueAfter(int index, const ResNum& n,
57  const ResidueKey& k);
63 
65  ResidueImplPtr AppendResidue(const ResidueKey& k, const ResNum& n);
66 
67  // next residue, not necessarily in sequence
68  ResidueImplPtr GetPrev(const ResidueImplPtr& r) const;
69 
71  ResidueImplPtr GetNext(const ResidueImplPtr& r) const;
72 
73  const ResidueImplList& GetResidueList() const;
75  bool InSequence() const;
76 
78  return residue_list_;
79  }
80 
81  Real GetMass() const;
84 
87 
88 
91  ResidueImplPtr FindResidue(const ResNum& number) const;
92 
93  AtomImplPtr FindAtom(const ResNum& number,
94  const String& atom_name) const;
95 
97  int GetResidueCount() const;
98 
100  int GetAtomCount() const;
101 
103  int GetBondCount() const;
104 
105  void Apply(EntityVisitor& v);
106 
107  EntityImplPtr GetEntity() const;
108 
109  void DeleteResidue(const ResNum& number);
110 
111  void DeleteResidue(const ResidueImplPtr& residue);
112 
113  void DeleteAllResidues();
114 
115  void ReorderResidues();
116 
117  int GetIndex(const ResidueImplPtr& res) const;
119  const ResNum& start,
120  const ResNum& end);
121  int GetIndexForResNum(const ResNum& number) const;
122 
123 private:
124  int GetIndexForResNumInSequence(const ResNum& number) const;
125  void UpdateShifts();
126  typedef struct {
127  int start;
128  int shift;
129  } Shift;
130  std::list<Shift> shifts_;
131  EntityImplW ent_;
132  String name_;
133  ResidueImplList residue_list_;
136  bool in_sequence_;
137 };
138 
139 }}} // ns
140 
141 #endif
142