Back to index

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

List of all members.

Public Member Functions

def __init__
def pcb_vectors_pymol
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

Detailed Description

Class to calculate HSE based on the approximate CA-CB vectors,
using three consecutive CA positions.

Definition at line 136 of file HSExposure.py.


Constructor & Destructor Documentation

def Bio.PDB.HSExposure.HSExposureCA.__init__ (   self,
  model,
  radius = 12,
  offset = 0 
)
@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 141 of file HSExposure.py.

00141 
00142     def __init__(self, model, radius=12, offset=0):
00143         """
00144         @param model: the model that contains the residues
00145         @type model: L{Model}
00146 
00147         @param radius: radius of the sphere (centred at the CA atom)
00148         @type radius: float
00149 
00150         @param offset: number of flanking residues that are ignored in the calculation            of the number of neighbors
00151         @type offset: int
00152         """
00153         _AbstractHSExposure.__init__(self, model, radius, offset, 
00154                 'EXP_HSE_A_U', 'EXP_HSE_A_D', 'EXP_CB_PCB_ANGLE')


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.HSExposureCA._get_cb (   self,
  r1,
  r2,
  r3 
) [private]
Calculate the approximate CA-CB direction for a central
CA atom based on the two flanking CA positions, and the angle
with the real CA-CB vector. 

The CA-CB vector is centered at the origin.

@param r1, r2, r3: three consecutive residues
@type r1, r2, r3: L{Residue}

Reimplemented from Bio.PDB.HSExposure._AbstractHSExposure.

Definition at line 155 of file HSExposure.py.

00155 
00156     def _get_cb(self, r1, r2, r3):
00157         """
00158         Calculate the approximate CA-CB direction for a central
00159         CA atom based on the two flanking CA positions, and the angle
00160         with the real CA-CB vector. 
00161         
00162         The CA-CB vector is centered at the origin.
00163 
00164         @param r1, r2, r3: three consecutive residues
00165         @type r1, r2, r3: L{Residue}
00166         """
00167         if r1 is None or r3 is None:
00168             return None
00169         try:
00170             ca1=r1['CA'].get_vector()
00171             ca2=r2['CA'].get_vector()
00172             ca3=r3['CA'].get_vector()
00173         except:
00174             return None
00175         # center
00176         d1=ca2-ca1
00177         d3=ca2-ca3
00178         d1.normalize()
00179         d3.normalize()
00180         # bisection
00181         b=(d1+d3)
00182         b.normalize()
00183         # Add to ca_cb_list for drawing
00184         self.ca_cb_list.append((ca2, b+ca2))
00185         if r2.has_id('CB'):
00186             cb=r2['CB'].get_vector()
00187             cb_ca=cb-ca2
00188             cb_ca.normalize()
00189             angle=cb_ca.angle(b)
00190         elif r2.get_resname()=='GLY':
00191             cb_ca=self._get_gly_cb_vector(r2)
00192             if cb_ca is None:
00193                 angle=None
00194             else:
00195                 angle=cb_ca.angle(b)
00196         else:
00197             angle=None
00198         # vector b is centered at the origin!
00199         return b, angle

Here is the call 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:

def Bio.PDB.HSExposure.HSExposureCA.pcb_vectors_pymol (   self,
  filename = "hs_exp.py" 
)
Write a PyMol script that visualizes the pseudo CB-CA directions 
at the CA coordinates.

@param filename: the name of the pymol script file
@type filename: string

Definition at line 200 of file HSExposure.py.

00200 
00201     def pcb_vectors_pymol(self, filename="hs_exp.py"):
00202         """
00203         Write a PyMol script that visualizes the pseudo CB-CA directions 
00204         at the CA coordinates.
00205 
00206         @param filename: the name of the pymol script file
00207         @type filename: string
00208         """
00209         if len(self.ca_cb_list)==0:
00210             warnings.warn("Nothing to draw.", RuntimeWarning)
00211             return
00212         fp=open(filename, "w")
00213         fp.write("from pymol.cgo import *\n")
00214         fp.write("from pymol import cmd\n")
00215         fp.write("obj=[\n")
00216         fp.write("BEGIN, LINES,\n")
00217         fp.write("COLOR, %.2f, %.2f, %.2f,\n" % (1.0, 1.0, 1.0))
00218         for (ca, cb) in self.ca_cb_list:
00219             x,y,z=ca.get_array()
00220             fp.write("VERTEX, %.2f, %.2f, %.2f,\n" % (x,y,z))
00221             x,y,z=cb.get_array()
00222             fp.write("VERTEX, %.2f, %.2f, %.2f,\n" % (x,y,z))
00223         fp.write("END]\n")
00224         fp.write("cmd.load_cgo(obj, 'HS')\n")
00225         fp.close()
00226 

Here is the call 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: