Back to index

python-biopython  1.60
Classes | Functions | Variables
Bio.PDB.ResidueDepth Namespace Reference

Classes

class  ResidueDepth

Functions

def _read_vertex_array
def get_surface
def min_dist
def residue_depth
def ca_depth

Variables

tuple p = PDBParser()
tuple s = p.get_structure("X", sys.argv[1])
list model = s[0]
tuple rd = ResidueDepth(model, sys.argv[1])

Function Documentation

def Bio.PDB.ResidueDepth._read_vertex_array (   filename) [private]
Read the vertex list into a Numeric array.

Definition at line 52 of file ResidueDepth.py.

00052 
00053 def _read_vertex_array(filename):
00054     """
00055     Read the vertex list into a Numeric array.
00056     """
00057     fp=open(filename, "r")
00058     vertex_list=[]
00059     for l in fp.readlines():
00060         sl=l.split()
00061         if not len(sl)==9:
00062             # skip header
00063             continue
00064         vl=map(float, sl[0:3])
00065         vertex_list.append(vl)
00066     fp.close()
00067     return numpy.array(vertex_list)

Here is the call graph for this function:

Here is the caller graph for this function:

def Bio.PDB.ResidueDepth.ca_depth (   residue,
  surface 
)

Definition at line 123 of file ResidueDepth.py.

00123 
00124 def ca_depth(residue, surface):
00125     if not residue.has_id("CA"):
00126         return None
00127     ca=residue["CA"]
00128     coord=ca.get_coord()
00129     return min_dist(coord, surface)

Here is the call graph for this function:

Here is the caller graph for this function:

def Bio.PDB.ResidueDepth.get_surface (   pdb_file,
  PDB_TO_XYZR = "pdb_to_xyzr",
  MSMS = "msms" 
)
Return a Numeric array that represents 
the vertex list of the molecular surface.

PDB_TO_XYZR --- pdb_to_xyzr executable (arg. to os.system)
MSMS --- msms executable (arg. to os.system)

Definition at line 68 of file ResidueDepth.py.

00068 
00069 def get_surface(pdb_file, PDB_TO_XYZR="pdb_to_xyzr", MSMS="msms"):
00070     """
00071     Return a Numeric array that represents 
00072     the vertex list of the molecular surface.
00073 
00074     PDB_TO_XYZR --- pdb_to_xyzr executable (arg. to os.system)
00075     MSMS --- msms executable (arg. to os.system)
00076     """
00077     # extract xyz and set radii
00078     xyz_tmp=tempfile.mktemp()
00079     PDB_TO_XYZR=PDB_TO_XYZR+" %s > %s"
00080     make_xyz=PDB_TO_XYZR % (pdb_file, xyz_tmp)
00081     os.system(make_xyz)
00082     assert os.path.isfile(xyz_tmp), \
00083         "Failed to generate XYZR file using command:\n%s" % make_xyz
00084     # make surface
00085     surface_tmp=tempfile.mktemp()
00086     MSMS=MSMS+" -probe_radius 1.5 -if %s -of %s > "+tempfile.mktemp()
00087     make_surface=MSMS % (xyz_tmp, surface_tmp)
00088     os.system(make_surface)
00089     surface_file=surface_tmp+".vert"
00090     assert os.path.isfile(surface_file), \
00091         "Failed to generate surface file using command:\n%s" % make_surface
00092     # read surface vertices from vertex file
00093     surface=_read_vertex_array(surface_file)
00094     # clean up tmp files
00095     # ...this is dangerous
00096     #os.system("rm "+xyz_tmp)
00097     #os.system("rm "+surface_tmp+".vert")
00098     #os.system("rm "+surface_tmp+".face")
00099     return surface
00100 

Here is the call graph for this function:

Here is the caller graph for this function:

def Bio.PDB.ResidueDepth.min_dist (   coord,
  surface 
)
Return minimum distance between coord
and surface.

Definition at line 101 of file ResidueDepth.py.

00101 
00102 def min_dist(coord, surface):
00103     """
00104     Return minimum distance between coord
00105     and surface.
00106     """
00107     d=surface-coord
00108     d2=numpy.sum(d*d, 1)
00109     return numpy.sqrt(min(d2))

Here is the caller graph for this function:

def Bio.PDB.ResidueDepth.residue_depth (   residue,
  surface 
)
Return average distance to surface for all
atoms in a residue, ie. the residue depth.

Definition at line 110 of file ResidueDepth.py.

00110 
00111 def residue_depth(residue, surface):
00112     """
00113     Return average distance to surface for all
00114     atoms in a residue, ie. the residue depth.
00115     """
00116     atom_list=residue.get_unpacked_list()
00117     length=len(atom_list)
00118     d=0
00119     for atom in atom_list:
00120         coord=atom.get_coord()
00121         d=d+min_dist(coord, surface)
00122     return d/length

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 167 of file ResidueDepth.py.

tuple Bio.PDB.ResidueDepth.p = PDBParser()

Definition at line 165 of file ResidueDepth.py.

Definition at line 169 of file ResidueDepth.py.

tuple Bio.PDB.ResidueDepth.s = p.get_structure("X", sys.argv[1])

Definition at line 166 of file ResidueDepth.py.