:py:mod:`cobra.summary.model_summary` ===================================== .. py:module:: cobra.summary.model_summary .. autoapi-nested-parse:: Provide the model summary class. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: cobra.summary.model_summary.ModelSummary Attributes ~~~~~~~~~~ .. autoapisummary:: cobra.summary.model_summary.logger .. py:data:: logger .. py:class:: ModelSummary(*, model: cobra.core.Model, solution: Optional[cobra.core.Solution] = None, fva: Optional[Union[float, pandas.DataFrame]] = None, **kwargs) Bases: :py:obj:`cobra.summary.Summary` Define the model summary. .. attribute:: uptake_flux A pandas DataFrame of only the uptake fluxes. :type: pandas.DataFrame .. attribute:: secretion_flux A pandas DataFrame of only the consuming fluxes. :type: pandas.DataFrame .. seealso:: :obj:`Summary` Parent that defines further attributes. :obj:`MetaboliteSummary`, :obj:`ReactionSummary` .. py:method:: _generate(model: cobra.core.Model, solution: Optional[cobra.core.Solution], fva: Optional[Union[float, pandas.DataFrame]]) -> None Prepare the data for the summary instance. :param model: The metabolic model for which to generate a metabolite summary. :type model: cobra.Model :param solution: A previous model solution to use for generating the summary. If ``None``, the summary method will generate a parsimonious flux distribution. :type solution: cobra.Solution, optional :param fva: Whether or not to include flux variability analysis in the output. If given, `fva` should either be a previous FVA solution matching the model or a float between 0 and 1 representing the fraction of the optimum objective to be searched. :type fva: pandas.DataFrame or float, optional .. py:method:: _display_flux(frame: pandas.DataFrame, names: bool, element: str, threshold: float) -> pandas.DataFrame Transform a flux data frame for display. :param frame: Either the producing or the consuming fluxes. :type frame: pandas.DataFrame :param names: Whether or not elements should be displayed by their common names. :type names: bool :param element: The atomic element to summarize fluxes for. :type element: str :param threshold: Hide fluxes below the threshold from being displayed. :type threshold: float :returns: The transformed pandas DataFrame with flux percentages and reaction definitions. :rtype: pandas.DataFrame .. py:method:: _string_table(frame: pandas.DataFrame, float_format: str, column_width: int) -> str :staticmethod: Create a pretty string representation of the data frame. :param frame: A pandas DataFrame of fluxes. :type frame: pandas.DataFrame :param float_format: Format string for floats. :type float_format: str :param column_width: The maximum column width for each row. :type column_width: int :returns: The data frame formatted as a pretty string. :rtype: str .. py:method:: _html_table(frame: pandas.DataFrame, float_format: str) -> str :staticmethod: Create an HTML representation of the data frame. :param frame: A pandas DataFrame of fluxes. :type frame: pandas.DataFrame :param float_format: Format string for floats. :type float_format: str :returns: The data frame formatted as HTML. :rtype: str .. py:method:: _string_objective(names: bool) -> str Return a string representation of the objective. :param names: Whether or not elements should be displayed by their common names. :type names: bool, optional :returns: The objective expression and value as a string. :rtype: str .. py:method:: to_string(names: bool = False, element: str = 'C', threshold: Optional[float] = None, float_format: str = '.4G', column_width: int = 79) -> str Return a pretty string representation of the model summary. :param names: Whether or not elements should be displayed by their common names (default False). :type names: bool, optional :param element: The atomic element to summarize uptake and secretion for (default 'C'). :type element: str, optional :param threshold: Hide fluxes below the threshold from being displayed. If no value is given, the model tolerance is used (default None). :type threshold: float, optional :param float_format: Format string for floats (default '.4G'). :type float_format: str, optional :param column_width: The maximum column width for each row (default 79). :type column_width: int, optional :returns: The summary formatted as a pretty string. :rtype: str .. py:method:: to_html(names: bool = False, element: str = 'C', threshold: Optional[float] = None, float_format: str = '.4G') -> str Return a rich HTML representation of the model summary. :param names: Whether or not elements should be displayed by their common names (default False). :type names: bool, optional :param element: The atomic element to summarize uptake and secretion for (default 'C'). :type element: str, optional :param threshold: Hide fluxes below the threshold from being displayed. If no value is given, the model tolerance is used (default None). :type threshold: float, optional :param float_format: Format string for floats (default '.4G'). :type float_format: str, optional :returns: The summary formatted as HTML. :rtype: str