Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.PDB.Entity.Entity Class Reference
Inheritance diagram for Bio.PDB.Entity.Entity:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def __len__
def __getitem__
def __delitem__
def __contains__
def __iter__
def get_level
def set_parent
def detach_parent
def detach_child
def add
def insert
def get_iterator
def get_list
def has_id
def get_parent
def get_id
def get_full_id
def transform
def copy

Public Attributes

 id
 full_id
 parent
 child_list
 child_dict
 xtra

Detailed Description

Basic container object. Structure, Model, Chain and Residue
are subclasses of Entity. It deals with storage and lookup.

Definition at line 16 of file Entity.py.


Constructor & Destructor Documentation

def Bio.PDB.Entity.Entity.__init__ (   self,
  id 
)

Reimplemented in Bio.PDB.Structure.Structure, and Bio.PDB.Chain.Chain.

Definition at line 21 of file Entity.py.

00021 
00022     def __init__(self, id):
00023         self.id=id
00024         self.full_id=None
00025         self.parent=None
00026         self.child_list=[]
00027         self.child_dict={}
00028         # Dictionary that keeps addictional properties
00029         self.xtra={}
    

Member Function Documentation

def Bio.PDB.Entity.Entity.__contains__ (   self,
  id 
)

Reimplemented in Bio.PDB.Chain.Chain.

Definition at line 44 of file Entity.py.

00044 
00045     def __contains__(self, id):
00046         "True if there is a child element with the given id."
00047         return (id in self.child_dict)

def Bio.PDB.Entity.Entity.__delitem__ (   self,
  id 
)

Reimplemented in Bio.PDB.Chain.Chain.

Definition at line 40 of file Entity.py.

00040 
00041     def __delitem__(self, id):
00042         "Remove a child."
00043         return self.detach_child(id)

Here is the call graph for this function:

def Bio.PDB.Entity.Entity.__getitem__ (   self,
  id 
)

Reimplemented in Bio.PDB.Chain.Chain.

Definition at line 36 of file Entity.py.

00036 
00037     def __getitem__(self, id):
00038         "Return the child with given id."
00039         return self.child_dict[id]

Here is the caller graph for this function:

Definition at line 48 of file Entity.py.

00048 
00049     def __iter__(self):
00050         "Iterate over children."
00051         for child in self.child_list:
00052             yield child

Here is the caller graph for this function:

Definition at line 32 of file Entity.py.

00032 
00033     def __len__(self):
00034         "Return the number of children."
00035         return len(self.child_list)

def Bio.PDB.Entity.Entity.add (   self,
  entity 
)

Reimplemented in Bio.PDB.Residue.Residue.

Definition at line 81 of file Entity.py.

00081 
00082     def add(self, entity):
00083         "Add a child to the Entity."
00084         entity_id=entity.get_id()
00085         if self.has_id(entity_id):
00086             raise PDBConstructionException( \
00087                 "%s defined twice" % str(entity_id))
00088         entity.set_parent(self)
00089         self.child_list.append(entity)
00090         self.child_dict[entity_id]=entity
    

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 172 of file Entity.py.

00172 
00173     def copy(self):
00174         shallow = copy(self)
00175 
00176         shallow.child_list = []
00177         shallow.child_dict = {}
00178         shallow.xtra = copy(self.xtra)
00179 
00180         shallow.detach_parent()
00181 
00182         for child in self.child_list:
00183             shallow.add(child.copy())
00184         return shallow

Here is the caller graph for this function:

def Bio.PDB.Entity.Entity.detach_child (   self,
  id 
)

Definition at line 74 of file Entity.py.

00074 
00075     def detach_child(self, id):
00076         "Remove a child."
00077         child=self.child_dict[id] 
00078         child.detach_parent()
00079         del self.child_dict[id]
00080         self.child_list.remove(child)

Here is the caller graph for this function:

Definition at line 70 of file Entity.py.

00070 
00071     def detach_parent(self):
00072         "Detach the parent."
00073         self.parent=None

Return the full id.

The full id is a tuple containing all id's starting from
the top object (Structure) down to the current object. A full id for
a Residue object e.g. is something like:

("1abc", 0, "A", (" ", 10, "A"))

This corresponds to:

Structure with id "1abc"
Model with id 0
Chain with id "A"
Residue with id (" ", 10, "A")

The Residue id indicates that the residue is not a hetero-residue 
(or a water) beacuse it has a blank hetero field, that its sequence 
identifier is 10 and its insertion code "A".

Definition at line 122 of file Entity.py.

00122 
00123     def get_full_id(self):
00124         """Return the full id.
00125 
00126         The full id is a tuple containing all id's starting from
00127         the top object (Structure) down to the current object. A full id for
00128         a Residue object e.g. is something like:
00129 
00130         ("1abc", 0, "A", (" ", 10, "A"))
00131 
00132         This corresponds to:
00133 
00134         Structure with id "1abc"
00135         Model with id 0
00136         Chain with id "A"
00137         Residue with id (" ", 10, "A")
00138 
00139         The Residue id indicates that the residue is not a hetero-residue 
00140         (or a water) beacuse it has a blank hetero field, that its sequence 
00141         identifier is 10 and its insertion code "A".
00142         """
00143         if self.full_id==None:
00144             entity_id=self.get_id()
00145             l=[entity_id]   
00146             parent=self.get_parent()
00147             while not (parent is None):
00148                 entity_id=parent.get_id()
00149                 l.append(entity_id)
00150                 parent=parent.get_parent()
00151             l.reverse()
00152             self.full_id=tuple(l)
00153         return self.full_id

Here is the call graph for this function:

Definition at line 118 of file Entity.py.

00118 
00119     def get_id(self):
00120         "Return the id."
00121         return self.id

Here is the caller graph for this function:

Definition at line 101 of file Entity.py.

00101 
00102     def get_iterator(self):
00103         "Return iterator over children."
00104         for child in self.child_list:
00105             yield child

Return level in hierarchy.

A - atom
R - residue
C - chain
M - model
S - structure

Definition at line 55 of file Entity.py.

00055 
00056     def get_level(self):
00057         """Return level in hierarchy.
00058 
00059         A - atom
00060         R - residue
00061         C - chain
00062         M - model
00063         S - structure
00064         """
00065         return self.level

Definition at line 106 of file Entity.py.

00106 
00107     def get_list(self):
00108         "Return a copy of the list of children."
00109         return copy(self.child_list)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 114 of file Entity.py.

00114 
00115     def get_parent(self):
00116         "Return the parent Entity object."
00117         return self.parent

Here is the caller graph for this function:

def Bio.PDB.Entity.Entity.has_id (   self,
  id 
)
True if a child with given id exists.

Reimplemented in Bio.PDB.Chain.Chain.

Definition at line 110 of file Entity.py.

00110 
00111     def has_id(self, id):
00112         """True if a child with given id exists."""
00113         return (id in self.child_dict)

Here is the caller graph for this function:

def Bio.PDB.Entity.Entity.insert (   self,
  pos,
  entity 
)

Definition at line 91 of file Entity.py.

00091 
00092     def insert(self, pos, entity):
00093         "Add a child to the Entity at a specified position."
00094         entity_id=entity.get_id()
00095         if self.has_id(entity_id):
00096             raise PDBConstructionException( \
00097                 "%s defined twice" % str(entity_id))
00098         entity.set_parent(self)
00099         self.child_list[pos:pos] = [entity]
00100         self.child_dict[entity_id]=entity        

Here is the call graph for this function:

def Bio.PDB.Entity.Entity.set_parent (   self,
  entity 
)

Definition at line 66 of file Entity.py.

00066 
00067     def set_parent(self, entity):
00068         "Set the parent Entity object."
00069         self.parent=entity

def Bio.PDB.Entity.Entity.transform (   self,
  rot,
  tran 
)
Apply rotation and translation to the atomic coordinates.

Example:
>>> rotation=rotmat(pi, Vector(1,0,0))
>>> translation=array((0,0,1), 'f')
>>> entity.transform(rotation, translation)

@param rot: A right multiplying rotation matrix
@type rot: 3x3 Numeric array

@param tran: the translation vector
@type tran: size 3 Numeric array

Definition at line 154 of file Entity.py.

00154 
00155     def transform(self, rot, tran):
00156         """
00157         Apply rotation and translation to the atomic coordinates.
00158 
00159         Example:
00160                 >>> rotation=rotmat(pi, Vector(1,0,0))
00161                 >>> translation=array((0,0,1), 'f')
00162                 >>> entity.transform(rotation, translation)
00163 
00164         @param rot: A right multiplying rotation matrix
00165         @type rot: 3x3 Numeric array
00166 
00167         @param tran: the translation vector
00168         @type tran: size 3 Numeric array
00169         """
00170         for o in self.get_list():
00171             o.transform(rot, tran)

Here is the call graph for this function:


Member Data Documentation

Definition at line 26 of file Entity.py.

Definition at line 25 of file Entity.py.

Definition at line 23 of file Entity.py.

Definition at line 22 of file Entity.py.

Definition at line 24 of file Entity.py.

Definition at line 28 of file Entity.py.


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