Back to index

python-biopython  1.60
Public Member Functions
Bio.PDB.Polypeptide.Polypeptide Class Reference

List of all members.

Public Member Functions

def get_ca_list
def get_phi_psi_list
def get_tau_list
def get_theta_list
def get_sequence
def __repr__

Detailed Description

A polypeptide is simply a list of L{Residue} objects.

Definition at line 181 of file Polypeptide.py.


Member Function Documentation

Return string representation of the polypeptide.

Return <Polypeptide start=START end=END>, where START
and END are sequence identifiers of the outer residues.

Definition at line 280 of file Polypeptide.py.

00280 
00281     def __repr__(self):
00282         """Return string representation of the polypeptide.
00283         
00284         Return <Polypeptide start=START end=END>, where START
00285         and END are sequence identifiers of the outer residues.
00286         """
00287         start=self[0].get_id()[1]
00288         end=self[-1].get_id()[1]
00289         s="<Polypeptide start=%s end=%s>" % (start, end)
00290         return s

Get list of C-alpha atoms in the polypeptide.

@return: the list of C-alpha atoms
@rtype: [L{Atom}, L{Atom}, ...]

Definition at line 183 of file Polypeptide.py.

00183 
00184     def get_ca_list(self):
00185         """Get list of C-alpha atoms in the polypeptide.
00186         
00187         @return: the list of C-alpha atoms
00188         @rtype: [L{Atom}, L{Atom}, ...]
00189         """
00190         ca_list=[]
00191         for res in self:
00192             ca=res["CA"]
00193             ca_list.append(ca)
00194         return ca_list

Here is the caller graph for this function:

Return the list of phi/psi dihedral angles.

Definition at line 195 of file Polypeptide.py.

00195 
00196     def get_phi_psi_list(self):
00197         """Return the list of phi/psi dihedral angles."""
00198         ppl=[]
00199         lng=len(self)
00200         for i in range(0, lng):
00201             res=self[i]
00202             try:
00203                 n=res['N'].get_vector()
00204                 ca=res['CA'].get_vector()
00205                 c=res['C'].get_vector()
00206             except:
00207                 # Some atoms are missing
00208                 # Phi/Psi cannot be calculated for this residue
00209                 ppl.append((None, None))
00210                 res.xtra["PHI"]=None
00211                 res.xtra["PSI"]=None
00212                 continue
00213             # Phi
00214             if i>0:
00215                 rp=self[i-1]
00216                 try:
00217                     cp=rp['C'].get_vector()
00218                     phi=calc_dihedral(cp, n, ca, c)
00219                 except:
00220                     phi=None
00221             else:
00222                 # No phi for residue 0!
00223                 phi=None
00224             # Psi
00225             if i<(lng-1):
00226                 rn=self[i+1]
00227                 try:
00228                     nn=rn['N'].get_vector()
00229                     psi=calc_dihedral(n, ca, c, nn)
00230                 except:
00231                     psi=None
00232             else:
00233                 # No psi for last residue!
00234                 psi=None
00235             ppl.append((phi, psi))
00236             # Add Phi/Psi to xtra dict of residue
00237             res.xtra["PHI"]=phi
00238             res.xtra["PSI"]=psi
00239         return ppl

Here is the call graph for this function:

Return the AA sequence as a Seq object.

@return: polypeptide sequence 
@rtype: L{Seq}

Definition at line 268 of file Polypeptide.py.

00268 
00269     def get_sequence(self):
00270         """Return the AA sequence as a Seq object.
00271 
00272         @return: polypeptide sequence 
00273         @rtype: L{Seq}
00274         """
00275         s=""
00276         for res in self:
00277             s += to_one_letter_code.get(res.get_resname(), 'X')
00278         seq=Seq(s, generic_protein)
00279         return seq

List of tau torsions angles for all 4 consecutive Calpha atoms.

Definition at line 240 of file Polypeptide.py.

00240 
00241     def get_tau_list(self):
00242         """List of tau torsions angles for all 4 consecutive Calpha atoms."""
00243         ca_list=self.get_ca_list()
00244         tau_list=[]
00245         for i in range(0, len(ca_list)-3):
00246             atom_list = (ca_list[i], ca_list[i+1], ca_list[i+2], ca_list[i+3])
00247             v1, v2, v3, v4 = [a.get_vector() for a in atom_list]
00248             tau=calc_dihedral(v1, v2, v3, v4)
00249             tau_list.append(tau)
00250             # Put tau in xtra dict of residue
00251             res=ca_list[i+2].get_parent()
00252             res.xtra["TAU"]=tau
00253         return tau_list

Here is the call graph for this function:

List of theta angles for all 3 consecutive Calpha atoms.

Definition at line 254 of file Polypeptide.py.

00254 
00255     def get_theta_list(self):
00256         """List of theta angles for all 3 consecutive Calpha atoms."""
00257         theta_list=[]
00258         ca_list=self.get_ca_list()
00259         for i in range(0, len(ca_list)-2):
00260             atom_list = (ca_list[i], ca_list[i+1], ca_list[i+2])
00261             v1, v2, v3 = [a.get_vector() for a in atom_list]
00262             theta=calc_angle(v1, v2, v3)
00263             theta_list.append(theta)
00264             # Put tau in xtra dict of residue
00265             res=ca_list[i+1].get_parent()
00266             res.xtra["THETA"]=theta
00267         return theta_list

Here is the call graph for this function:


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