cobra_component_models.orm package

Submodules

cobra_component_models.orm.abstract_component module

Provide abstract base components.

class cobra_component_models.orm.abstract_component.AbstractComponent(*, names: List[cobra_component_models.orm.abstract_component.AbstractComponentName], annotation: List[cobra_component_models.orm.abstract_component.AbstractComponentAnnotation], **kwargs)[source]

Bases: abc.ABC

Define an abstract base component.

__init__(*, names: List[cobra_component_models.orm.abstract_component.AbstractComponentName], annotation: List[cobra_component_models.orm.abstract_component.AbstractComponentAnnotation], **kwargs) → None[source]

Define the attributes for the abstract class.

class cobra_component_models.orm.abstract_component.AbstractComponentAnnotation(*, identifier: str, biology_qualifier: cobra_component_models.orm.biology_qualifier.BiologyQualifier, namespace: cobra_component_models.orm.namespace.Namespace, is_deprecated: bool = False, **kwargs)[source]

Bases: abc.ABC

Define an abstract base for component annotation.

__init__(*, identifier: str, biology_qualifier: cobra_component_models.orm.biology_qualifier.BiologyQualifier, namespace: cobra_component_models.orm.namespace.Namespace, is_deprecated: bool = False, **kwargs) → None[source]

Define the attributes for the abstract class.

class cobra_component_models.orm.abstract_component.AbstractComponentName(*, name: str, namespace: cobra_component_models.orm.namespace.Namespace, is_preferred: bool = False, **kwargs)[source]

Bases: abc.ABC

Define an abstract base for component names.

__init__(*, name: str, namespace: cobra_component_models.orm.namespace.Namespace, is_preferred: bool = False, **kwargs) → None[source]

Define the attributes for the abstract class.

cobra_component_models.orm.base module

Provide the declarative base class for ORM models.

class cobra_component_models.orm.base.CustomBase[source]

Bases: cobra_component_models.orm.mixin.timestamp_mixin.TimestampMixin

Define a declarative base class with timestamps for ORM models.

id

The auto-incrementing, integer, primary key in the table.

Type

int

__repr__()[source]

Return a string representation of the object.

id = Column(None, Integer(), table=None, primary_key=True, nullable=False)

cobra_component_models.orm.biology_qualifier module

Provide a biology qualifier ORM model.

class cobra_component_models.orm.biology_qualifier.BiologyQualifier(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Define a BioModels biology qualifier ORM model.

You can read more about them at http://co.mbine.org/standards/qualifiers.

qualifier

The text value of the qualifier.

Type

str

__repr__() → str[source]

Return a string representation of the object.

created_on
classmethod get_map(session) → Dict[str, cobra_component_models.orm.biology_qualifier.BiologyQualifier][source]

Extract a mapping from biology qualifiers to ORM instances.

id
classmethod load(session)[source]

Load all known biology qualifiers into the given database.

qualifier
updated_on

cobra_component_models.orm.compartment module

Provide a compartment ORM model.

class cobra_component_models.orm.compartment.Compartment(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Define a compartment ORM model.

notes
Type

str, optional

names
Type

list of cobra_component_models.orm.CompoundName, optional

annotation
Type

list of cobra_component_models.orm.CompoundAnnotation, optional

annotation
created_on
id
names
notes
updated_on

cobra_component_models.orm.compartment_annotation module

Provide a compartment annotation ORM model.

class cobra_component_models.orm.compartment_annotation.CompartmentAnnotation(*, is_deprecated=False, **kwargs)[source]

Bases: cobra_component_models.orm.mixin.annotation_mixin.AnnotationMixin, sqlalchemy.ext.declarative.api.Base

Define a compartment annotation ORM model.

compartment_id

The compartment being annotated.

Type

int

__repr__()[source]

Return a string representation of the object.

biology_qualifier

Defer the biology qualifier field instantiation.

biology_qualifier_id

Defer the biology qualifier id field instantiation.

compartment_id
created_on
id
identifier
is_deprecated
namespace

Defer the namespace field instantiation.

namespace_id

Defer the namespace id field instantiation.

updated_on

cobra_component_models.orm.compartment_name module

Provide a compartment name ORM model.

class cobra_component_models.orm.compartment_name.CompartmentName(*, is_preferred=False, **kwargs)[source]

Bases: cobra_component_models.orm.mixin.name_mixin.NameMixin, sqlalchemy.ext.declarative.api.Base

Define a compartment name ORM model.

compartment_id

The compartment being named.

Type

int

__repr__()[source]

Return a string representation of the object.

compartment_id
created_on
id
is_preferred
name
namespace

Defer the namespace field instantiation.

namespace_id

Defer the namespace id field instantiation.

updated_on

cobra_component_models.orm.compound module

Provide a compound ORM model.

class cobra_component_models.orm.compound.Compound(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Define a compound ORM model.

inchi
Type

str, optional

inchi_key
Type

str, optional

smiles
Type

str, optional

chemical_formula
Type

str, optional

charge
Type

float, optional

mass
Type

float, optional

notes
Type

str, optional

names
Type

list of cobra_component_models.orm.CompoundName, optional

annotation
Type

list of cobra_component_models.orm.CompoundAnnotation, optional

__repr__()[source]

Return a string representation of the object.

annotation
charge
chemical_formula
created_on
id
inchi
inchi_key
mass
names
notes
smiles
updated_on

cobra_component_models.orm.compound_annotation module

Provide a compound annotation ORM model.

class cobra_component_models.orm.compound_annotation.CompoundAnnotation(*, is_deprecated=False, **kwargs)[source]

Bases: cobra_component_models.orm.mixin.annotation_mixin.AnnotationMixin, sqlalchemy.ext.declarative.api.Base

Define a compound annotation ORM model.

compound_id

The compound being annotated.

Type

int

__repr__()[source]

Return a string representation of the object.

biology_qualifier

Defer the biology qualifier field instantiation.

biology_qualifier_id

Defer the biology qualifier id field instantiation.

compound_id
created_on
id
identifier
is_deprecated
namespace

Defer the namespace field instantiation.

namespace_id

Defer the namespace id field instantiation.

updated_on

cobra_component_models.orm.compound_name module

Provide a compound name ORM model.

class cobra_component_models.orm.compound_name.CompoundName(*, is_preferred=False, **kwargs)[source]

Bases: cobra_component_models.orm.mixin.name_mixin.NameMixin, sqlalchemy.ext.declarative.api.Base

Define a compound name ORM model.

compound_id

The compound being named.

Type

int

__repr__()[source]

Return a string representation of the object.

compound_id
created_on
id
is_preferred
name
namespace

Defer the namespace field instantiation.

namespace_id

Defer the namespace id field instantiation.

updated_on

cobra_component_models.orm.namespace module

Provide a MIRIAM compliant Identifiers.org namespace ORM model.

class cobra_component_models.orm.namespace.Namespace(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Define a MIRIAM compliant Identifiers.org namespace ORM model.

miriam_id

The MIRIAM namespace identifier for itself, e.g., MIR:00000567.

Type

str

prefix

The MIRIAM namespace prefix, e.g., ‘metanetx.chemical’.

Type

str

pattern

The regular expression pattern to validate against identifiers in the namespace, e.g., ^(MNXM\d+|BIOMASS)$.

Type

str

embedded_prefix

Whether or not identifiers of this namespace have an embedded prefix, e.g., ‘CHEBI:52971’.

Type

bool

name

The namespace’s common name.

Type

str, optional

description

A short description of the namespace.

Type

str, optional

__repr__()[source]

Return a string representation of the object.

created_on
description
embedded_prefix
classmethod get_map(session, prefixes: Optional[List[str]] = None) → Dict[str, cobra_component_models.orm.namespace.Namespace][source]

Extract a mapping from namespace prefix to ORM instances.

Parameters
  • session (sqlalchemy.Session) – A SQLAlchemy session giving access to a database.

  • prefixes (list of str, optional) – The elements in the mapping can be restricted to specific namespaces by their prefix (default return all).

Returns

A dictionary mapping from namespace prefix to ORM model instance.

Return type

dict

id
init_on_load()[source]

Compile the identifier pattern on load from database.

miriam_id
name
pattern
prefix
updated_on
validate_identifier(_, miriam_id: str) → str[source]

Validate the MIRIAM identifier against the pattern.

cobra_component_models.orm.participant module

Provide a reaction participant (reagent/product) ORM model.

class cobra_component_models.orm.participant.Participant(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Define a reaction participant (reagent/product) ORM model.

stoichiometry
Type

str

__repr__()[source]

Return a string representation of the object.

compartment
compartment_id
compound
compound_id
created_on
id
is_product
reaction_id
stoichiometry
updated_on

cobra_component_models.orm.reaction module

Provide a reaction ORM model.

class cobra_component_models.orm.reaction.Reaction(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Define a reaction ORM model.

notes
Type

str, optional

names
Type

list of cobra_component_models.orm.ReactionName, optional

annotation
Type

list of cobra_component_models.orm.ReactionAnnotation, optional

annotation
created_on
id
names
notes
participants
updated_on

cobra_component_models.orm.reaction_annotation module

Provide a reaction annotation ORM model.

class cobra_component_models.orm.reaction_annotation.ReactionAnnotation(*, is_deprecated=False, **kwargs)[source]

Bases: cobra_component_models.orm.mixin.annotation_mixin.AnnotationMixin, sqlalchemy.ext.declarative.api.Base

Define a reaction annotation ORM model.

reaction_id

The reaction being annotated.

Type

int

__repr__()[source]

Return a string representation of the object.

biology_qualifier

Defer the biology qualifier field instantiation.

biology_qualifier_id

Defer the biology qualifier id field instantiation.

created_on
id
identifier
is_deprecated
namespace

Defer the namespace field instantiation.

namespace_id

Defer the namespace id field instantiation.

reaction_id
updated_on

cobra_component_models.orm.reaction_name module

Provide a reaction name ORM model.

class cobra_component_models.orm.reaction_name.ReactionName(*, is_preferred=False, **kwargs)[source]

Bases: cobra_component_models.orm.mixin.name_mixin.NameMixin, sqlalchemy.ext.declarative.api.Base

Define a reaction name ORM model.

reaction_id

The SBML reaction being annotated.

Type

int

__repr__()[source]

Return a string representation of the object.

created_on
id
is_preferred
name
namespace

Defer the namespace field instantiation.

namespace_id

Defer the namespace id field instantiation.

reaction_id
updated_on

Module contents

Provide SQLAlchemy ORM models for storing components.