Skip to content

read_gbk() ​

Read GenBank files.

Usage ​

python
from geneviewer import read_gbk

read_gbk(path, sections=None, features=None, origin=True)

Arguments ​

ArgumentTypeDescription
pathstr or path-likeA GenBank file (.gbk or .gb), or a folder of them.
sectionssequence of str, optionalThe sections to read, e.g. ["LOCUS", "FEATURES"]; by default all of them.
featuressequence of str, optionalThe feature keys to read from FEATURES, e.g. ["CDS"]; by default all of them.
originbool, default TrueWhether to read the sequence (ORIGIN).

Value ​

dict: One entry per file, by its name without the extension. Each is a dict of sections: text, except FEATURES, a dict of feature key to a list of features (Feature), and ORIGIN, the sequence. Only the first record of a file with several is read correctly; a warning says so.

Errors ​

ErrorWhen
FileNotFoundErrorWhen the path does not exist, or a folder has no GenBank files.