OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Friends | Related Functions
EntityView Class Reference

#include <entity_view.hh>

Inherits EntityBase.

Public Member Functions

 EntityView ()
 EntityView (const EntityHandle &entity, ViewAddFlags flags=0)
Real GetMass () const
geom::Vec3 GetCenterOfMass () const
geom::Vec3 GetCenterOfAtoms () const
geom::AlignedCuboid GetBounds () const
EntityView Copy () const
ChainView AddChain (const ChainHandle &chain_handle, ViewAddFlags flags=0)
ChainView AddChain (const ChainView &chain_view, ViewAddFlags flags=0)
ResidueView AddResidue (const ResidueHandle &residue_handle, ViewAddFlags flags=0)
ResidueView AddResidue (const ResidueView &residue_view, ViewAddFlags flags=0)
AtomView AddAtom (const AtomHandle &atom_handle, ViewAddFlags flags=0)
AtomView AddAtom (const AtomView &atom_view, ViewAddFlags flags=0)
EntityView Select (const String &query_string, QueryFlags flags=0) const
EntityView Select (const Query &query, QueryFlags flags=0) const
bool AddBond (const BondHandle &bond_handle)
int GetAtomCount () const
int GetResidueCount () const
int GetChainCount () const
ChainView FindChain (const String &chain_name) const
ResidueView FindResidue (const ResidueHandle &residue) const
AtomView FindAtom (const AtomHandle &atom) const
AtomView FindAtom (const String &chain_name, const ResNum &num, const String &atom_name) const
ChainView FindChain (const ChainHandle &chain) const
bool IsChainIncluded (const ChainHandle &chain) const
void RemoveAtom (AtomView view)
void RemoveResidue (ResidueView view)
void RemoveChain (ChainView view)
void AddAllInclusiveBonds ()
const BondHandleListGetBondList () const
AtomViewList FindWithin (const geom::Vec3 &center, Real radius) const
int GetBondCount () const
const ChainViewListGetChainList () const
AtomViewIter AtomsBegin () const
AtomViewIter AtomsEnd () const
ResidueViewIter ResiduesBegin () const
ResidueViewIter ResiduesEnd () const
ResidueViewList GetResidueList () const
AtomViewList GetAtomList () const
void Apply (EntityVisitor &visitor)
void Apply (EntityViewVisitor &visitor)
EntityHandle GetHandle () const
std::pair< Real, RealGetMinMax (const String &prop, Prop::Level hint=Prop::UNSPECIFIED) const
Real GetAngle (const AtomHandle &a1, const AtomHandle &a2, const AtomHandle &a3) const
Real GetAngle (const AtomView &a1, const AtomView &a2, const AtomView &a3) const
EntityView ExtendViewToResidues () const
EntityView ExtendViewToSurrounding (Real gap) const
String Dump () const
EntityView CreateFullView () const
EntityView CreateEmptyView () const
void RemoveBond (const BondHandle &bond)
View validity
 operator bool () const
bool IsValid () const
Internal
 EntityView (const EntityViewDataPtr &data, const impl::EntityImplPtr impl)
const EntityViewDataPtrViewData () const
EntityViewDataPtrViewData ()
- Public Member Functions inherited from EntityBase
 EntityBase (const impl::EntityImplPtr &impl)
 EntityBase ()
const StringGetName () const
void SetName (const String &ent_name)
impl::EntityImplPtrImpl ()
const impl::EntityImplPtrImpl () const
- Public Member Functions inherited from GenericPropContainer< EntityBase >
void ClearProps ()
void SetStringProp (const String &key, const String &value)
void SetFloatProp (const String &key, Real value)
void SetIntProp (const String &key, int value)
void SetBoolProp (const String &key, bool value)
void RemoveProp (const String &key)
- Public Member Functions inherited from ConstGenericPropContainer< EntityBase >
bool HasProp (const String &key) const
String GetPropAsString (const String &key) const
String GetStringProp (const String &key) const
String GetStringProp (const String &key, const String &def) const
Real GetFloatProp (const String &key) const
Real GetFloatProp (const String &key, Real def) const
int GetIntProp (const String &key) const
int GetIntProp (const String &key, int def) const
bool GetBoolProp (const String &key) const
bool GetBoolProp (const String &key, bool def) const
std::map< String,
GenericPropValue
GetPropMap () const
std::vector< StringGetPropList () const

Protected Member Functions

void AddAtomInternal (const AtomView &av)
void RemoveAtomInternal (const AtomView &av)
- Protected Member Functions inherited from EntityBase
GenericPropContainerImplGpImpl ()
const GenericPropContainerImplGpImpl () const
void CheckValidity () const

Friends

class AtomView
class ResidueView

Related Functions

(Note that these are not member functions.)

EntityView DLLEXPORT_OST_MOL Union (const EntityView &ev1, const EntityView &ev2)
EntityView DLLEXPORT_OST_MOL Difference (const EntityView &ev1, const EntityView &ev2)
EntityView DLLEXPORT_OST_MOL Intersection (const EntityView &ev1, const EntityView &ev2)
EntityView DLLEXPORT_OST_MOL CreateViewFromAtomList (const AtomHandleList &atoms)
EntityView DLLEXPORT_OST_MOL CreateViewFromAtomList (const AtomViewList &atoms)

Detailed Description

definition of EntityView

Views

Views are very widely used as an input to algorithms and the link between graphical objects and entities.

Views point to the same data as their corresponding handle classes. When modifying and entity, such as applying a coordinate transform to the atoms, these changes will also be reflected in the views.

The entity - chain -residue - atom hierarchy of the entity handles is replicated in the views, the most important difference being that not all atoms, residues and chains present in the entity must be present in the view. One can think of the views as a selection.

Creating Views

Views can be assembled in several different ways: To create a full view containing all the atoms, residues, chains and bonds of the entity, use EntityHandle::CreateFullView(), an empty view containing basically nothing is created with EntityHandle::CreateEmptyView().

Elements can be added with EntitView::AddAtom(), EntityView::AddResidue(), EntityView::AddChain(). The behaviour of these methods is influenced by a combination of ViewAddFlag. Note that none of the add methods insert bonds. Bonds can be added with EntityView::AddAllInclusiveBonds() or manually with EntityView::AddBond(). The elements can be removed with EntityView::RemoveChain(), EntityView::RemoveResidue() and EntityView::RemoveAtom().

A very convenient way to create views is with so-called Query query statements. The queries are executed via EntityHandle::Select() and EntityView::Select().

Boolean Operations on Views

Two views can be combined by applying boolean operators such as Union(), Intersection() and Difference().

Definition at line 87 of file entity_view.hh.


Constructor & Destructor Documentation

EntityView ( const EntityHandle entity,
ViewAddFlags  flags = 0 
)
explicit

create new entity view from entity handle

Parameters:
entityThe handle the view is created from.
flagsAn ORed together list of ViewAddFlag
EntityView ( const EntityViewDataPtr data,
const impl::EntityImplPtr  impl 
)

construct entity view from data and entity impl


Member Function Documentation

void AddAllInclusiveBonds ( )

clear bonds and add all inclusive ones (ie where both atoms are present)

AtomView AddAtom ( const AtomHandle atom_handle,
ViewAddFlags  flags = 0 
)

Add atom to view.

If the atom's chain or residue have not been added to the view, they will be added

Parameters:
atom_handleis the atom to add
flagscan be a ORed together combination of ViewAddFlag
Returns:
The added atom view, or a reference to the existing atom view that points to the very same handle.
AtomView AddAtom ( const AtomView atom_view,
ViewAddFlags  flags = 0 
)
void AddAtomInternal ( const AtomView av)
protected
bool AddBond ( const BondHandle bond_handle)

Add a bond.

ChainView AddChain ( const ChainHandle chain_handle,
ViewAddFlags  flags = 0 
)

Add chain to view.

If ViewAddFlag::CHECK_DUPLICATES is set, the method will ensure that the handle is not already included in the view.

Parameters:
chain_handleThe chain handle to add
flagsCan be a ORed together combination of ViewAddFlag
Returns:
The added chain view, or a reference to the existing chain view that points to the very same handle.
ChainView AddChain ( const ChainView chain_view,
ViewAddFlags  flags = 0 
)

Add chain to view.

Same as AddChain(const ChainHandle&) but with the difference that only the residues or atoms included in the chain view are included when one of ViewAddFlag::INCLUDE_ATOMS or ViewAddFlag::INCLUDE_RESIDUES is set.

Parameters:
chain_viewthe handle that the view points to will be added to the view.
flagscan be a ORed together combination of ViewAddFlag
Returns:
The added chain view, or a reference to the existing chain view that points to the very same handle.
ResidueView AddResidue ( const ResidueHandle residue_handle,
ViewAddFlags  flags = 0 
)

Add residue to view.

If the residues's chain has not been added to the chain already, it will be added.

Parameters:
residue_handleis the residue to add
flagscan be a ORed together combination of ViewAddFlag
Returns:
The added residue view, or a reference to the existing residue view that points to the very same handle.
ResidueView AddResidue ( const ResidueView residue_view,
ViewAddFlags  flags = 0 
)

Add residue to view.

Same as AddReside(const ResidueHandle&, ViewAddFlags) but with the difference that only atoms included in the residue view are added when ViewAddFlag::INCLUDE_ATOMS is set.

See also:
AddResidue(const ResidueHandle&, ViewAddFlags)
void Apply ( EntityVisitor visitor)

Apply entity visitor to whole view.

void Apply ( EntityViewVisitor visitor)

Apply entity view visitor to whole view.

AtomViewIter AtomsBegin ( ) const

Get iterator pointing to the beginning of atoms.

AtomViewIter AtomsEnd ( ) const

Get iterator pointing to the end of atoms.

EntityView Copy ( ) const

create copy of view

The copy has the semantics of a deep copy.

EntityView CreateEmptyView ( ) const

create empty view

EntityView CreateFullView ( ) const

create a new full view

This is an alias of EntityView::Copy()

String Dump ( ) const

returns a string containing a human-readable summary of the entity view

EntityView ExtendViewToResidues ( ) const

Extend current view to include all atoms of each residue where at least one atom is selected currently.

EntityView ExtendViewToSurrounding ( Real  gap) const

Extend current view to include all atoms that are within the sum of their vdw radii + gap.

Include all atoms within: at1.GetRadius() + at2.GetRadius() + gap

AtomView FindAtom ( const AtomHandle atom) const

Find view for given atom handle.

AtomView FindAtom ( const String chain_name,
const ResNum num,
const String atom_name 
) const
ChainView FindChain ( const String chain_name) const

Find chain by name.

ChainView FindChain ( const ChainHandle chain) const

Find chain for given chain handle.

ResidueView FindResidue ( const ResidueHandle residue) const

Find atom for given residue handle.

AtomViewList FindWithin ( const geom::Vec3 center,
Real  radius 
) const

find atoms close to point

Real GetAngle ( const AtomHandle a1,
const AtomHandle a2,
const AtomHandle a3 
) const

Get angle in radians between bonds a1-a2 and a2-a3.

Real GetAngle ( const AtomView a1,
const AtomView a2,
const AtomView a3 
) const

Get angle in radians between bonds a1-a2 and a2-a3.

int GetAtomCount ( ) const

Get total number of atoms in this entity.

AtomViewList GetAtomList ( ) const

Get list of all atoms included in the view.

int GetBondCount ( ) const

Get number of bonds.

const BondHandleList& GetBondList ( ) const
geom::AlignedCuboid GetBounds ( ) const
geom::Vec3 GetCenterOfAtoms ( ) const

Get entity's center of atoms (not mass weighted)

Returns the center of all the atoms in an entity. This is similar to GetCenterOfMass(), but the atoms are not mass weighted

geom::Vec3 GetCenterOfMass ( ) const

Get entity's center of mass (mass weighted)

int GetChainCount ( ) const

Get number of chains in this entity.

const ChainViewList& GetChainList ( ) const
EntityHandle GetHandle ( ) const

Get handle this view points to.

Real GetMass ( ) const

Get entity's mass.

std::pair<Real,Real> GetMinMax ( const String prop,
Prop::Level  hint = Prop::UNSPECIFIED 
) const

Return the min/max pair for the given property.

int GetResidueCount ( ) const

Get total number of residues in this entity.

ResidueViewList GetResidueList ( ) const

Get list of all residues included in the view.

bool IsChainIncluded ( const ChainHandle chain) const

Check whether the view includes the given chain.

Returns:
True, if the chain is included in the view, false if not.
bool IsValid ( ) const
inline

check validity of handle

See also:
operator bool()

Reimplemented from EntityBase.

Definition at line 110 of file entity_view.hh.

operator bool ( ) const
inline

check validity of handle

check, whether the entity view points to a valid entity.

Note:
It is an error to use any method other than IsValid, Impl and operator bool() when the handle is invalid. An InvalidHandle exception will be thrown.

Reimplemented from EntityBase.

Definition at line 107 of file entity_view.hh.

void RemoveAtom ( AtomView  view)

remove atom from view

void RemoveAtomInternal ( const AtomView av)
protected
void RemoveBond ( const BondHandle bond)
void RemoveChain ( ChainView  view)

remove chain from view

void RemoveResidue ( ResidueView  view)

remove residue from view

ResidueViewIter ResiduesBegin ( ) const

Get iterator pointing to the beginnin of residues.

See also:
ResiduesEnd
ResidueViewIter ResiduesEnd ( ) const

get iterator pointing to the end of residues

See also:
ResiduesBegin
EntityView Select ( const String query_string,
QueryFlags  flags = 0 
) const

Select a structural subset of the entity view.

See also:
Query
EntityView Select ( const Query query,
QueryFlags  flags = 0 
) const

Select a structural subset of the entity view.

See also:
Query
const EntityViewDataPtr& ViewData ( ) const

Get entity view-specific data.

EntityViewDataPtr& ViewData ( )

Get entity view-specific data.


Friends And Related Function Documentation

friend class AtomView
friend

Definition at line 88 of file entity_view.hh.

EntityView DLLEXPORT_OST_MOL CreateViewFromAtomList ( const AtomHandleList atoms)
related

create view from atom list

Exceptions:
IntegrityErrorif atoms belonging to different entities are encountered
EntityView DLLEXPORT_OST_MOL CreateViewFromAtomList ( const AtomViewList atoms)
related

create view from atom list

Exceptions:
IntegrityErrorif atoms belonging to different entities are encountered
EntityView DLLEXPORT_OST_MOL Difference ( const EntityView ev1,
const EntityView ev2 
)
related

return difference between two entity views

a view containing elements in ev1 but not in ev2 is returned.

EntityView DLLEXPORT_OST_MOL Intersection ( const EntityView ev1,
const EntityView ev2 
)
related

return intersection of two entity views

a view containing elements in ev1 and ev2 is returned

friend class ResidueView
friend

Definition at line 89 of file entity_view.hh.

EntityView DLLEXPORT_OST_MOL Union ( const EntityView ev1,
const EntityView ev2 
)
related

return union of two entity views

a view containing elements that are either in ev1 or ev2 are included. no duplicates are generated.


The documentation for this class was generated from the following files: