thapbi_pict.db_orm module

Object Relational Mapping for marker sequence database.

Using SQLalchemy, the Python classes defined here give us a database schema and the code to import/export the data as Python objects.

class thapbi_pict.db_orm.Base(*args: Any, **kwargs: Any)

Bases: DeclarativeBase

Base class for SQLAlchemy ORM declarations.

See the SQLAlchemy 2.0 documentation. This is expected to be compatible with type checkers like mypy.

class thapbi_pict.db_orm.DataSource(*args: Any, **kwargs: Any)

Bases: Base

Database entry for a data source (NCBI, curated, etc).

Each accession is expected to be unique within a data source.

class thapbi_pict.db_orm.MarkerDef(*args: Any, **kwargs: Any)

Bases: Base

Database entry for a marker listing primers and amplicon length limits.

class thapbi_pict.db_orm.MarkerSeq(*args: Any, **kwargs: Any)

Bases: Base

Database entry for a single marker reference sequence.

class thapbi_pict.db_orm.SeqSource(*args: Any, **kwargs: Any)

Bases: Base

Database entry for source of a marker sequence entry.

marker_definition

alias of MarkerDef

marker_seq

alias of MarkerSeq

source

alias of DataSource

taxonomy

alias of Taxonomy

class thapbi_pict.db_orm.Synonym(*args: Any, **kwargs: Any)

Bases: Base

Database entry for a synonym of a taxonomy entry.

In addition to direct synonyms, includes the names and synonyms of any child nodes of the species (e.g. variants, strains, etc).

class thapbi_pict.db_orm.Taxonomy(*args: Any, **kwargs: Any)

Bases: Base

Database entry for a species’ taxonomy entry.

thapbi_pict.db_orm.connect_to_db(*args, **kwargs)

Create engine and return session bound to it.

>>> Session = connect_to_db("sqlite:///:memory:", echo=True)
>>> session = Session()