Back to index

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

List of all members.

Public Member Functions

def __init__
def __contains__
def __getitem__
def __len__
def has_key
def keys
def __iter__

Public Attributes

 ca_cb_list
 property_dict
 property_keys
 property_list

Private Member Functions

def _get_cb
def _get_gly_cb_vector

Detailed Description

Abstract class to calculate Half-Sphere Exposure (HSE).

The HSE can be calculated based on the CA-CB vector, or the pseudo CB-CA
vector based on three consecutive CA atoms. This is done by two separate 
subclasses. 

Definition at line 17 of file HSExposure.py.


Constructor & Destructor Documentation

def Bio.PDB.HSExposure._AbstractHSExposure.__init__ (   self,
  model,
  radius,
  offset,
  hse_up_key,
  hse_down_key,
  angle_key = None 
)
@param model: model
@type model: L{Model}

@param radius: HSE radius
@type radius: float

@param offset: number of flanking residues that are ignored in the calculation
of the number of neighbors
@type offset: int

@param hse_up_key: key used to store HSEup in the entity.xtra attribute
@type hse_up_key: string

@param hse_down_key: key used to store HSEdown in the entity.xtra attribute
@type hse_down_key: string

@param angle_key: key used to store the angle between CA-CB and CA-pCB in 
    the entity.xtra attribute
@type angle_key: string

Definition at line 26 of file HSExposure.py.

00026 
00027             angle_key=None):
00028         """
00029         @param model: model
00030         @type model: L{Model}
00031 
00032         @param radius: HSE radius
00033         @type radius: float
00034 
00035         @param offset: number of flanking residues that are ignored in the calculation
00036         of the number of neighbors
00037         @type offset: int
00038 
00039         @param hse_up_key: key used to store HSEup in the entity.xtra attribute
00040         @type hse_up_key: string
00041 
00042         @param hse_down_key: key used to store HSEdown in the entity.xtra attribute
00043         @type hse_down_key: string
00044 
00045         @param angle_key: key used to store the angle between CA-CB and CA-pCB in 
00046             the entity.xtra attribute
00047         @type angle_key: string
00048         """
00049         assert(offset>=0)
00050         # For PyMOL visualization
00051         self.ca_cb_list=[]
00052         ppb=CaPPBuilder()
00053         ppl=ppb.build_peptides(model)
00054         hse_map={}
00055         hse_list=[]
00056         hse_keys=[]
00057         for pp1 in ppl:
00058             for i in range(0, len(pp1)):
00059                 if i==0:
00060                     r1=None
00061                 else:
00062                     r1=pp1[i-1]
00063                 r2=pp1[i]
00064                 if i==len(pp1)-1:
00065                     r3=None
00066                 else:
00067                     r3=pp1[i+1]
00068                 # This method is provided by the subclasses to calculate HSE
00069                 result=self._get_cb(r1, r2, r3)
00070                 if result is None:
00071                     # Missing atoms, or i==0, or i==len(pp1)-1
00072                     continue
00073                 pcb, angle=result
00074                 hse_u=0
00075                 hse_d=0
00076                 ca2=r2['CA'].get_vector()
00077                 for pp2 in ppl:
00078                     for j in range(0, len(pp2)):
00079                         if pp1 is pp2 and abs(i-j)<=offset:
00080                             # neighboring residues in the chain are ignored 
00081                             continue
00082                         ro=pp2[j]
00083                         if not is_aa(ro) or not ro.has_id('CA'):
00084                             continue
00085                         cao=ro['CA'].get_vector()
00086                         d=(cao-ca2)
00087                         if d.norm()<radius:
00088                             if d.angle(pcb)<(pi/2):
00089                                 hse_u+=1
00090                             else:
00091                                 hse_d+=1
00092                 res_id=r2.get_id()
00093                 chain_id=r2.get_parent().get_id()
00094                 # Fill the 3 data structures
00095                 hse_map[(chain_id, res_id)]=(hse_u, hse_d, angle)
00096                 hse_list.append((r2, (hse_u, hse_d, angle)))
00097                 hse_keys.append((chain_id, res_id))
00098                 # Add to xtra
00099                 r2.xtra[hse_up_key]=hse_u
00100                 r2.xtra[hse_down_key]=hse_d
00101                 if angle_key:
00102                     r2.xtra[angle_key]=angle
00103         AbstractPropertyMap.__init__(self, hse_map, hse_keys, hse_list)


Member Function Documentation

True if the mapping has a property for this residue.

Example:
    >>> if (chain_id, res_id) in apmap:
    ...     res, prop = apmap[(chain_id, res_id)]

@param chain_id: chain id
@type chain_id: char 

@param res_id: residue id
@type res_id: char 

Definition at line 18 of file AbstractPropertyMap.py.

00018 
00019     def __contains__(self, id):
00020         """True if the mapping has a property for this residue.
00021 
00022         Example:
00023             >>> if (chain_id, res_id) in apmap:
00024             ...     res, prop = apmap[(chain_id, res_id)]
00025 
00026         @param chain_id: chain id
00027         @type chain_id: char 
00028 
00029         @param res_id: residue id
00030         @type res_id: char 
00031         """
00032         translated_id = self._translate_id(id)
00033         return (translated_id in self.property_dict)

Here is the call graph for this function:

def Bio.PDB.AbstractPropertyMap.AbstractPropertyMap.__getitem__ (   self,
  key 
) [inherited]
Return property for a residue.

@param chain_id: chain id
@type chain_id: char 

@param res_id: residue id
@type res_id: int or (char, int, char) 

@return: some residue property 
@rtype: anything (can be a tuple)

Definition at line 34 of file AbstractPropertyMap.py.

00034 
00035     def __getitem__(self, key):
00036         """
00037         Return property for a residue.
00038 
00039         @param chain_id: chain id
00040         @type chain_id: char 
00041 
00042         @param res_id: residue id
00043         @type res_id: int or (char, int, char) 
00044 
00045         @return: some residue property 
00046         @rtype: anything (can be a tuple)
00047         """
00048         translated_id=self._translate_id(key)
00049         return self.property_dict[translated_id]

Here is the call graph for this function:

Here is the caller graph for this function:

Iterate over the (entity, property) list. Handy alternative to 
the dictionary-like access.

Example:
    >>> for (res, property) in iter(map):
    ...     print res, property

@return: iterator

Definition at line 93 of file AbstractPropertyMap.py.

00093 
00094     def __iter__(self):
00095         """
00096         Iterate over the (entity, property) list. Handy alternative to 
00097         the dictionary-like access.
00098 
00099         Example:
00100             >>> for (res, property) in iter(map):
00101             ...     print res, property
00102 
00103         @return: iterator
00104         """
00105         for i in range(0, len(self.property_list)):
00106             yield self.property_list[i]
00107 

Here is the caller graph for this function:

Return number of residues for which the property is available.

@return: number of residues
@rtype: int

Definition at line 50 of file AbstractPropertyMap.py.

00050 
00051     def __len__(self):
00052         """
00053         Return number of residues for which the property is available.
00054 
00055         @return: number of residues
00056         @rtype: int
00057         """
00058         return len(self.property_dict)

def Bio.PDB.HSExposure._AbstractHSExposure._get_cb (   self,
  r1,
  r2,
  r3 
) [private]
This method is provided by the subclasses to calculate HSE.

Reimplemented in Bio.PDB.HSExposure.HSExposureCB, and Bio.PDB.HSExposure.HSExposureCA.

Definition at line 104 of file HSExposure.py.

00104 
00105     def _get_cb(self, r1, r2, r3):
00106         """This method is provided by the subclasses to calculate HSE."""
00107         return NotImplemented

def Bio.PDB.HSExposure._AbstractHSExposure._get_gly_cb_vector (   self,
  residue 
) [private]
Return a pseudo CB vector for a Gly residue.
The pseudoCB vector is centered at the origin.

CB coord=N coord rotated over -120 degrees 
along the CA-C axis.

Definition at line 108 of file HSExposure.py.

00108 
00109     def _get_gly_cb_vector(self, residue):
00110         """
00111         Return a pseudo CB vector for a Gly residue.
00112         The pseudoCB vector is centered at the origin.
00113 
00114         CB coord=N coord rotated over -120 degrees 
00115         along the CA-C axis.
00116         """
00117         try:
00118             n_v=residue["N"].get_vector()
00119             c_v=residue["C"].get_vector()
00120             ca_v=residue["CA"].get_vector()
00121         except:
00122             return None
00123         # center at origin
00124         n_v=n_v-ca_v
00125         c_v=c_v-ca_v
00126         # rotation around c-ca over -120 deg
00127         rot=rotaxis(-pi*120.0/180.0, c_v)
00128         cb_at_origin_v=n_v.left_multiply(rot)
00129         # move back to ca position
00130         cb_v=cb_at_origin_v+ca_v
00131         # This is for PyMol visualization
00132         self.ca_cb_list.append((ca_v, cb_v))
00133         return cb_at_origin_v
00134 
00135 

Here is the caller graph for this function:

def Bio.PDB.AbstractPropertyMap.AbstractPropertyMap.has_key (   self,
  id 
) [inherited]
True if the mapping has a property for this residue.

(Obsolete; use "id in mapping" instead.)

Example:

    >>> if apmap.has_key((chain_id, res_id)):
    ...     res, prop = apmap[(chain_id, res_id)]

Is equivalent to:

    >>> if (chain_id, res_id) in apmap:
    ...     res, prop = apmap[(chain_id, res_id)]

@param chain_id: chain id
@type chain_id: char 

@param res_id: residue id
@type res_id: char 

Definition at line 59 of file AbstractPropertyMap.py.

00059 
00060     def has_key(self, id):
00061         """True if the mapping has a property for this residue.
00062 
00063         (Obsolete; use "id in mapping" instead.)
00064 
00065         Example:
00066 
00067             >>> if apmap.has_key((chain_id, res_id)):
00068             ...     res, prop = apmap[(chain_id, res_id)]
00069 
00070         Is equivalent to:
00071 
00072             >>> if (chain_id, res_id) in apmap:
00073             ...     res, prop = apmap[(chain_id, res_id)]
00074 
00075         @param chain_id: chain id
00076         @type chain_id: char 
00077 
00078         @param res_id: residue id
00079         @type res_id: char 
00080         """
00081         import warnings
00082         warnings.warn("This function is obsolete; use 'id in mapping' instead", PendingDeprecationWarning)
00083         return (id in self)

Return the list of residues.

@return: list of residues for which the property was calculated
@rtype: [(chain_id, res_id), (chain_id, res_id),...] 

Definition at line 84 of file AbstractPropertyMap.py.

00084 
00085     def keys(self):
00086         """
00087         Return the list of residues.
00088 
00089         @return: list of residues for which the property was calculated
00090         @rtype: [(chain_id, res_id), (chain_id, res_id),...] 
00091         """
00092         return self.property_keys

Here is the caller graph for this function:


Member Data Documentation

Definition at line 50 of file HSExposure.py.

Definition at line 11 of file AbstractPropertyMap.py.

Definition at line 12 of file AbstractPropertyMap.py.

Definition at line 13 of file AbstractPropertyMap.py.


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