cobra.core.species#

Define the Species class, used as a base for Gene and Metabolite.

Classes#

Species

Species is a base class in Cobrapy.

Module Contents#

class cobra.core.species.Species(id: str | None = None, name: str | None = None, **kwargs)[source]#

Bases: cobra.core.object.Object

Species is a base class in Cobrapy.

Species is a class for holding information regarding a chemical Species

Parameters:
  • id (string) – An identifier for the chemical species

  • name (string) – A human readable name.

_model = None#
_reaction#
property reactions: FrozenSet#

Return a frozenset of reactions.

Returns:

A frozenset that includes the reactions of the species.

Return type:

FrozenSet

__getstate__() dict[source]#

Return the state of the species.

Remove the references to container reactions when serializing to avoid problems associated with recursion.

Returns:

A dictionary describing the state, without the self._reaction to avoid recursion.

Return type:

dict

copy() Species[source]#

Copy a species.

When copying a reaction, it is necessary to deepcopy the components so the list references aren’t carried over.

Additionally, a copy of a reaction is no longer in a cobra.Model.

This should be fixed with self.__deepcopy__ if possible

Returns:

A copy of the species.

Return type:

Species

property model: cobra.Model | None#

Return the model.

Returns:

Returns the cobra model that the species is associated with. None if there is no model associated with this species.

Return type:

model