Back to index

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

List of all members.

Public Member Functions

def __init__
def __repr__
def get_residues
def get_atoms
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

 level
 serial_num
 id
 full_id
 parent
 child_list
 child_dict
 xtra

Private Member Functions

def _sort

Detailed Description

The object representing a model in a structure. In a structure
derived from an X-ray crystallography experiment, only a single 
model will be present (with some exceptions). NMR structures 
normally contain many different models. 

Definition at line 11 of file Model.py.


Constructor & Destructor Documentation

def Bio.PDB.Model.Model.__init__ (   self,
  id,
  serial_num = None 
)
Arguments:
o id - int
o serial_num - int

Definition at line 19 of file Model.py.

00019 
00020     def __init__(self, id, serial_num = None):
00021         """
00022         Arguments:
00023         o id - int
00024         o serial_num - int
00025         """
00026         self.level="M"
00027         if serial_num is None:
00028             self.serial_num=id
00029         else:
00030             self.serial_num=serial_num
00031 
00032         Entity.__init__(self, id)


Member Function Documentation

def Bio.PDB.Entity.Entity.__contains__ (   self,
  id 
) [inherited]

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 
) [inherited]

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 
) [inherited]

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:

def Bio.PDB.Entity.Entity.__iter__ (   self) [inherited]

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:

def Bio.PDB.Entity.Entity.__len__ (   self) [inherited]

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)

Definition at line 56 of file Model.py.

00056 
00057     def __repr__(self):
00058         return "<Model id=%s>" % self.get_id()

Here is the call graph for this function:

def Bio.PDB.Model.Model._sort (   self,
  c1,
  c2 
) [private]
Sort the Chains instances in the Model instance.

Chain instances are sorted alphabetically according to
their chain id. Blank chains come last, as they often consist
of waters.

Arguments:
o c1, c2 - Chain objects

Definition at line 35 of file Model.py.

00035 
00036     def _sort(self, c1, c2):
00037         """Sort the Chains instances in the Model instance.
00038 
00039         Chain instances are sorted alphabetically according to
00040         their chain id. Blank chains come last, as they often consist
00041         of waters.
00042 
00043         Arguments:
00044         o c1, c2 - Chain objects
00045         """
00046         id1=c1.get_id()
00047         id2= c2.get_id()
00048         # make sure blank chains come last (often waters)
00049         if id1==" " and not id2==" ":
00050             return 1
00051         elif id2==" " and not id1==" ":
00052             return -1
00053         return cmp(id1, id2)

Here is the caller graph for this function:

def Bio.PDB.Entity.Entity.add (   self,
  entity 
) [inherited]

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:

def Bio.PDB.Entity.Entity.copy (   self) [inherited]

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 
) [inherited]

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:

def Bio.PDB.Entity.Entity.detach_parent (   self) [inherited]

Definition at line 70 of file Entity.py.

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

Definition at line 66 of file Model.py.

00066 
00067     def get_atoms(self):
00068         for r in self.get_residues():
00069             for a in r:
00070                 yield a
00071 

Here is the call graph for this function:

def Bio.PDB.Entity.Entity.get_full_id (   self) [inherited]
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:

def Bio.PDB.Entity.Entity.get_id (   self) [inherited]

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:

def Bio.PDB.Entity.Entity.get_iterator (   self) [inherited]

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

def Bio.PDB.Entity.Entity.get_level (   self) [inherited]
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

def Bio.PDB.Entity.Entity.get_list (   self) [inherited]

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:

def Bio.PDB.Entity.Entity.get_parent (   self) [inherited]

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:

Definition at line 61 of file Model.py.

00061 
00062     def get_residues(self):
00063         for c in self:
00064             for r in c:
00065                 yield r

Here is the caller graph for this function:

def Bio.PDB.Entity.Entity.has_id (   self,
  id 
) [inherited]
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 
) [inherited]

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 
) [inherited]

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 
) [inherited]
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 25 of file Model.py.

Definition at line 24 of file Entity.py.

Definition at line 27 of file Model.py.

Definition at line 28 of file Entity.py.


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