PChain Class Reference

#include <PChain.h>

Inheritance diagram for PChain:

PLightChain PProtein List of all members.

Detailed Description

Encapsulates a linearly connected chain of residues. Methods are provided to add and access residues and check for collisions within the chain. This class makes no assumptions on the structure of the residues and atoms within. Use PProtein for extended functionality if building chains using the configuration data provided with LoopTK.

Usage of a PChain must follow the following sequence of steps:

  1. Construction - all residues are added to chain. Use the PChain::AddResidue() methods to do this.
  2. Finalization - finishes construction of the chain and prepares it for manipulation. Use PChain::finalize() to do this.
  3. Analysis - the full range of functionality of PChain can be used at this point. However, no more residues can be added.


Public Member Functions

 PChain ()
 PChain (const string &firstResidueName)
 PChain (const string &firstResidueName, PResidueSpec &firstResidueSpec)
 PChain (PChain *protein, int resStartIndex, int resEndIndex)
 ~PChain ()
void Obliterate ()
PResidueAddResidue (const string &resName)
PResidueAddResidue (const string &resName, PResidueSpec &resSpec)
bool IsSubChainOf (const PChain *other) const
PChaingetParent () const
PChaingetTopLevelChain ()
PBondgetBond (int res_index, const string &id1, const string &id2)
PBondgetBond (int res_index1, const string &id1, int res_index2, const string &id2)
int size () const
PResiduegetResidue (int localIndex)
int getResidueIndex (const PAtom *atom)
PAtomgetAtomAtRes (const string &atomID, int resNum)
void setAtomColorAtRes (const string &atomID, int resNum, GLColor setColor)
void revertAtomColorAtRes (const string &atomID, int resNum)
PAtomgetAtom (const string &blockType, int index)
Vector3 getAtomPos (const string &blockType, int index)
int NumAtoms (const string &blockType) const
bool InStaticCollision ()
bool InStaticCollision (int resIndex1, int resIndex2)
bool InSelfCollision ()
bool InSelfCollision (int resIndex1, int resIndex2)
bool InAnyCollision ()
bool InAnyCollision (int resIndex1, int resIndex2)
pair< PAtom *, PAtom * > FindStaticCollision ()
pair< PAtom *, PAtom * > FindStaticCollision (int resIndex1, int resIndex2)
pair< PAtom *, PAtom * > FindSelfCollision ()
pair< PAtom *, PAtom * > FindSelfCollision (int resIndex1, int resIndex2)
pair< PAtom *, PAtom * > FindAnyCollision ()
pair< PAtom *, PAtom * > FindAnyCollision (int resIndex1, int resIndex2)
AtomCollisionsgetAllCollidingStatic ()
AtomCollisionsgetAllCollidingStatic (int resIndex1, int resIndex2)
AtomCollisionsgetAllCollidingSelf ()
AtomCollisionsgetAllCollidingSelf (int resIndex1, int resIndex2)
AtomCollisionsgetAllCollidingEither ()
AtomCollisionsgetAllCollidingEither (int resIndex1, int resIndex2)
vector< PBond * > & GetDOFs (const string &blockType)
int NumDOF (const string &blockType) const
void RotateChain (const string &blockType, int DOFindex, BondDirection dir, float degrees)
void RotateChain (const ChainMove &move)
void MultiRotate (vector< ChainMove > &moves)
void AntiMultiRotate (vector< ChainMove > &moves)
vector< string > GetBlockTypes () const
void DetachBlocks (const string &blockType, const string &blockTypeToDetachFrom)
void DetachBlocks (const string &blockType, const string &blockTypeToDetachFrom, int resStartIndex, int resEndIndex)
void ReattachBlocks (const string &blockType)
void ReattachBlocks (const string &blockType, int resStartIndex, int resEndIndex)
void ReattachAllBlocks ()
void ReattachAllBlocks (int resStartIndex, int resEndIndex)
void RandomizeDOFs (BondDirection dir)
void finalize ()
void AddRotateEventHandler (PRotateEventHandler *handler)
void RemoveRotateEventHandler (PRotateEventHandler *handler)
void traverseFromStart (AtomFunctor *atomFn)
void traverseFromStart (BondFunctor *bondFn)
void traverseFromStart (AtomFunctor *atomFn, BondFunctor *bondFn)
pair< int, int > getTopLevelIndices () const
const PSpaceManagergetSpaceManager ()
PChainClone ()
int getResidueLocalIndex (PResidue *res)
int getResidueGlobalIndex (PResidue *res)
vector< const PAtom * > getShortestPath (const PAtom *a1, ConstAtomSet a2Set, int maxLength)
vector< const PAtom * > getShortestPath (const PAtom *a1, const PAtom *a2, int maxLength)
vector< const PAtom * > getShortestPath (const PAtom *a1, ConstAtomSet a2Set, int maxLength, int extendNum)
void inactivateResidue (int Rid1, int Rid2)
void activateResidue (int Rid1, int Rid2)

Protected Member Functions

void CloneResiduesIntoChain (PChain *other)
virtual PResidueCreateResidue (const string &name)
virtual PResidueCreateResidue (const string &name, PResidueSpec &spec)
virtual PResidueCreateResidue (const string &name, PResidue *res)
virtual PResidueCreateResidue (const string &name, PResidueSpec &spec, PResidue *res)

Friends

class PAtom


Constructor & Destructor Documentation

PChain::PChain (  ) 

Constructs a new PChain with no residues.

PChain::PChain ( const string &  firstResidueName  ) 

Constructs a new PChain with one residue, using the default positions for its atoms.

PChain::PChain ( const string &  firstResidueName,
PResidueSpec firstResidueSpec 
)

Constructs a new PChain with one residue (firstResidueName), using the positions specified by firstResidueSpec for its atoms.

PChain::PChain ( PChain protein,
int  resStartIndex,
int  resEndIndex 
)

Constructs a new PChain as a subchain of protein, from residue resStartIndex to residue resEndIndex.

PChain::~PChain (  ) 

Destroys this PChain and its subchains, freeing any memory associated with them.


Member Function Documentation

void PChain::Obliterate (  ) 

Obliterates this chain and all parents, brethren, and children, freeing all memory associated with them.

PResidue * PChain::AddResidue ( const string &  resName  ) 

Adds the residue resName to the end of the chain, using its default atom positions. Returns the created residue.

PResidue * PChain::AddResidue ( const string &  resName,
PResidueSpec resSpec 
)

Adds the specified residue to the end of the chain, using the specified atom positions. Returns the created residue.

bool PChain::IsSubChainOf ( const PChain other  )  const

Returns true if this PChain is a subchain of other, false otherwise.

PChain * PChain::getParent (  )  const

Gets parent chain. Returns NULL if this is the top level chain.

PChain * PChain::getTopLevelChain (  ) 

Gets top level chain (the one for which parent == NULL).

PBond * PChain::getBond ( int  res_index,
const string &  id1,
const string &  id2 
)

Returns the bond between atoms id1 and id2, assuming both are in residue res_index.

Returns NULL if the bond cannot be found.

PBond * PChain::getBond ( int  res_index1,
const string &  id1,
int  res_index2,
const string &  id2 
)

Returns the bond between two atoms in different residues: the first has ID id1 in residue res_index1, the second has ID id2 in residue res_index2.

Returns NULL if the bond cannot be found.

int PChain::size (  )  const [virtual]

Returns the number of residues in this PChain.

Implements PLightChain.

PResidue * PChain::getResidue ( int  localIndex  )  [virtual]

Returns the residue at the specified index. The index is "local" to this PChain; for example, if this chain is a subchain of some other chain, accessing residue 0 in this chain might return the 20th residue in the parent chain.

Implements PLightChain.

Reimplemented in PProtein.

int PChain::getResidueIndex ( const PAtom atom  ) 

Returns the residue index of the specified atom.

PAtom * PChain::getAtomAtRes ( const string &  atomID,
int  resNum 
) [virtual]

Convenience method: returns the atom with the specified ID in the specified residue, or NULL if such an atom does not exist.

Implements PLightChain.

void PChain::setAtomColorAtRes ( const string &  atomID,
int  resNum,
GLColor  setColor 
) [inline, virtual]

Sets color of the atom (displayed by PChainNavigator) whose ID is atomID in residue resNum.

Implements PLightChain.

void PChain::revertAtomColorAtRes ( const string &  atomID,
int  resNum 
) [inline, virtual]

Reverts the color of the atom whose ID is atomID, in residue resNum, to its default value.

Implements PLightChain.

PAtom * PChain::getAtom ( const string &  blockType,
int  index 
)

Retrieves the atom at the given index for the block type (indices are in order of how the chain would be traversed from beginning to end).

Vector3 PChain::getAtomPos ( const string &  blockType,
int  index 
)

Gets the atom position at the given index (see PChain::getAtom).

int PChain::NumAtoms ( const string &  blockType  )  const

Returns the number of atoms in this chain of the given blockType.

bool PChain::InStaticCollision (  ) 

Returns true if any atom in this PChain is in static collision, false otherwise.

bool PChain::InStaticCollision ( int  resIndex1,
int  resIndex2 
)

Returns true if any atom in this PChain between the specified residue indices is in static collision, false otherwise.

bool PChain::InSelfCollision (  )  [virtual]

Returns true if any atom in this PChain is in self collision, false otherwise.

Implements PLightChain.

bool PChain::InSelfCollision ( int  resIndex1,
int  resIndex2 
) [virtual]

Returns true if any atom in this PChain between the specified residue indices is in self collision, false otherwise.

Implements PLightChain.

bool PChain::InAnyCollision (  ) 

Returns true if any atom in this PChain is in static or self collision, false otherwise.

bool PChain::InAnyCollision ( int  resIndex1,
int  resIndex2 
)

Returns true if any atom in this PChain between the specified residue indices is in static or self collision, false otherwise.

pair< PAtom *, PAtom * > PChain::FindStaticCollision (  ) 

Returns a pair of atoms in static collision within the chain, or (NULL, NULL) if no such atoms exist.

pair< PAtom *, PAtom * > PChain::FindStaticCollision ( int  resIndex1,
int  resIndex2 
)

Returns a pair of atoms in static collision between the specified residue indices, or (NULL, NULL) if no such atoms exist.

pair< PAtom *, PAtom * > PChain::FindSelfCollision (  )  [virtual]

Returns a pair of atoms in self collision within the chain, or (NULL, NULL) if no such atoms exist.

Implements PLightChain.

pair< PAtom *, PAtom * > PChain::FindSelfCollision ( int  resIndex1,
int  resIndex2 
) [virtual]

Returns a pair of atoms in self collision between the specified residue indices, or (NULL, NULL) if no such atoms exist.

Implements PLightChain.

pair< PAtom *, PAtom * > PChain::FindAnyCollision (  ) 

Returns a pair of atoms in either static or self collision in the chain, or (NULL, NULL) if no such atoms exist.

pair< PAtom *, PAtom * > PChain::FindAnyCollision ( int  resIndex1,
int  resIndex2 
)

Returns a pair of atoms in either static or self collision between the specified residue indices, or (NULL, NULL) if no such atoms exist.

AtomCollisions * PChain::getAllCollidingStatic (  ) 

Returns a set of all atoms in the chain in static collision.

AtomCollisions * PChain::getAllCollidingStatic ( int  resIndex1,
int  resIndex2 
)

Returns a set of all atoms between the specified residue indices in static collision.

AtomCollisions * PChain::getAllCollidingSelf (  )  [virtual]

Returns a set of all atoms in the chain in self collision.

Implements PLightChain.

AtomCollisions * PChain::getAllCollidingSelf ( int  resIndex1,
int  resIndex2 
) [virtual]

Returns a set of all atoms between the specified residue indices in self collision.

Implements PLightChain.

AtomCollisions * PChain::getAllCollidingEither (  ) 

Returns a set of all atoms in the chain in either static or self collision.

AtomCollisions * PChain::getAllCollidingEither ( int  resIndex1,
int  resIndex2 
)

Returns a set of all atoms between the specified residue indices in either static or self collision.

vector< PBond * > & PChain::GetDOFs ( const string &  blockType  ) 

Returns all the degrees of freedom for the specified type of block (such as backbone or sidechain) in the PChain.

int PChain::NumDOF ( const string &  blockType  )  const

Returns the number of degrees of freedom (DOF) of the specified block type within this chain.

void PChain::RotateChain ( const string &  blockType,
int  DOFindex,
BondDirection  dir,
float  degrees 
)

Rotates the chain for a given blocktype, degrees of freedom (DOF), direction, and angle in degrees.

void PChain::RotateChain ( const ChainMove move  ) 

Rotates the chain given a ChainMove.

void PChain::MultiRotate ( vector< ChainMove > &  moves  ) 

MultiRotates the chain given a vector of ChainMove.

void PChain::AntiMultiRotate ( vector< ChainMove > &  moves  ) 

Does the opposite rotations in the opposite order as MultiRotate() would do.

vector< string > PChain::GetBlockTypes (  )  const

Returns all the block types in this PChain.

void PChain::DetachBlocks ( const string &  blockType,
const string &  blockTypeToDetachFrom 
)

Detaches all blockType blocks attached to blockTypeToDetachFrom.

void PChain::DetachBlocks ( const string &  blockType,
const string &  blockTypeToDetachFrom,
int  resStartIndex,
int  resEndIndex 
)

Detaches blockType blocks attached to blockTypeToDetachFrom from resStartIndex to resEndIndex.

void PChain::ReattachBlocks ( const string &  blockType  ) 

Reattaches blocks of type blockType to the original position.

void PChain::ReattachBlocks ( const string &  blockType,
int  resStartIndex,
int  resEndIndex 
)

Returns blocks of type blockType and within the range of resStartIndex to resEndIndex to their original positions.

void PChain::ReattachAllBlocks (  ) 

Reattaches all detached blocks regardless of block type.

void PChain::ReattachAllBlocks ( int  resStartIndex,
int  resEndIndex 
)

Reattaches all detached blocks regardless of blocktype from resStartIndex to resEndIndex.

void PChain::RandomizeDOFs ( BondDirection  dir  ) 

Applies a random rotation in the given direction to all degrees of freedom in the chain (or subchain).

void PChain::finalize (  ) 

Finalizes the chain and makes it ready for manipulation. Must be called as soon as the chain is finished being constructed or it will be unstable.

void PChain::AddRotateEventHandler ( PRotateEventHandler handler  ) 

Adds the object to the event list for rotations (HandleRotation function invoked whenever there is a rotation)

void PChain::RemoveRotateEventHandler ( PRotateEventHandler handler  ) 

Removes the given event handler from the rotation list. Aborts program if it's not in the list

void PChain::traverseFromStart ( AtomFunctor atomFn  )  [inline]

Traverses the chain from the start atom of residue 0, calling the specified AtomFunctor at each atom.

void PChain::traverseFromStart ( BondFunctor bondFn  )  [inline]

Traverses the chain from the start atom of residue 0, calling the specified BondFunctor at each bond.

void PChain::traverseFromStart ( AtomFunctor atomFn,
BondFunctor bondFn 
)

Traverses the chain from the start atom of residue 0, calling the specified AtomFunctor at each atom and the specified BondFunctor at each bond.

pair< int, int > PChain::getTopLevelIndices (  )  const

Returns a pair of integers indicating the residues in the top-level chain represented by this PChain. The first element of the pair is the start residue index; the second element of the pair is the end index.

const PSpaceManager* PChain::getSpaceManager (  )  [inline, virtual]

Returns the space manager of this PChain.

Implements PLightChain.

PChain * PChain::Clone (  ) 

Creates an exact copy of this PChain. If a subchain is cloned, all its parents will be replicated as well; thus, to fully deallocate the newly-cloned chain's memory, invoke Obliterate() when it is no longer needed.

Reimplemented in PProtein.

int PChain::getResidueLocalIndex ( PResidue res  ) 

Return the local index of a residue in the chain. Return -1 if there is no such residue in the chain.

int PChain::getResidueGlobalIndex ( PResidue res  ) 

Return the global index of a residue in the top level chain. Return -1 if there is no such residue.

vector< const PAtom * > PChain::getShortestPath ( const PAtom a1,
ConstAtomSet  a2Set,
int  maxLength 
)

Returns a AtomPath which is a vector going through a set of atoms. This path is generated from an atom to a set of atoms and the returning path will be the shortest one.

vector< const PAtom * > PChain::getShortestPath ( const PAtom a1,
const PAtom a2,
int  maxLength 
)

Returns a AtomPath which is a vector going through a set of atoms. This path is generated from an atom to another atom.

vector< const PAtom * > PChain::getShortestPath ( const PAtom a1,
ConstAtomSet  a2Set,
int  maxLength,
int  extendNum 
)

Returns a AtomPath which is a vector going through a set of atoms. This path is generated from an atom to another atom with some additional atoms in two end.

void PChain::inactivateResidue ( int  Rid1,
int  Rid2 
)

Inactivates the residues from index Rid1 to Rid2 so that these residues are not considered in collision detection.

void PChain::activateResidue ( int  Rid1,
int  Rid2 
)

Activates the residues from index Rid1 to Rid2 so that these residues are considered inc collision

void PChain::CloneResiduesIntoChain ( PChain other  )  [protected]

virtual PResidue* PChain::CreateResidue ( const string &  name  )  [inline, protected, virtual]

Reimplemented in PProtein.

virtual PResidue* PChain::CreateResidue ( const string &  name,
PResidueSpec spec 
) [inline, protected, virtual]

Reimplemented in PProtein.

virtual PResidue* PChain::CreateResidue ( const string &  name,
PResidue res 
) [inline, protected, virtual]

Reimplemented in PProtein.

virtual PResidue* PChain::CreateResidue ( const string &  name,
PResidueSpec spec,
PResidue res 
) [inline, protected, virtual]

Reimplemented in PProtein.


Friends And Related Function Documentation

friend class PAtom [friend]


The documentation for this class was generated from the following files:
Generated on Wed May 16 20:22:13 2007 for LoopTK: Protein Loop Kinematic Toolkit by  doxygen 1.5.1