cocomico.base

CoCoMiCo base semantic domains.

Classes

Reaction

Reactions with the same name but in different taxa are distinct.

Metabolite

Metabolites are metabolite biomolecules tagged with organism biomolecules.

MetaboliteSet

MetaboliteSets are sets of metabolites with additional operations

Seeds

Seeds are sets of metabolite biomolecules that define inputs to a community.

Exchange

Reactions with the same name but in different taxa are distinct.

ExchangeNM

An Exchanged defines an n to m relation between producers and consumers.

Module Contents

class cocomico.base.Reaction[source]

Bases: NamedTuple

Reactions with the same name but in different taxa are distinct.

class cocomico.base.Metabolite(provenance: Taxon, biomolecule: Biomolecule)[source]

Metabolites are metabolite biomolecules tagged with organism biomolecules.

Parameters:
  • provenance (Taxon) – provenance organism

  • biomolecule (Biomolecule) – generic metabolite biomolecule

property provenance: Taxon

Metabolite provenance organism biomolecule.

Return type:

Taxon

property biomolecule: Biomolecule

Metabolite generic biomolecule.

Return type:

Biomolecule

classmethod from_string(identifier: str) Self[source]

Factory method to create a metabolite from a string.

Parameters:

identifier (str) – string-coded metabolite “NAME.TAXON”

Return type:

Metabolite

class cocomico.base.MetaboliteSet[source]

Bases: Set[Metabolite]

MetaboliteSets are sets of metabolites with additional operations for taxa.

property taxa: set[Taxon]

The taxa of a metabolite set.

Return type:

set[Taxon]

property biomolecules: set[Biomolecule]

The taxa of a metabolite set.

Return type:

set[Biomolecule]

select(taxa: set[Taxon]) Self[source]

Subset of a metabolite set from the given taxa.

Parameters:

taxa (set[Taxon])

Return type:

Self

__str__() str[source]

Return str(self).

Return type:

str

class cocomico.base.Seeds[source]

Bases: FrozenSet[Biomolecule]

Seeds are sets of metabolite biomolecules that define inputs to a community.

Parameters:
  • seeds (Iterable[Biomolecule]) – set of metabolite biomolecules

  • name (str, optional) – symbolic name for the set of seeds

classmethod from_file(file: pathlib.Path) Self[source]

Read new seed object from an SBML file

Parameters:

file (Path) – path to SBML file containing seed molecular species

Return type:

Self

__str__() str[source]

String representation.

Return type:

str

class cocomico.base.Exchange[source]

Bases: NamedTuple

Reactions with the same name but in different taxa are distinct.

class cocomico.base.ExchangeNM(relations: set[tuple[Taxon, Taxon]] | set[Exchange] | None = None, producers: Iterable[Taxon] | None = None, consumers: Iterable[Taxon] | None = None)[source]

An Exchanged defines an n to m relation between producers and consumers. Designed to represent metabolite exchanges.

Exchange objects act like a set of pairs of producer-consumer relations that can be queried for membership. Sets of roducers and consumers can also be retrieved separately.

Parameters:
  • producers (Iterable[Taxon] | None) – set of producer taxa for this exchange

  • consumers (Iterable[Taxon] | None) – set of consumer taxa for this exchange

  • relations (set[tuple[Taxon, Taxon]] | set[Exchange] | None)

__iter__()[source]

A exchange is iterable, and iterates over (producer,consumer) tuples.

__contains__(item: tuple[Taxon, Taxon]) bool[source]

Test for membership without iterating.

Parameters:

item (tuple[Taxon, Taxon])

Return type:

bool

__eq__(other) bool[source]

Exchanges are equal if their producer and consumer sets are equal.

Return type:

bool