Package Bio :: Package SeqIO :: Module InsdcIO
[hide private]
[frames] | no frames]

Source Code for Module Bio.SeqIO.InsdcIO

 1  # Copyright 2007, 2008 by Peter Cock.  All rights reserved. 
 2  # 
 3  # This code is part of the Biopython distribution and governed by its 
 4  # license.  Please see the LICENSE file that should have been included 
 5  # as part of this package.. 
 6   
 7  """Bio.SeqIO support for the "genbank" and "embl" file formats. 
 8   
 9  You are expected to use this module via the Bio.SeqIO functions. 
10  Note that internally this module calls Bio.GenBank to do the actual 
11  parsing of both GenBank and EMBL files. 
12   
13  See also: 
14   
15  International Nucleotide Sequence Database Collaboration 
16  http://www.insdc.org/ 
17    
18  GenBank 
19  http://www.ncbi.nlm.nih.gov/Genbank/ 
20   
21  EMBL Nucleotide Sequence Database 
22  http://www.ebi.ac.uk/embl/ 
23   
24  DDBJ (DNA Data Bank of Japan) 
25  http://www.ddbj.nig.ac.jp/ 
26  """ 
27   
28  from Bio.GenBank.Scanner import GenBankScanner, EmblScanner 
29  from Bio.Alphabet import generic_protein 
30   
31  # NOTE 
32  # ==== 
33  # The "brains" for parsing GenBank and EMBL files (and any 
34  # other flat file variants from the INSDC in future) is in 
35  # Bio.GenBank.Scanner (plus the _FeatureConsumer in Bio.GenBank) 
36   
37 -def GenBankIterator(handle) :
38 """Breaks up a Genbank file into SeqRecord objects. 39 40 Every section from the LOCUS line to the terminating // becomes 41 a single SeqRecord with associated annotation and features. 42 43 Note that for genomes or chromosomes, there is typically only 44 one record.""" 45 #This calls a generator function: 46 return GenBankScanner(debug=0).parse_records(handle)
47
48 -def EmblIterator(handle) :
49 """Breaks up an EMBL file into SeqRecord objects. 50 51 Every section from the LOCUS line to the terminating // becomes 52 a single SeqRecord with associated annotation and features. 53 54 Note that for genomes or chromosomes, there is typically only 55 one record.""" 56 #This calls a generator function: 57 return EmblScanner(debug=0).parse_records(handle)
58
59 -def GenBankCdsFeatureIterator(handle, alphabet=generic_protein) :
60 """Breaks up a Genbank file into SeqRecord objects for each CDS feature. 61 62 Every section from the LOCUS line to the terminating // can contain 63 many CDS features. These are returned as with the stated amino acid 64 translation sequence (if given). 65 """ 66 #This calls a generator function: 67 return GenBankScanner(debug=0).parse_cds_features(handle, alphabet)
68
69 -def EmblCdsFeatureIterator(handle, alphabet=generic_protein) :
70 """Breaks up a EMBL file into SeqRecord objects for each CDS feature. 71 72 Every section from the LOCUS line to the terminating // can contain 73 many CDS features. These are returned as with the stated amino acid 74 translation sequence (if given). 75 """ 76 #This calls a generator function: 77 return EmblScanner(debug=0).parse_cds_features(handle, alphabet)
78