OpenStructure
chain_view.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_CHAIN_VIEW_HH
20 #define OST_CHAIN_VIEW_HH
21 
22 #include <ost/mol/module_config.hh>
23 #include <ost/geom/geom.hh>
24 
25 #include <ost/mol/query.hh>
26 #include <ost/mol/chain_base.hh>
29 #include <ost/mol/view_type_fw.hh>
32 #include <ost/mol/residue_prop.hh>
33 
34 namespace ost { namespace mol {
35 
38 public:
40 
42  impl::ChainImplPtr impl);
43 
44  ChainView(const EntityView& entity,
45  const ChainHandle& chain);
46 public:
47 
49 
50  operator bool() const { return this->IsValid(); }
59  bool IsValid() const;
61 
64 
65  void Apply(EntityVisitor& visitor);
66  void Apply(EntityViewVisitor& visitor);
67 
69  int GetResidueCount() const;
70 
72  int GetAtomCount() const;
73 
80  int GetBondCount() const;
81 
82 public:
94  ResidueView AddResidue(const ResidueHandle& residue_handle,
95  ViewAddFlags flags=0);
96 
111  ResidueView AddResidue(const ResidueView& residue_view,
112  ViewAddFlags flags=0);
121  AtomView AddAtom(const AtomHandle& atom_handle,
122  ViewAddFlags flags=0);
123 
125  ResidueView FindResidue(const ResNum& number) const;
126 
129  AtomView FindAtom(const AtomHandle& atom) const;
130 
131  AtomView ViewForHandle(const AtomHandle& atom) const;
132  AtomView FindAtom(const ResNum& num, const String& name) const;
135 
136  ResidueView FindResidue(const ResidueHandle& handle) const;
138  bool IsResidueIncluded(const ResidueHandle& handle) const;
139 
142 
148 
151 
152  int GetResidueIndex(const ResNum& number) const;
153 
157  ResidueView GetResidueByIndex(int index) const;
158 
159 
161  Real GetMass() const;
162 
165 
171 
174 
178 
179  ChainViewDataPtr& ViewData() {
181  return data_;
182  }
183 
185  const ChainViewDataPtr& ViewData() const {
186  return data_;
187  }
190  bool InSequence() const;
191 
194  EntityView Select(const Query& q, QueryFlags flags=0) const;
195 
198  EntityView Select(const String& query_string, QueryFlags flags=0) const;
199 
204  unsigned long GetHashCode() const;
205 
206  bool operator==(const ChainView& rhs) const;
207  bool operator!=(const ChainView& rhs) const;
208  bool HasAtoms() const;
210 private:
211  ChainViewDataPtr data_;
212 };
213 
214 }} // ns
215 #endif // OST_CHAIN_VIEW_HH
216 
axis-aligned cuboid
Three dimensional vector class, using Real precision.
Definition: vec3.hh:48
Handle to atom datatype.
Definition: atom_handle.hh:37
definition of AtomView
Definition: atom_view.hh:34
base class for ChainHandle and ChainView
Definition: chain_base.hh:40
linear chain of residues
Definition: chain_handle.hh:52
definition of ChainView
Definition: chain_view.hh:37
ChainView(const EntityView &entity, const ChainHandle &chain)
EntityView Select(const Query &q, QueryFlags flags=0) const
return view based on a query object
void Apply(EntityViewVisitor &visitor)
bool IsResidueIncluded(const ResidueHandle &handle) const
Check whether the view includes the given residue.
EntityView GetEntity() const
Get parent entity view.
bool operator==(const ChainView &rhs) const
void RemoveResidue(ResidueView view)
remove given residue from the view
ChainHandle GetHandle() const
Get handle this view points to.
ResidueView FindResidue(const ResNum &number) const
Find residue by number
int GetResidueIndex(const ResNum &number) const
Real GetMass() const
Get entity's mass.
ResidueView AddResidue(const ResidueView &residue_view, ViewAddFlags flags=0)
Add residue to view.
void Apply(EntityVisitor &visitor)
AtomView FindAtom(const AtomHandle &atom) const
Find view for given atom handle Deprecated: Use ViewForHandle instead.
AtomView ViewForHandle(const AtomHandle &atom) const
geom::AlignedCuboid GetBounds() const
Get entity's axis aligned bounding box.
const ChainViewDataPtr & ViewData() const
Get view data.
Definition: chain_view.hh:185
AtomView AddAtom(const AtomHandle &atom_handle, ViewAddFlags flags=0)
Add atom to view.
ResidueView ViewForHandle(const ResidueHandle &handle) const
Find residue by residue handle.
int GetAtomCount() const
Get number of atoms in this chain view.
bool InSequence() const
whether the residues form an ordered sequence with respect to their residue numbers.
geom::Vec3 GetCenterOfMass() const
Get entity's center of mass (mass weighted)
bool HasAtoms() const
ResidueView GetResidueByIndex(int index) const
get residue by index
unsigned long GetHashCode() const
get unique id
ResidueView FindResidue(const ResidueHandle &handle) const
AtomView FindAtom(const ResNum &num, const String &name) const
const ResidueViewList & GetResidueList() const
Get residues of this chain view.
ResidueView AddResidue(const ResidueHandle &residue_handle, ViewAddFlags flags=0)
Add residue to view.
bool IsValid() const
check validity of handle
int GetBondCount() const
Get number of all inclusive bonds of this chain.
int GetResidueCount() const
Get number of residues in this chain view.
geom::Vec3 GetCenterOfAtoms() const
Get entity's center of atoms (not mass weighted)
void RemoveResidues()
///
EntityView Select(const String &query_string, QueryFlags flags=0) const
return view based on query String.
ChainView(ChainViewDataPtr data, impl::ChainImplPtr impl)
bool operator!=(const ChainView &rhs) const
definition of EntityView
Definition: entity_view.hh:86
EntityViewVisitor interface.
EntityVisitor interface.
Selection Query.
Definition: query.hh:74
float Real
Definition: base.hh:44
std::string String
Definition: base.hh:54
#define DLLEXPORT_OST_MOL
boost::shared_ptr< ChainImpl > ChainImplPtr
uint QueryFlags
Definition: query.hh:69
boost::shared_ptr< ChainViewData > ChainViewDataPtr
Definition: view_type_fw.hh:40
int ViewAddFlags
Definition: view_type_fw.hh:71
std::vector< ResidueView > ResidueViewList
Definition: view_type_fw.hh:37
Definition: base.dox:1