:mod:`geckopy.flux_analysis` ============================ .. py:module:: geckopy.flux_analysis .. autoapi-nested-parse:: COBRA flux Methods to work with/around EC model nuisances. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: geckopy.flux_analysis.flux_variability_analysis geckopy.flux_analysis.get_protein_bottlenecks geckopy.flux_analysis.protein_variability_analysis geckopy.flux_analysis.pfba_protein geckopy.flux_analysis.get_protein_usage_by_reaction_rate geckopy.flux_analysis.rate_kcat_concentration .. function:: 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 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 :math:`v_{max}, v_{max}^{rev} \forall v \in \text{reactions}` Additionally, just the combined reaction `arm_` is reported for isozymes. .. seealso:: :py:func:`cobrapy:cobra.flux_analysis.flux_variability_analysis` :param model: :type model: geckopy.Model :param fixed_reactions: List of reactions to be fixed (as in the second point in the description) :type fixed_reactions: Optional[List[str]] :param ignored_reactions: List of reactions to be ignored :type ignored_reactions: Optional[List[str]] :param n_proc: Number of processes to use. Default: the number of logical CPUs. :type n_proc: int :param inplace: Whether to copy the model to then apply the changes :type inplace: bool :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 :rtype: pandas.DataFrame .. function:: get_protein_bottlenecks(model: geckopy.model.Model, top: int = 10) -> pandas.DataFrame Return `top` protein bottlenecks based on the shadow prices. .. function:: protein_variability_analysis(ec_model: geckopy.model.Model, protein_list: Optional[List[str]] = None, n_proc: Optional[int] = config.processes) -> pandas.DataFrame Return the top used proteins for each reaction rate. :param model: :type model: geckopy.Model :param protein_list: :type protein_list: list[float] :param n_proc: :type n_proc: Optional[int] :returns: with columns 'minimum', 'maximum' and index as `Protein.id` :rtype: pandas.DataFrame .. function:: pfba_protein(model: geckopy.model.Model, objective: Optional[str] = None, fraction_of_optimum: float = 1.0) -> cobra.core.Solution Add pFBA objective. Add objective to minimize the summed flux of all proteins to the current objective. .. seealso:: :py:func:`cobrapy:cobra.flux_analysis.pfba` :param model: The model to add the objective to :type model: cobra.Model :param objective: An objective to set in combination with the pFBA objective. :param fraction_of_optimum: Fraction of optimum which must be maintained. The original objective reaction is constrained to be greater than maximal_value * fraction_of_optimum. :type fraction_of_optimum: float :param Result: :param ------: :param solution: :type solution: cobra.core.Solution .. function:: 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 Return the top used proteins for each reaction rate. :param model: :type model: geckopy.Model :param reaction: id of the reaction whose flux will be fixed to each `fix_fluxes`. :type reaction: str :param fix_fluxes: the model will be optimized by sequentally fixing the reaction bounds to these fluxes. :type fix_fluxes: list[float] :param top: number of top proteins to return for each condition :type top: int :returns: with colums 'protein', 'fluxes', 'reduced_costs', `reaction_plot_name`, 'gene' :rtype: pandas.DataFrame .. rubric:: Example We can make a bar plot with a slider for each uptake rate using `plotly express `_: .. doctest:: >>> 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" ) .. function:: rate_kcat_concentration(model: geckopy.model.Model, protein: str, reaction: str, kcat_range: List[float]) Calculate the flux value for each kcat in `kcat_range`.