Reproducibility

Bio2BEL database models.

Bio2BEL adds hooks to the populate and drop_all methods in the bio2bel.AbstractManager class to track when they are run and therefore create provenance information for a given analysis.

The most recent population action from a given module can be retrieved with the following code:

from bio2bel.models import Action, _make_session
from sqlalchemy import desc

session = _make_session()
action = session.query(Action).filter(Action.resource == 'kegg').order_by(Action.created.desc()).first()
class bio2bel.models.Action(**kwargs)[source]

Represents an update, dropping, population, etc. to the database.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

resource

The normalized name of the Bio2BEL package (e.g., hgnc, chebi, etc)

created

The date and time of upload

static make_populate(resource)[source]

Make a populate instance of Action.

Return type

Action

static make_populate_failed(resource)[source]

Make a populate_failed instance of Action.

Return type

Action

static make_drop(resource)[source]

Make a drop instance of Action.

Return type

Action

classmethod store_populate(resource, session=None)[source]

Store a “populate” event.

Parameters

resource (str) – The normalized name of the resource to store

Example: >>> from bio2bel.models import Action >>> Action.store_populate(‘hgnc’)

Return type

Action

classmethod store_populate_failed(resource, session=None)[source]

Store a “populate failed” event.

Parameters

resource (str) – The normalized name of the resource to store

Example: >>> from bio2bel.models import Action >>> Action.store_populate_failed(‘hgnc’)

Return type

Action

classmethod store_drop(resource, session=None)[source]

Store a “drop” event.

Parameters

resource (str) – The normalized name of the resource to store

Example: >>> from bio2bel.models import Action >>> Action.store_drop(‘hgnc’)

Return type

Action

classmethod ls(session=None)[source]

Get all actions.

Return type

List[Action]

classmethod count(session=None)[source]

Count all actions.

Return type

int

bio2bel.models.create_all(engine, checkfirst=True)[source]

Create the tables for Bio2BEL.