Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.PDB.HSExposure.ExposureCN Class Reference
Inheritance diagram for Bio.PDB.HSExposure.ExposureCN:
Inheritance graph
[legend]
Collaboration diagram for Bio.PDB.HSExposure.ExposureCN:
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

 property_dict
 property_keys
 property_list

Detailed Description

Definition at line 262 of file HSExposure.py.


Constructor & Destructor Documentation

def Bio.PDB.HSExposure.ExposureCN.__init__ (   self,
  model,
  radius = 12.0,
  offset = 0 
)
A residue's exposure is defined as the number of CA atoms around 
that residues CA atom. A dictionary is returned that uses a L{Residue}
object as key, and the residue exposure as corresponding value.

@param model: the model that contains the residues
@type model: L{Model}

@param radius: radius of the sphere (centred at the CA atom)
@type radius: float

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

Reimplemented from Bio.PDB.AbstractPropertyMap.AbstractPropertyMap.

Definition at line 263 of file HSExposure.py.

00263 
00264     def __init__(self, model, radius=12.0, offset=0):
00265         """
00266         A residue's exposure is defined as the number of CA atoms around 
00267         that residues CA atom. A dictionary is returned that uses a L{Residue}
00268         object as key, and the residue exposure as corresponding value.
00269 
00270         @param model: the model that contains the residues
00271         @type model: L{Model}
00272 
00273         @param radius: radius of the sphere (centred at the CA atom)
00274         @type radius: float
00275 
00276         @param offset: number of flanking residues that are ignored in the calculation            of the number of neighbors
00277         @type offset: int
00278 
00279         """
00280         assert(offset>=0)
00281         ppb=CaPPBuilder()
00282         ppl=ppb.build_peptides(model)
00283         fs_map={}
00284         fs_list=[]
00285         fs_keys=[]
00286         for pp1 in ppl:
00287             for i in range(0, len(pp1)):
00288                 fs=0
00289                 r1=pp1[i]
00290                 if not is_aa(r1) or not r1.has_id('CA'):
00291                     continue
00292                 ca1=r1['CA']
00293                 for pp2 in ppl:
00294                     for j in range(0, len(pp2)):
00295                         if pp1 is pp2 and abs(i-j)<=offset:
00296                             continue
00297                         r2=pp2[j]
00298                         if not is_aa(r2) or not r2.has_id('CA'):
00299                             continue
00300                         ca2=r2['CA']
00301                         d=(ca2-ca1)
00302                         if d<radius:
00303                             fs+=1
00304                 res_id=r1.get_id()
00305                 chain_id=r1.get_parent().get_id()
00306                 # Fill the 3 data structures
00307                 fs_map[(chain_id, res_id)]=fs
00308                 fs_list.append((r1, fs))
00309                 fs_keys.append((chain_id, res_id))
00310                 # Add to xtra
00311                 r1.xtra['EXP_CN']=fs
00312         AbstractPropertyMap.__init__(self, fs_map, fs_keys, fs_list)
00313 

Here is the call graph for this function:


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.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 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: