API Reference#

A fast GenBank I/O library based on the gb-io Rust crate.

Example

Load all the GenBank records from a single file, and print their accession:

>>> import gb_io
>>> records = gb_io.load("tests/data/AY048670.1.gb")
>>> print([record.accession for record in records])
['AY048670']

Iterate over records inside a gzip compressed GenBank file, and display the accession and sequence length of each record larger than 400,000bp:

>>> import gb_io
>>> import gzip
>>> with gzip.open("tests/data/JAOQKG01.1.gb.gz", "rb") as reader:
...     for record in gb_io.iter(reader):
...         if len(record.sequence) > 400000:
...             print(record.name, len(record.sequence))
JAOQKG010000001 754685
JAOQKG010000002 569365
JAOQKG010000003 418835
JAOQKG010000004 418347

Functions#

load

Load all GenBank records from the given path or file handle.

iter

Iterate over the GenBank records in the given file or file handle.

dump

Write one or more GenBank records to the given path or file handle.

Classes#

Record#

Record

A single GenBank record.

Feature

A feature located somewhere in the record.

Reference

A reference for a record.

Source

The source of a GenBank record.

Qualifier

A single key-value qualifier for a Feature.

Locations#

Location

A base location for a Feature.

Between

A location for a Feature located between two consecutive positions.

Bond

A location for a Feature corresponding to a bond between locations.

Complement

A location for a Feature on the opposite strand of a given Location.

External

A location for a Feature located in an external record.

Join

A location for a Feature consisting in joined sequence spans.

OneOf

A location for a Feature located at one of the given locations.

Order

A location for a Feature over disjoint locations in the given order.

Range

A location for a Feature spanning over a range of consecutive positions.

Reader#

RecordReader

An iterator over the Record contained in a file.