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

Module InsdcIO

source code

Bio.SeqIO support for the "genbank" and "embl" file formats.

You are expected to use this module via the Bio.SeqIO functions. Note that internally this module calls Bio.GenBank to do the actual parsing of GenBank, EMBL and IMGT files.

See also:

International Nucleotide Sequence Database Collaboration http://www.insdc.org/

GenBank http://www.ncbi.nlm.nih.gov/Genbank/

EMBL Nucleotide Sequence Database http://www.ebi.ac.uk/embl/

DDBJ (DNA Data Bank of Japan) http://www.ddbj.nig.ac.jp/

IMGT (use a variant of EMBL format with longer feature indents) http://imgt.cines.fr/download/LIGM-DB/userman_doc.html http://imgt.cines.fr/download/LIGM-DB/ftable_doc.html http://www.ebi.ac.uk/imgt/hla/docs/manual.html

Classes [hide private]
  _InsdcWriter
Base class for GenBank and EMBL writers (PRIVATE).
  GenBankWriter
GenBank writer.
  EmblWriter
EMBL writer.
  ImgtWriter
IMGT writer (EMBL format variant).
Functions [hide private]
 
GenBankIterator(handle)
Breaks up a Genbank file into SeqRecord objects.
source code
 
EmblIterator(handle)
Breaks up an EMBL file into SeqRecord objects.
source code
 
ImgtIterator(handle)
Breaks up an IMGT file into SeqRecord objects.
source code
 
GenBankCdsFeatureIterator(handle, alphabet=ProteinAlphabet())
Breaks up a Genbank file into SeqRecord objects for each CDS feature.
source code
 
EmblCdsFeatureIterator(handle, alphabet=ProteinAlphabet())
Breaks up a EMBL file into SeqRecord objects for each CDS feature.
source code
 
_insdc_feature_position_string(pos, offset=0)
Build a GenBank/EMBL position string (PRIVATE).
source code
 
_insdc_location_string_ignoring_strand_and_subfeatures(location, rec_length) source code
 
_insdc_location_string(location, rec_length)
Build a GenBank/EMBL location from a (Compound) FeatureLocation (PRIVATE).
source code
Variables [hide private]
  __package__ = 'Bio.SeqIO'
Function Details [hide private]

GenBankIterator(handle)

source code 

Breaks up a Genbank file into SeqRecord objects.

Every section from the LOCUS line to the terminating // becomes a single SeqRecord with associated annotation and features.

Note that for genomes or chromosomes, there is typically only one record.

This gets called internally by Bio.SeqIO for the GenBank file format:

>>> from Bio import SeqIO
>>> for record in SeqIO.parse("GenBank/cor6_6.gb", "gb"):
...     print(record.id)
...
X55053.1
X62281.1
M81224.1
AJ237582.1
L31939.1
AF297471.1

Equivalently,

>>> with open("GenBank/cor6_6.gb") as handle:
...     for record in GenBankIterator(handle):
...         print(record.id)
...
X55053.1
X62281.1
M81224.1
AJ237582.1
L31939.1
AF297471.1

EmblIterator(handle)

source code 

Breaks up an EMBL file into SeqRecord objects.

Every section from the LOCUS line to the terminating // becomes a single SeqRecord with associated annotation and features.

Note that for genomes or chromosomes, there is typically only one record.

This gets called internally by Bio.SeqIO for the EMBL file format:

>>> from Bio import SeqIO
>>> for record in SeqIO.parse("EMBL/epo_prt_selection.embl", "embl"):
...     print(record.id)
...
A00022.1
A00028.1
A00031.1
A00034.1
A00060.1
A00071.1
A00072.1
A00078.1
CQ797900.1

Equivalently,

>>> with open("EMBL/epo_prt_selection.embl") as handle:
...     for record in EmblIterator(handle):
...         print(record.id)
...
A00022.1
A00028.1
A00031.1
A00034.1
A00060.1
A00071.1
A00072.1
A00078.1
CQ797900.1

ImgtIterator(handle)

source code 

Breaks up an IMGT file into SeqRecord objects.

Every section from the LOCUS line to the terminating // becomes a single SeqRecord with associated annotation and features.

Note that for genomes or chromosomes, there is typically only one record.

GenBankCdsFeatureIterator(handle, alphabet=ProteinAlphabet())

source code 

Breaks up a Genbank file into SeqRecord objects for each CDS feature.

Every section from the LOCUS line to the terminating // can contain many CDS features. These are returned as with the stated amino acid translation sequence (if given).

EmblCdsFeatureIterator(handle, alphabet=ProteinAlphabet())

source code 

Breaks up a EMBL file into SeqRecord objects for each CDS feature.

Every section from the LOCUS line to the terminating // can contain many CDS features. These are returned as with the stated amino acid translation sequence (if given).

_insdc_feature_position_string(pos, offset=0)

source code 

Build a GenBank/EMBL position string (PRIVATE).

Use offset=1 to add one to convert a start position from python counting.

_insdc_location_string(location, rec_length)

source code 

Build a GenBank/EMBL location from a (Compound) FeatureLocation (PRIVATE).

There is a choice of how to show joins on the reverse complement strand, GenBank used "complement(join(1,10),(20,100))" while EMBL used to use "join(complement(20,100),complement(1,10))" instead (but appears to have now adopted the GenBank convention). Notice that the order of the entries is reversed! This function therefore uses the first form. In this situation we expect the CompoundFeatureLocation and its parts to all be marked as strand == -1, and to be in the order 19:100 then 0:10.