geckopy.protein

API for proteins.

Module Contents

Classes

Protein

Representation of an enzyme.

Kcats

Interface to modify kcats of a protein.

geckopy.protein.LOGGER[source]
geckopy.protein.UNIPROT_PATTERN[source]
geckopy.protein.config[source]
class geckopy.protein.Protein(id: Union[str, Metabolite] = None, concentration: float = None, molecular_weight: float = 0.0, name: str = '')[source]

Bases: cobra.Object

Representation of an enzyme.

A protein sets an upper bound to a set of reactions, given the kcat and concentration. Adapted from cobra.Reaction.

In terms of the inner LP model, Proteins populates both variables (as pseudorreactions with the mentioned upper_bound) and constraints (as metabolites).

id

identifier of protein, should be an Uniprot ID or “prot_<Uniprot ID>”

Type

str

name

human readable name

Type

str

concentration[source]

parsed from initialAmount of Species in the SBML specification.

Type

float

kcats

1 / stoichimetry coefficients of its reactions.

Type

Kcats

mw

TODO: parsed from initalParameters/calculate from formula

Type

float

contribution[source]

value of flux of variable, only accessible after optimizing the model.

Type

float

lower_bound

should be 0

Type

float

upper_bound[source]

concentration * kcat if there is a concentration, mmw if is part of the pool constraint (unmeasured proteins) or 1000.

Type

float

formula
Type

str

charge
Type

float

_set_id_with_model(self, value)[source]

Overwrite parent id setter to change constraints and variables.

from_metabolite(self, met: cobra.Metabolite)[source]

Initialize Protein from Metabolite; i.e., when reading from SBML.

update_variable_bounds(self)[source]

Sync object bounds with inner model variable bounds.

suscribe_to_pool(self, mmw: float)[source]

Change internal pseudorreaction to have the common pool as reactant.

unsuscribe_to_pool(self)[source]

Change internal pseudorreaction to have the common pool as reactant.

property concentration(self)float[source]

Get upper bounds as [E] (conventionally in $frac{mmol}{gDW}$).

[E] multiplied by the kcat (expressed in the reaction stoichiometry as 1/kcat) yields $frac{mmol}/{gDW h}$.

Taken from [Benjamín J Sánchez et al., 2016] (https://www.embopress.org/doi/full/10.15252/msb.20167411).

property upper_bound(self)float[source]

Get upper bounds as [E] (conventionally in $frac{mmol}{gDW}$).

[E] multiplied by the kcat (expressed in the reaction stoichiometry as 1/kcat) yields $frac{mmol}/{gDW h}$.

Taken from [Benjamín J Sánchez et al., 2016] (https://www.embopress.org/doi/full/10.15252/msb.20167411).

add_concentration(self, value: float)[source]

Add concentration value.

It will unsuscribe the protein to the common protein pool, if suscribed.

property reverse_id(self)str[source]

Generate the id of reverse_variable from the reaction’s id.

property contribution(self)str[source]

Get primal value (analogous to flux) in the most recent solution.

property flux(self)float[source]

Get flux value in the most recent solution.

Flux is the primal value of the corresponding variable in the model.

Warning

  • Accessing reaction fluxes through a Solution object is the safer, preferred, and only guaranteed to be correct way. You can see how to do so easily in the examples.

  • Reaction flux is retrieved from the currently defined self._model.solver. The solver status is checked but there are no guarantees that the current solver state is the one you are looking for.

  • If you modify the underlying model after an optimization, you will retrieve the old optimization values.

Raises
  • RuntimeError – If the underlying model was never optimized beforehand or the reaction is not part of a model.

  • OptimizationError – If the solver status is anything other than ‘optimal’.

  • AssertionError – If the flux value is not within the bounds.

property forward_variable(self)optlang.Variable[source]

Get optlang.Variable representing the forward flux.

Returns

An optlang variable for the forward flux or None if reaction is not associated with a model.

Return type

optlang.interface.Variable

property reverse_variable(self)optlang.Variable[source]

Get optlang.Variable representing the reverse flux.

Returns

An optlang variable for the reverse flux or None if reaction is not associated with a model.

Return type

optlang.interface.Variable

property objective_coefficient(self)float[source]

Get the coefficient for this reaction in a linear objective (float).

Assuming that the objective of the associated model is summation of fluxes from a set of reactions, the coefficient for each reaction can be obtained individually using this property. A more general way is to use the model.objective property directly.

property bounds(self)Tuple[float, float][source]

Get or set the bounds directly from a tuple.

Convenience method for setting upper and lower bounds in one line using a tuple of lower and upper bound. Invalid bounds will raise an AssertionError. When using a HistoryManager context, this attribute can be set temporarily, reversed when the exiting the context.

property _metabolites(self)[source]

Get metabolites.

property metabolites(self)Dict[source]

Get metabolite of the protein pseudoreaction as the protein itself.

property reactions(self)FrozenSet[Reaction][source]

Retrieve immutable private reactions property.

property model(self)[source]

Retrieve the model the reaction is a part of.

property reactants(self)[source]

Return a list of reactants for the reaction.

property products(self)[source]

Return a list of products for the reaction.

__setstate__(self, state)[source]

Set attribute to point to model, mimicking cobra.Reaction.

__str__(self)str[source]

Print str representation as id.

_repr_html_(self)str[source]
class geckopy.protein.Kcats(prot: geckopy.protein.Protein)[source]

Interface to modify kcats of a protein.

The user interacts with kcats in 1/s, translated to h to the model in the form stoichiometry coefficients of protein participating in a given reaction.

Example

# dictionary of Reaction to kcat in s
>>> model.proteins.prot_P0A796.kcats
# the user inputs the kcat in 1/s
>>> model.proteins.prot_P0A796.kcats["PFKNo1"] = 1 / 30
# the corresponding stoichiometry value is in -h
>>> ec_model.reactions.PFKNo1.metabolites[model.proteins.prot_P0A796] == -1/120
_update(self)[source]

Build the map on the fly.

__getitem__(self, key: Union[Reaction, str])float[source]

Return the kcat of the protein in the Reaaction key.

__setitem__(self, key: Union[Reaction, str], val: float)[source]

Assing kcat as val in the given key Reaction (as 1/kcat).

_model_warn(self, key: Union[Reaction, str], action: str)[source]
__iter__(self)[source]

Iterate inner dict.

items(self)[source]

Iterate inner items.

keys(self)[source]

Return inner dict’s keys.

values(self)[source]

Return inner dict’s values.

__repr__(self)[source]

Represent inner dict.