17.1.1.1.1.12. cobra.core.species

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

17.1.1.1.1.12.1. Module Contents

17.1.1.1.1.12.1.1. Classes

Species

Species is a base class in Cobrapy.

class cobra.core.species.Species(id: Optional[str] = None, name: Optional[str] = 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.

property reactions(self) → FrozenSet[source]

Return a frozenset of reactions.

Returns

A frozenset that includes the reactions of the species.

Return type

FrozenSet

__getstate__(self) → 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(self) → '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(self) → Optional['Model'][source]

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