read_gbk()
Read GenBank files.
Usage
python
from geneviewer import read_gbk
read_gbk(path, sections=None, features=None, origin=True)Arguments
| Argument | Type | Description |
|---|---|---|
path | str or path-like | A GenBank file (.gbk or .gb), or a folder of them. |
sections | sequence of str, optional | The sections to read, e.g. ["LOCUS", "FEATURES"]; by default all of them. |
features | sequence of str, optional | The feature keys to read from FEATURES, e.g. ["CDS"]; by default all of them. |
origin | bool, default True | Whether 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
| Error | When |
|---|---|
FileNotFoundError | When the path does not exist, or a folder has no GenBank files. |
