Bio.GenBank package
Submodules
- Bio.GenBank.Record module
Record
Record.GB_LINE_LENGTH
Record.GB_BASE_INDENT
Record.GB_FEATURE_INDENT
Record.GB_INTERNAL_INDENT
Record.GB_OTHER_INTERNAL_INDENT
Record.GB_FEATURE_INTERNAL_INDENT
Record.GB_SEQUENCE_INDENT
Record.BASE_FORMAT
Record.INTERNAL_FORMAT
Record.OTHER_INTERNAL_FORMAT
Record.BASE_FEATURE_FORMAT
Record.INTERNAL_FEATURE_FORMAT
Record.SEQUENCE_FORMAT
Record.__init__()
Record.__str__()
Reference
Feature
Qualifier
- Bio.GenBank.Scanner module
InsdcScanner
InsdcScanner.RECORD_START
InsdcScanner.HEADER_WIDTH
InsdcScanner.FEATURE_START_MARKERS
InsdcScanner.FEATURE_END_MARKERS
InsdcScanner.FEATURE_QUALIFIER_INDENT
InsdcScanner.FEATURE_QUALIFIER_SPACER
InsdcScanner.SEQUENCE_HEADERS
InsdcScanner.__init__()
InsdcScanner.set_handle()
InsdcScanner.find_start()
InsdcScanner.parse_header()
InsdcScanner.parse_features()
InsdcScanner.parse_feature()
InsdcScanner.parse_footer()
InsdcScanner.feed()
InsdcScanner.parse()
InsdcScanner.parse_records()
InsdcScanner.parse_cds_features()
EmblScanner
GenBankScanner
GenBankScanner.RECORD_START
GenBankScanner.HEADER_WIDTH
GenBankScanner.FEATURE_START_MARKERS
GenBankScanner.FEATURE_END_MARKERS
GenBankScanner.FEATURE_QUALIFIER_INDENT
GenBankScanner.FEATURE_QUALIFIER_SPACER
GenBankScanner.SEQUENCE_HEADERS
GenBankScanner.GENBANK_INDENT
GenBankScanner.GENBANK_SPACER
GenBankScanner.STRUCTURED_COMMENT_START
GenBankScanner.STRUCTURED_COMMENT_END
GenBankScanner.STRUCTURED_COMMENT_DELIM
GenBankScanner.parse_footer()
GenBankScanner.__annotations__
- Bio.GenBank.utils module
Module contents
Code to work with GenBank formatted files.
Rather than using Bio.GenBank, you are now encouraged to use Bio.SeqIO with the “genbank” or “embl” format names to parse GenBank or EMBL files into SeqRecord and SeqFeature objects (see the Biopython tutorial for details).
Using Bio.GenBank directly to parse GenBank files is only useful if you want to obtain GenBank-specific Record objects, which is a much closer representation to the raw file contents than the SeqRecord alternative from the FeatureParser (used in Bio.SeqIO).
To use the Bio.GenBank parser, there are two helper functions:
read Parse a handle containing a single GenBank record as Bio.GenBank specific Record objects.
parse Iterate over a handle containing multiple GenBank records as Bio.GenBank specific Record objects.
The following internal classes are not intended for direct use and may be deprecated in a future release.
- Classes:
Iterator Iterate through a file of GenBank entries
FeatureParser Parse GenBank data in SeqRecord and SeqFeature objects.
RecordParser Parse GenBank data into a Record object.
- Exceptions:
ParserFailureError Exception indicating a failure in the parser (ie. scanner or consumer)
- class Bio.GenBank.Iterator(handle, parser=None)
Bases:
object
Iterator interface to move over a file of GenBank entries one at a time (OBSOLETE).
This class is likely to be deprecated in a future release of Biopython. Please use Bio.SeqIO.parse(…, format=”gb”) or Bio.GenBank.parse(…) for SeqRecord and GenBank specific Record objects respectively instead.
- __init__(handle, parser=None)
Initialize the iterator.
- Arguments:
handle - A handle with GenBank entries to iterate through.
parser - An optional parser to pass the entries through before returning them. If None, then the raw entry will be returned.
- __next__()
Return the next GenBank record from the handle.
Will return None if we ran out of records.
- __iter__()
Iterate over the records.
- exception Bio.GenBank.ParserFailureError
Bases:
ValueError
Failure caused by some kind of problem in the parser.
- class Bio.GenBank.FeatureParser(debug_level=0, use_fuzziness=1, feature_cleaner=None)
Bases:
object
Parse GenBank files into Seq + Feature objects (OBSOLETE).
Direct use of this class is discouraged, and may be deprecated in a future release of Biopython.
Please use Bio.SeqIO.parse(…) or Bio.SeqIO.read(…) instead.
- __init__(debug_level=0, use_fuzziness=1, feature_cleaner=None)
Initialize a GenBank parser and Feature consumer.
- Arguments:
debug_level - An optional argument that species the amount of debugging information the parser should spit out. By default we have no debugging info (the fastest way to do things), but if you want you can set this as high as two and see exactly where a parse fails.
use_fuzziness - Specify whether or not to use fuzzy representations. The default is 1 (use fuzziness).
feature_cleaner - A class which will be used to clean out the values of features. This class must implement the function clean_value. GenBank.utils has a “standard” cleaner class, which is used by default.
- parse(handle)
Parse the specified handle.
- class Bio.GenBank.RecordParser(debug_level=0)
Bases:
object
Parse GenBank files into Record objects (OBSOLETE).
Direct use of this class is discouraged, and may be deprecated in a future release of Biopython.
Please use the Bio.GenBank.parse(…) or Bio.GenBank.read(…) functions instead.
- __init__(debug_level=0)
Initialize the parser.
- Arguments:
debug_level - An optional argument that species the amount of debugging information the parser should spit out. By default we have no debugging info (the fastest way to do things), but if you want you can set this as high as two and see exactly where a parse fails.
- parse(handle)
Parse the specified handle into a GenBank record.
- Bio.GenBank.parse(handle)
Iterate over GenBank formatted entries as Record objects.
>>> from Bio import GenBank >>> with open("GenBank/NC_000932.gb") as handle: ... for record in GenBank.parse(handle): ... print(record.accession) ['NC_000932']
To get SeqRecord objects use Bio.SeqIO.parse(…, format=”gb”) instead.
- Bio.GenBank.read(handle)
Read a handle containing a single GenBank entry as a Record object.
>>> from Bio import GenBank >>> with open("GenBank/NC_000932.gb") as handle: ... record = GenBank.read(handle) ... print(record.accession) ['NC_000932']
To get a SeqRecord object use Bio.SeqIO.read(…, format=”gb”) instead.