cobra.core.species

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

Module Contents

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: FrozenSet[source]

Return a frozenset of reactions.

Returns

A frozenset that includes the reactions of the species.

Return type

FrozenSet

property model: Optional[cobra.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

__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