Back to index

python-biopython  1.60
Namespaces | Classes | Functions | Variables
Bio.FSSP Namespace Reference

Namespaces

namespace  fssp_rec
namespace  FSSPTools

Classes

class  FSSPHeader
class  PosAlign
class  FSSPSumRec
class  FSSPAlignRec
class  FSSPAlignDict
class  FSSPSumDict

Functions

def read_fssp

Variables

 fff_rec = fssp_rec.fff_rec
dictionary header_records
tuple summary_title = re.compile('## +SUMMARY')
tuple summary_rec = re.compile(' *[0-9]+: +[1-9][0-9a-z]{3,3}')
tuple alignments_title = re.compile('## +ALIGNMENTS')
tuple alignments_rec = re.compile(' *[0-9]+ +-{0,1}[0-9]+')
tuple equiv_title = re.compile('## +EQUIVALENCES')

Detailed Description

Parser for FSSP files, used in a database of protein fold classifications.

This is a module to handle FSSP files. For now it parses only the header,
summary and alignment sections.

See: Holm and Sander (1996) The FSSP database: fold classification based on
structure-structure alignment of proteins.

functions: read_fssp(file_handle): reads an fssp file into the records. Returns a
tuple of two instances.
mult_align: returns a Biopython alignment object

Class Documentation

class Bio::FSSP::FSSPSumDict

Definition at line 205 of file __init__.py.


Function Documentation

def Bio.FSSP.read_fssp (   fssp_handle)

Definition at line 212 of file __init__.py.

00212 
00213 def read_fssp(fssp_handle):
00214    header = FSSPHeader()
00215    sum_dict = FSSPSumDict()
00216    align_dict = FSSPAlignDict()
00217    # fssp_handle=open(fssp_handlename)
00218    curline = fssp_handle.readline()
00219    while not summary_title.match(curline):
00220       # Still in title
00221       header.fill_header(curline)
00222       curline = fssp_handle.readline()
00223       
00224    if not summary_title.match(curline):
00225       raise ValueError('Bad FSSP file: no summary record found')
00226    curline = fssp_handle.readline()  #Read the title line, discard
00227    curline = fssp_handle.readline()  #Read the next line
00228    # Process the summary records into a list
00229    while summary_rec.match(curline):
00230       cur_sum_rec = FSSPSumRec(curline)
00231       sum_dict[cur_sum_rec.nr] = cur_sum_rec
00232       curline = fssp_handle.readline()
00233 
00234    # Outer loop: process everything up to the EQUIVALENCES title record
00235    while not equiv_title.match(curline):
00236       while (not alignments_title.match(curline) and
00237              not equiv_title.match(curline)):
00238          curline = fssp_handle.readline()
00239       if not alignments_title.match(curline):
00240          if equiv_title.match(curline):
00241             # print "Reached equiv_title"
00242             break
00243          else:
00244             raise ValueError('Bad FSSP file: no alignments title record found')
00245 
00246       if equiv_title.match(curline):
00247          break
00248       # If we got to this point, this means that we have matched an
00249       # alignments title. Parse the alignment records in a loop.
00250       curline = fssp_handle.readline()  #Read the title line, discard
00251       curline = fssp_handle.readline()  #Read the next line
00252       while alignments_rec.match(curline):
00253          align_rec = FSSPAlignRec(fff_rec(curline))
00254          key = align_rec.chain_id+align_rec.res_name+str(align_rec.pdb_res_num)
00255          align_list = curline[fssp_rec.align.start_aa_list:].strip().split()
00256          if key not in align_dict:
00257             align_dict[key] = align_rec
00258          align_dict[key].add_align_list(align_list)
00259          curline = fssp_handle.readline()
00260          if not curline:
00261             print 'EOFEOFEOF'
00262             raise EOFError
00263    for i in align_dict.itervalues():
00264       i.pos_align_list2dict()
00265       del i.PosAlignList
00266    align_dict.build_resnum_list()
00267    return (header, sum_dict, align_dict)
00268 

Variable Documentation

tuple Bio.FSSP.alignments_rec = re.compile(' *[0-9]+ +-{0,1}[0-9]+')

Definition at line 32 of file __init__.py.

tuple Bio.FSSP.alignments_title = re.compile('## +ALIGNMENTS')

Definition at line 31 of file __init__.py.

tuple Bio.FSSP.equiv_title = re.compile('## +EQUIVALENCES')

Definition at line 33 of file __init__.py.

Definition at line 17 of file __init__.py.

Initial value:
00001 {
00002    'database' : re.compile('^DATABASE'),
00003    'pdbid': re.compile('^PDBID'),
00004    'header': re.compile('^HEADER'),
00005    'compnd': re.compile('^COMPND'),
00006    'author': re.compile('^AUTHOR'),
00007    'source': re.compile('^SOURCE'),
00008    'seqlength': re.compile('^SEQLENGTH'),
00009    'nalign': re.compile('^NALIGN')
00010 }

Definition at line 18 of file __init__.py.

tuple Bio.FSSP.summary_rec = re.compile(' *[0-9]+: +[1-9][0-9a-z]{3,3}')

Definition at line 30 of file __init__.py.

tuple Bio.FSSP.summary_title = re.compile('## +SUMMARY')

Definition at line 29 of file __init__.py.