Back to index

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

List of all members.

Public Member Functions

def __init__
def __getitem__
def __contains__
def __delitem__
def __repr__
def get_unpacked_list
def has_id
def get_residues
def get_atoms
def __len__
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 get_parent
def get_id
def get_full_id
def transform
def copy

Public Attributes

 level
 id
 full_id
 parent
 child_list
 child_dict
 xtra

Private Member Functions

def _sort
def _translate_id

Detailed Description

Definition at line 11 of file Chain.py.


Constructor & Destructor Documentation

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

Reimplemented from Bio.PDB.Entity.Entity.

Definition at line 12 of file Chain.py.

00012 
00013     def __init__(self, id):
00014         self.level="C"
00015         Entity.__init__(self, id)


Member Function Documentation

def Bio.PDB.Chain.Chain.__contains__ (   self,
  id 
)
True if a residue with given id is present in this chain.

Arguments:
o id - (string, int, string) or int

Reimplemented from Bio.PDB.Entity.Entity.

Definition at line 69 of file Chain.py.

00069 
00070     def __contains__(self, id):
00071         """True if a residue with given id is present in this chain.
00072 
00073         Arguments:
00074         o id - (string, int, string) or int
00075         """
00076         id=self._translate_id(id)
00077         return Entity.__contains__(self, id)

Here is the call graph for this function:

def Bio.PDB.Chain.Chain.__delitem__ (   self,
  id 
)
Arguments:
o id - (string, int, string) or int

Reimplemented from Bio.PDB.Entity.Entity.

Definition at line 78 of file Chain.py.

00078 
00079     def __delitem__(self, id):
00080         """
00081         Arguments:
00082         o id - (string, int, string) or int
00083         """
00084         id=self._translate_id(id)
00085         return Entity.__delitem__(self, id)

Here is the call graph for this function:

def Bio.PDB.Chain.Chain.__getitem__ (   self,
  id 
)
Return the residue with given id.

The id of a residue is (hetero flag, sequence identifier, insertion code). 
If id is an int, it is translated to (" ", id, " ") by the _translate_id
method. 

Arguments:
o id - (string, int, string) or int

Reimplemented from Bio.PDB.Entity.Entity.

Definition at line 56 of file Chain.py.

00056 
00057     def __getitem__(self, id):
00058         """Return the residue with given id.
00059 
00060         The id of a residue is (hetero flag, sequence identifier, insertion code). 
00061         If id is an int, it is translated to (" ", id, " ") by the _translate_id
00062         method. 
00063 
00064         Arguments:
00065         o id - (string, int, string) or int
00066         """
00067         id=self._translate_id(id)
00068         return Entity.__getitem__(self, id)

Here is the call graph for this function:

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 86 of file Chain.py.

00086 
00087     def __repr__(self):
00088         return "<Chain id=%s>" % self.get_id()

Here is the call graph for this function:

def Bio.PDB.Chain.Chain._sort (   self,
  r1,
  r2 
) [private]
Sort function for residues in a chain

Residues are first sorted according to their hetatm records.
Protein and nucleic acid residues first, hetatm residues next, 
and waters last. Within each group, the residues are sorted according
to their resseq's (sequence identifiers). Finally, residues with the
same resseq's are sorted according to icode.

Arguments:
o r1, r2 - Residue objects

Definition at line 18 of file Chain.py.

00018 
00019     def _sort(self, r1, r2):
00020         """Sort function for residues in a chain
00021 
00022         Residues are first sorted according to their hetatm records.
00023         Protein and nucleic acid residues first, hetatm residues next, 
00024         and waters last. Within each group, the residues are sorted according
00025         to their resseq's (sequence identifiers). Finally, residues with the
00026         same resseq's are sorted according to icode.
00027 
00028         Arguments:
00029         o r1, r2 - Residue objects
00030         """
00031         hetflag1, resseq1, icode1=r1.id
00032         hetflag2, resseq2, icode2=r2.id
00033         if hetflag1!=hetflag2:
00034             return cmp(hetflag1[0], hetflag2[0])
00035         elif resseq1!=resseq2:
00036             return cmp(resseq1, resseq2)
00037         return cmp(icode1, icode2)

Here is the caller graph for this function:

def Bio.PDB.Chain.Chain._translate_id (   self,
  id 
) [private]
A residue id is normally a tuple (hetero flag, sequence identifier, 
insertion code). Since for most residues the hetero flag and the 
insertion code are blank (i.e. " "), you can just use the sequence 
identifier to index a residue in a chain. The _translate_id method
translates the sequence identifier to the (" ", sequence identifier,
" ") tuple. 

Arguments:
o id - int, residue resseq 

Definition at line 38 of file Chain.py.

00038 
00039     def _translate_id(self, id):
00040         """
00041         A residue id is normally a tuple (hetero flag, sequence identifier, 
00042         insertion code). Since for most residues the hetero flag and the 
00043         insertion code are blank (i.e. " "), you can just use the sequence 
00044         identifier to index a residue in a chain. The _translate_id method
00045         translates the sequence identifier to the (" ", sequence identifier,
00046         " ") tuple. 
00047 
00048         Arguments:
00049         o id - int, residue resseq 
00050         """
00051         if isinstance(id, int):
00052             id=(' ', id, ' ')
00053         return id
            

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 127 of file Chain.py.

00127 
00128     def get_atoms(self):
00129         for r in self:
00130             for a in r:
00131                 yield a
00132 
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 123 of file Chain.py.

00123 
00124     def get_residues(self):
00125         for r in self:
00126             yield r

Here is the caller graph for this function:

Return a list of undisordered residues.

Some Residue objects hide several disordered residues
(DisorderedResidue objects). This method unpacks them, 
ie. it returns a list of simple Residue objects.

Definition at line 91 of file Chain.py.

00091 
00092     def get_unpacked_list(self):
00093         """Return a list of undisordered residues.
00094 
00095         Some Residue objects hide several disordered residues
00096         (DisorderedResidue objects). This method unpacks them, 
00097         ie. it returns a list of simple Residue objects.
00098         """
00099         unpacked_list=[]
00100         for residue in self.get_list():
00101             if residue.is_disordered()==2:
00102                 for dresidue in residue.disordered_get_list():
00103                     unpacked_list.append(dresidue)
00104             else:
00105                 unpacked_list.append(residue)
00106         return unpacked_list

Here is the call graph for this function:

def Bio.PDB.Chain.Chain.has_id (   self,
  id 
)
Return 1 if a residue with given id is present.

The id of a residue is (hetero flag, sequence identifier, insertion code).
If id is an int, it is translated to (" ", id, " ") by the _translate_id
method.

Arguments:
o id - (string, int, string) or int

Reimplemented from Bio.PDB.Entity.Entity.

Definition at line 107 of file Chain.py.

00107 
00108     def has_id(self, id):
00109         """Return 1 if a residue with given id is present.
00110 
00111         The id of a residue is (hetero flag, sequence identifier, insertion code).
00112                 If id is an int, it is translated to (" ", id, " ") by the _translate_id
00113         method.
00114 
00115         Arguments:
00116         o id - (string, int, string) or int
00117         """
00118         id=self._translate_id(id)
00119         return Entity.has_id(self, id)
00120 

Here is the call graph for this function:

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 13 of file Chain.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: