Back to index

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

List of all members.

Public Member Functions

def __init__
def build_peptides

Public Attributes

 radius

Private Member Functions

def _accept

Detailed Description

Base class to extract polypeptides.

It checks if two consecutive residues in a chain are connected.
The connectivity test is implemented by a subclass.

This assumes you want both standard and non-standard amino acids.

Definition at line 291 of file Polypeptide.py.


Constructor & Destructor Documentation

def Bio.PDB.Polypeptide._PPBuilder.__init__ (   self,
  radius 
)
@param radius: distance
@type radius: float

Reimplemented in Bio.PDB.Polypeptide.PPBuilder, and Bio.PDB.Polypeptide.CaPPBuilder.

Definition at line 299 of file Polypeptide.py.

00299 
00300     def __init__(self, radius):
00301         """
00302         @param radius: distance
00303         @type radius: float
00304         """
00305         self.radius=radius


Member Function Documentation

def Bio.PDB.Polypeptide._PPBuilder._accept (   self,
  residue,
  standard_aa_only 
) [private]
Check if the residue is an amino acid (PRIVATE).

Definition at line 306 of file Polypeptide.py.

00306 
00307     def _accept(self, residue, standard_aa_only):
00308         """Check if the residue is an amino acid (PRIVATE)."""
00309         if is_aa(residue, standard=standard_aa_only):
00310             return True
00311         elif not standard_aa_only and "CA" in residue.child_dict:
00312             #It has an alpha carbon...
00313             #We probably need to update the hard coded list of
00314             #non-standard residues, see function is_aa for details.
00315             warnings.warn("Assuming residue %s is an unknown modified "
00316                           "amino acid" % residue.get_resname())
00317             return True
00318         else:
00319             # not a standard AA so skip
00320             return False
    

Here is the call graph for this function:

Here is the caller graph for this function:

def Bio.PDB.Polypeptide._PPBuilder.build_peptides (   self,
  entity,
  aa_only = 1 
)
Build and return a list of Polypeptide objects.

@param entity: polypeptides are searched for in this object
@type entity: L{Structure}, L{Model} or L{Chain}

@param aa_only: if 1, the residue needs to be a standard AA
@type aa_only: int

Definition at line 321 of file Polypeptide.py.

00321 
00322     def build_peptides(self, entity, aa_only=1):
00323         """Build and return a list of Polypeptide objects.
00324 
00325         @param entity: polypeptides are searched for in this object
00326         @type entity: L{Structure}, L{Model} or L{Chain}
00327 
00328         @param aa_only: if 1, the residue needs to be a standard AA
00329         @type aa_only: int
00330         """
00331         is_connected=self._is_connected
00332         accept=self._accept
00333         level=entity.get_level()
00334         # Decide wich entity we are dealing with
00335         if level=="S":
00336             model=entity[0]
00337             chain_list=model.get_list()
00338         elif level=="M":
00339             chain_list=entity.get_list()
00340         elif level=="C":
00341             chain_list=[entity]
00342         else:
00343             raise PDBException("Entity should be Structure, Model or Chain.")
00344         pp_list=[]
00345         for chain in chain_list:
00346             chain_it=iter(chain)
00347             try:
00348                 prev_res = chain_it.next()
00349                 while not accept(prev_res, aa_only):
00350                     prev_res = chain_it.next()
00351             except StopIteration:
00352                 #No interesting residues at all in this chain
00353                 continue
00354             pp=None
00355             for next_res in chain_it:
00356                 if accept(prev_res, aa_only) \
00357                 and accept(next_res, aa_only) \
00358                 and is_connected(prev_res, next_res):
00359                     if pp is None:
00360                         pp=Polypeptide()
00361                         pp.append(prev_res)
00362                         pp_list.append(pp)
00363                     pp.append(next_res)
00364                 else:
00365                     #Either too far apart, or one of the residues is unwanted.
00366                     #End the current peptide
00367                     pp=None
00368                 prev_res=next_res
00369         return pp_list
00370 

Here is the call graph for this function:


Member Data Documentation

Definition at line 304 of file Polypeptide.py.


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