OpenStructure
Public 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)
 
View validity
 operator bool () const
 
bool IsValid () const
 
Real GetMass () const
 
geom::Vec3 GetCenterOfMass () const
 
geom::Vec3 GetCenterOfAtoms () const
 
geom::AlignedCuboid GetBounds () const
 
- Public Member Functions inherited from EntityBase
 EntityBase (const impl::EntityImplPtr &impl)
 
 EntityBase ()
 
const StringGetName () const
 
void SetName (const String &ent_name)
 
 operator bool () const
 
bool IsValid () const
 
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 SetVec3Prop (const String &key, geom::Vec3 value)
 
void RemoveProp (const String &key)
 
- Public Member Functions inherited from ConstGenericPropContainer< H >
bool HasProp (const String &key) const
 
String GetPropAsString (const String &key) const
 
String GetStringProp (const String &key) const
 
Real GetFloatProp (const String &key) const
 
int GetIntProp (const String &key) const
 
bool GetBoolProp (const String &key) const
 
geom::Vec3 GetVec3Prop (const String &key) const
 
String GetStringProp (const String &key, const String &def) const
 
Real GetFloatProp (const String &key, Real def) const
 
int GetIntProp (const String &key, int def) const
 
bool GetBoolProp (const String &key, bool def) const
 
std::map< String, GenericPropValueGetPropMap () const
 
std::vector< StringGetPropList () 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)
 

Internal

 EntityView (const EntityViewDataPtr &data, const impl::EntityImplPtr impl)
 
const EntityViewDataPtrViewData () const
 
EntityViewDataPtrViewData ()
 
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
 
ResidueView FindResidue (const String &chain, const ResNum &num) const
 
ResidueView ViewForHandle (const ResidueHandle &residue) const
 
AtomView FindAtom (const AtomHandle &atom) const
 
AtomView ViewForHandle (const AtomHandle &atom) const
 
AtomView FindAtom (const String &chain_name, const ResNum &num, const String &atom_name) const
 
ChainView FindChain (const ChainHandle &chain) const
 
ChainView ViewForHandle (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
 
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
 
bool HasAtoms () const
 
void RemoveBond (const BondHandle &bond)
 
void AddAtomInternal (const AtomView &av)
 
void RemoveAtomInternal (const AtomView &av)
 

Additional Inherited Members

- Protected Member Functions inherited from EntityBase
GenericPropContainerImplGpImpl ()
 
const GenericPropContainerImplGpImpl () const
 
void CheckValidity () const
 
- Protected Member Functions inherited from ConstGenericPropContainer< H >
template<typename T >
gp_get (const String &key) const
 
template<typename T >
gp_get (const String &key, const T &def) const
 
GenericPropContainerImplGetImpl ()
 
const GenericPropContainerImplGetImpl () const
 

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 86 of file entity_view.hh.

Constructor & Destructor Documentation

◆ EntityView() [1/3]

◆ EntityView() [2/3]

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() [3/3]

EntityView ( const EntityViewDataPtr data,
const impl::EntityImplPtr  impl 
)

construct entity view from data and entity impl

Member Function Documentation

◆ AddAllInclusiveBonds()

void AddAllInclusiveBonds ( )

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

◆ AddAtom() [1/2]

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.

◆ AddAtom() [2/2]

AtomView AddAtom ( const AtomView atom_view,
ViewAddFlags  flags = 0 
)

◆ AddAtomInternal()

void AddAtomInternal ( const AtomView av)
protected

◆ AddBond()

bool AddBond ( const BondHandle bond_handle)

Add a bond.

◆ AddChain() [1/2]

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.

◆ AddChain() [2/2]

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.

◆ AddResidue() [1/2]

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.

◆ AddResidue() [2/2]

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)

◆ Apply() [1/2]

void Apply ( EntityViewVisitor visitor)

Apply entity view visitor to whole view.

◆ Apply() [2/2]

void Apply ( EntityVisitor visitor)

Apply entity visitor to whole view.

◆ Copy()

EntityView Copy ( ) const

create copy of view

The copy has the semantics of a deep copy.

◆ CreateEmptyView()

EntityView CreateEmptyView ( ) const

create empty view

◆ CreateFullView()

EntityView CreateFullView ( ) const

create a new full view

This is an alias of EntityView::Copy()

◆ Dump()

String Dump ( ) const

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

◆ ExtendViewToResidues()

EntityView ExtendViewToResidues ( ) const

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

◆ ExtendViewToSurrounding()

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

◆ FindAtom() [1/2]

AtomView FindAtom ( const AtomHandle atom) const

Find view for given atom handle.

deprecated. Use ViewForHandle instead

◆ FindAtom() [2/2]

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

locate atom view for given atom handle

returns an invalid AtomView if the residue could not be located in the structure

◆ FindChain() [1/2]

ChainView FindChain ( const ChainHandle chain) const

Find chain for given chain handle.

deprecated: Use ViewForHandle instead

◆ FindChain() [2/2]

ChainView FindChain ( const String chain_name) const

Find chain by name.

◆ FindResidue() [1/2]

ResidueView FindResidue ( const ResidueHandle residue) const

Find atom for given residue handle.

deprecated. Use ViewForHandle instead

◆ FindResidue() [2/2]

ResidueView FindResidue ( const String chain,
const ResNum num 
) const

◆ FindWithin()

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

find atoms close to point

◆ GetAngle() [1/2]

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

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

◆ GetAngle() [2/2]

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

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

◆ GetAtomCount()

int GetAtomCount ( ) const

Get total number of atoms in this entity.

◆ GetAtomList()

AtomViewList GetAtomList ( ) const

Get list of all atoms included in the view.

◆ GetBondCount()

int GetBondCount ( ) const

Get number of bonds.

◆ GetBondList()

const BondHandleList& GetBondList ( ) const

◆ GetBounds()

geom::AlignedCuboid GetBounds ( ) const

◆ GetCenterOfAtoms()

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

◆ GetCenterOfMass()

geom::Vec3 GetCenterOfMass ( ) const

Get entity's center of mass (mass weighted)

◆ GetChainCount()

int GetChainCount ( ) const

Get number of chains in this entity.

◆ GetChainList()

const ChainViewList& GetChainList ( ) const

◆ GetHandle()

EntityHandle GetHandle ( ) const

Get handle this view points to.

◆ GetMass()

Real GetMass ( ) const

Get entity's mass.

◆ GetMinMax()

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

Return the min/max pair for the given property.

◆ GetResidueCount()

int GetResidueCount ( ) const

Get total number of residues in this entity.

◆ GetResidueList()

ResidueViewList GetResidueList ( ) const

Get list of all residues included in the view.

◆ HasAtoms()

bool HasAtoms ( ) const

true if view contains at least one atom

◆ IsChainIncluded()

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.

◆ IsValid()

bool IsValid ( ) const
inline

check validity of handle

See also
operator bool()

Definition at line 109 of file entity_view.hh.

◆ operator bool()

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.

Definition at line 106 of file entity_view.hh.

◆ RemoveAtom()

void RemoveAtom ( AtomView  view)

remove atom from view

◆ RemoveAtomInternal()

void RemoveAtomInternal ( const AtomView av)
protected

◆ RemoveBond()

void RemoveBond ( const BondHandle bond)

◆ RemoveChain()

void RemoveChain ( ChainView  view)

remove chain from view

◆ RemoveResidue()

void RemoveResidue ( ResidueView  view)

remove residue from view

◆ Select() [1/2]

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

Select a structural subset of the entity view.

See also
Query

◆ Select() [2/2]

EntityView Select ( const String query_string,
QueryFlags  flags = 0 
) const

Select a structural subset of the entity view.

See also
Query

◆ ViewData() [1/2]

EntityViewDataPtr& ViewData ( )

Get entity view-specific data.

◆ ViewData() [2/2]

const EntityViewDataPtr& ViewData ( ) const

Get entity view-specific data.

◆ ViewForHandle() [1/3]

AtomView ViewForHandle ( const AtomHandle atom) const

◆ ViewForHandle() [2/3]

ChainView ViewForHandle ( const ChainHandle chain) const

locate chain view for given chain handle

returns an invalid AtomView if the residue could not be located in the structure

◆ ViewForHandle() [3/3]

ResidueView ViewForHandle ( const ResidueHandle residue) const

locate residue view for given residue handle

returns an invalid ResidueView if the residue could not be located in the structure

Friends And Related Function Documentation

◆ AtomView

friend class AtomView
friend

Definition at line 87 of file entity_view.hh.

◆ CreateViewFromAtomList() [1/2]

EntityView DLLEXPORT_OST_MOL CreateViewFromAtomList ( const AtomHandleList atoms)
related

create view from atom list

Exceptions
IntegrityErrorif atoms belonging to different entities are encountered

◆ CreateViewFromAtomList() [2/2]

EntityView DLLEXPORT_OST_MOL CreateViewFromAtomList ( const AtomViewList atoms)
related

create view from atom list

Exceptions
IntegrityErrorif atoms belonging to different entities are encountered

◆ Difference()

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.

◆ Intersection()

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

◆ ResidueView

friend class ResidueView
friend

Definition at line 88 of file entity_view.hh.

◆ Union()

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: