Back to index

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

Classes

class  Fragment
class  FragmentMapper

Functions

def _read_fragments
def _make_fragment_list
def _map_fragment_list

Variables

string _FRAGMENT_FILE = "lib_%s_z_%s.txt"
tuple p = PDBParser()
tuple s = p.get_structure("X", sys.argv[1])
list m = s[0]
tuple fm = FragmentMapper(m, 10, 5, "levitt_data")

Function Documentation

def Bio.PDB.FragmentMapper._make_fragment_list (   pp,
  length 
) [private]
Dice up a peptide in fragments of length "length".

@param pp: a list of residues (part of one peptide)
@type pp: [L{Residue}, L{Residue}, ...]

@param length: fragment length
@type length: int

Definition at line 175 of file FragmentMapper.py.

00175 
00176 def _make_fragment_list(pp, length):
00177     """
00178     Dice up a peptide in fragments of length "length".
00179 
00180     @param pp: a list of residues (part of one peptide)
00181     @type pp: [L{Residue}, L{Residue}, ...]
00182 
00183     @param length: fragment length
00184     @type length: int
00185     """
00186     frag_list=[]
00187     for i in range(0, len(pp)-length+1):
00188         f=Fragment(length, -1)
00189         for j in range(0, length):
00190             residue=pp[i+j]
00191             resname=residue.get_resname()
00192             if residue.has_id("CA"):
00193                 ca=residue["CA"]
00194             else:
00195                 raise PDBException("CHAINBREAK")
00196             if ca.is_disordered():
00197                 raise PDBException("CHAINBREAK")
00198             ca_coord=ca.get_coord()
00199             f.add_residue(resname, ca_coord)
00200         frag_list.append(f)
00201     return frag_list
00202 

Here is the caller graph for this function:

def Bio.PDB.FragmentMapper._map_fragment_list (   flist,
  reflist 
) [private]
Map all frgaments in flist to the closest
(in RMSD) fragment in reflist.

Returns a list of reflist indices.

@param flist: list of protein fragments
@type flist: [L{Fragment}, L{Fragment}, ...]

@param reflist: list of reference (ie. library) fragments
@type reflist: [L{Fragment}, L{Fragment}, ...]

Definition at line 203 of file FragmentMapper.py.

00203 
00204 def _map_fragment_list(flist, reflist):
00205     """
00206     Map all frgaments in flist to the closest
00207     (in RMSD) fragment in reflist.
00208 
00209     Returns a list of reflist indices.
00210 
00211     @param flist: list of protein fragments
00212     @type flist: [L{Fragment}, L{Fragment}, ...]
00213 
00214     @param reflist: list of reference (ie. library) fragments
00215     @type reflist: [L{Fragment}, L{Fragment}, ...]
00216     """
00217     mapped=[]
00218     for f in flist:
00219         rank=[]
00220         for i in range(0, len(reflist)):
00221             rf=reflist[i]
00222             rms=f-rf
00223             rank.append((rms, rf))
00224         rank.sort()
00225         fragment=rank[0][1]
00226         mapped.append(fragment)
00227     return mapped
00228 

Here is the caller graph for this function:

def Bio.PDB.FragmentMapper._read_fragments (   size,
  length,
  dir = "." 
) [private]
Read a fragment spec file (available from 
U{http://csb.stanford.edu/rachel/fragments/} 
and return a list of Fragment objects.

@param size: number of fragments in the library
@type size: int

@param length: length of the fragments
@type length: int

@param dir: directory where the fragment spec files can be found
@type dir: string

Definition at line 49 of file FragmentMapper.py.

00049 
00050 def _read_fragments(size, length, dir="."):
00051     """
00052     Read a fragment spec file (available from 
00053     U{http://csb.stanford.edu/rachel/fragments/} 
00054     and return a list of Fragment objects.
00055 
00056     @param size: number of fragments in the library
00057     @type size: int
00058 
00059     @param length: length of the fragments
00060     @type length: int
00061 
00062     @param dir: directory where the fragment spec files can be found
00063     @type dir: string
00064     """
00065     filename=(dir+"/"+_FRAGMENT_FILE) % (size, length)
00066     fp=open(filename, "r")
00067     flist=[]
00068     # ID of fragment=rank in spec file
00069     fid=0
00070     for l in fp.readlines():
00071                 # skip comment and blank lines
00072         if l[0]=="*" or l[0]=="\n":
00073             continue
00074         sl=l.split()
00075         if sl[1]=="------":
00076             # Start of fragment definition
00077             f=Fragment(length, fid)
00078             flist.append(f)
00079             # increase fragment id (rank)
00080             fid+=1
00081             continue
00082         # Add CA coord to Fragment
00083         coord=numpy.array(map(float, sl[0:3]))
00084         # XXX= dummy residue name
00085         f.add_residue("XXX", coord)
00086     fp.close()
00087     return flist
00088 

Here is the call graph for this function:


Variable Documentation

string Bio.PDB.FragmentMapper._FRAGMENT_FILE = "lib_%s_z_%s.txt"

Definition at line 46 of file FragmentMapper.py.

tuple Bio.PDB.FragmentMapper.fm = FragmentMapper(m, 10, 5, "levitt_data")

Definition at line 329 of file FragmentMapper.py.

Definition at line 328 of file FragmentMapper.py.

Definition at line 325 of file FragmentMapper.py.

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

Definition at line 326 of file FragmentMapper.py.