Package Bio :: Package IntelliGenetics :: Module Record
[hide private]
[frames] | no frames]

Source Code for Module Bio.IntelliGenetics.Record

 1  # Copyright 2001 by Katharine Lindner.  All rights reserved. 
 2  # This code is part of the Biopython distribution and governed by its 
 3  # license.  Please see the LICENSE file that should have been included 
 4  # as part of this package. 
 5   
 6  """Martel based parser to read IntelliGenetics formatted files. 
 7   
 8  This is a huge regular regular expression for IntelliGenetics, built using 
 9  the 'regular expressiona on steroids' capabilities of Martel. 
10   
11  http://hiv-web.lanl.gov/ALIGN_97/HIV12SIV-index.html 
12   
13  Notes: 
14  Just so I remember -- the new end of line syntax is: 
15    New regexp syntax - \R 
16       \R    means "\n|\r\n?" 
17       [\R]  means "[\n\r]" 
18   
19  This helps us have endlines be consistent across platforms. 
20   
21  """ 
22  # standard library 
23  import string 
24   
25   
26  from Bio.Seq import Seq 
27  """Hold IntelliGenetics data in a straightforward format. 
28   
29  classes: 
30  o Record - All of the information in an IntelliGenetics record. 
31  """ 
32   
33 -class Record:
34 """Hold IntelliGenetics information in a format similar to the original record. 35 36 The Record class is meant to make data easy to get to when you are 37 just interested in looking at GenBank data. 38 39 Attributes: 40 comments 41 title 42 sequence 43 """
44 - def __init__(self):
45 self.comments = [] 46 self.title = '' 47 self.sequence = Seq('')
48
49 - def __str__( self ):
50 output = 'Title: %s\n' % self.title 51 for comment in self.comments: 52 output = output + '%s\n' % comment 53 output = output + out_sequence( self.sequence.data ) 54 return output
55
56 -def out_sequence( seq ):
57 output = '' 58 for j in range( 0, len( seq ), 80 ): 59 output = output + '%s\n' % seq[ j: j + 80 ] 60 output = output + '\n' 61 return output
62