load_annotations#

load_annotations(*, path: str | PathLike[Any] | PurePath | Path, seqids: str | Iterable[str] | None = None, db: AnnotationDbABC | None = None, write_path: str | PathLike[Any] | PurePath | Path = ':memory:', lines_per_block: int | None = 500000, show_progress: bool | Progress | dict[str, Any] = False, format_name: str | None = None, storage_backend: str | None = None) AnnotationDbABC#

loads annotations from flatfile into a db

Parameters:
path

path to a plain text file containing annotations, or a json file of a serialised cogent3 annotation db object

seqids

only features whose seqid matches a provided identifier are returned, the default is all features.

db

an existing feature db to add these records to. Must be of a compatible type.

write_path

where the constructed database should be written, defaults to memory only

lines_per_block

number of lines to insert into the db per iteration. This can help with memory usage. Only applies to gff files.

show_progress

applied only if loading features from multiple files

format_name

explicitly specify annotation format (‘gff’, ‘genbank’, ‘json’). If not provided, format is auto-detected from file suffix.

storage_backend

storage backend to use for the annotation database (e.g., ‘c3anndb’). If not provided, selects first compatible third-party plugin, falling back to cogent3 built-in SQLite loaders.

Notes

We DO NOT check if a provided db already contains records from a flatfile.