geckopy.flux_analysis¶
COBRA flux Methods to work with/around EC model nuisances.
Module Contents¶
Functions¶
|
Flux variability analysis for EC models. |
|
Return top protein bottlenecks based on the shadow prices. |
|
Return the top used proteins for each reaction rate. |
|
Add pFBA objective. |
|
Return the top used proteins for each reaction rate. |
|
Calculate the flux value for each kcat in kcat_range. |
- geckopy.flux_analysis.flux_variability_analysis(ec_model: geckopy.model.Model, fixed_reactions: Optional[List[str]] = None, ignored_reactions: Optional[List[str]] = None, n_proc: Optional[int] = config.processes, inplace: bool = False) → pandas.DataFrame[source]¶
Flux variability analysis for EC models.
This method is detailed in the Supplementary material of [Domenzain et al., 2021](https://www.biorxiv.org/content/10.1101/2021.03.05.433259v1.full.pdf).
For a fair comparison of flux distributions, EC models require some adjustments:
Since there are duplicated reactions (for each direction), the complementary reaction must be blocked to remove artificial flux variation.
Some reactions might be fixed (the glucose exchange reaction in the paper) to compare them with non-EC models.
The final reported flux is \(v_{max}, v_{max}^{rev} \forall v \in \text{reactions}\)
Additionally, just the combined reaction arm_ is reported for isozymes.
- Parameters
model (geckopy.Model) –
fixed_reactions (Optional[List[str]]) – List of reactions to be fixed (as in the second point in the description)
ignored_reactions (Optional[List[str]]) – List of reactions to be ignored
n_proc (int) – Number of processes to use. Default: the number of logical CPUs.
inplace (bool) – Whether to copy the model to then apply the changes
- Returns
fva_result – A data frame with reaction identifiers as the index and two columns: - maximum: indicating the highest possible flux - minimum: indicating the lowest possible flux
- Return type
pandas.DataFrame
- geckopy.flux_analysis.get_protein_bottlenecks(model: geckopy.model.Model, top: int = 10) → pandas.DataFrame[source]¶
Return top protein bottlenecks based on the shadow prices.
- geckopy.flux_analysis.protein_variability_analysis(ec_model: geckopy.model.Model, protein_list: Optional[List[str]] = None, n_proc: Optional[int] = config.processes) → pandas.DataFrame[source]¶
Return the top used proteins for each reaction rate.
- Parameters
model (geckopy.Model) –
protein_list (list[float]) –
n_proc (Optional[int]) –
- Returns
with columns ‘minimum’, ‘maximum’ and index as Protein.id
- Return type
pandas.DataFrame
- geckopy.flux_analysis.pfba_protein(model: geckopy.model.Model, objective: Optional[str] = None, fraction_of_optimum: float = 1.0) → cobra.core.Solution[source]¶
Add pFBA objective.
Add objective to minimize the summed flux of all proteins to the current objective.
See also
- Parameters
model (cobra.Model) – The model to add the objective to
objective – An objective to set in combination with the pFBA objective.
fraction_of_optimum (float) – Fraction of optimum which must be maintained. The original objective reaction is constrained to be greater than maximal_value * fraction_of_optimum.
Result –
------ –
solution (cobra.core.Solution) –
- geckopy.flux_analysis.get_protein_usage_by_reaction_rate(model: geckopy.model.Model, reaction: str, fix_fluxes: List[float], reaction_plot_name: str = 'Reaction rate', top: int = 10) → pandas.DataFrame[source]¶
Return the top used proteins for each reaction rate.
- Parameters
model (geckopy.Model) –
reaction (str) – id of the reaction whose flux will be fixed to each fix_fluxes.
fix_fluxes (list[float]) – the model will be optimized by sequentally fixing the reaction bounds to these fluxes.
top (int) – number of top proteins to return for each condition
- Returns
with colums ‘protein’, ‘fluxes’, ‘reduced_costs’, reaction_plot_name, ‘gene’
- Return type
pandas.DataFrame
Example
We can make a bar plot with a slider for each uptake rate using plotly express:
>>> import plotly.express as px >>> model.constrain_pool(0.448, 0.65, 0.8) >>> fluxes = geckopy.flux_analysis.get_protein_usage_by_reaction_rate( model, "EX_glc__D_e", [-0.1, -0.2, -0.5, -1.0, -5.0, -10.0], "Glc uptake" ) >>> # return percentages of the total protein pool >>> fluxes.fluxes *= 100 / 0.448 >>> px.bar( fluxes, x="protein", y="fluxes", hover_data=["gene"], color="fluxes", animation_frame="Glc uptake", color_continuous_scale="TealGrn", template="simple_white" )
- geckopy.flux_analysis.rate_kcat_concentration(model: geckopy.model.Model, protein: str, reaction: str, kcat_range: List[float])[source]¶
Calculate the flux value for each kcat in kcat_range.