cobra.summary.summary

Provide the abstract base summary class.

Module Contents

Classes

Summary

Define the abstract base summary.

Attributes

logger

cobra.summary.summary.logger[source]
class cobra.summary.summary.Summary(**kwargs)[source]

Bases: abc.ABC

Define the abstract base summary.

See also

MetaboliteSummary, ReactionSummary, ModelSummary

property tolerance: float[source]

Return the set threshold.

_generate(model: cobra.Model, solution: Optional[cobra.Solution], fva: Optional[Union[float, pandas.DataFrame]]) None[source]

Prepare the data for the summary instance.

Parameters
  • model (cobra.Model) – The metabolic model for which to generate a metabolite summary.

  • solution (cobra.Solution, optional) – A previous model solution to use for generating the summary. If None, the summary method will generate a parsimonious flux distribution.

  • fva (pandas.DataFrame or float, optional) – 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.

__str__() str[source]

Return a string representation of the summary.

_repr_html_() str[source]

Return a rich HTML representation of the summary.

_normalize_threshold(threshold: Optional[float])[source]

Return a sensible threshold value.

abstract to_string(names: bool = False, threshold: Optional[float] = None, float_format: str = '.4G', column_width: int = 79) str[source]

Return a pretty string representation of the summary.

Parameters
  • names (bool, optional) – Whether or not elements should be displayed by their common names (default False).

  • threshold (float, optional) – Hide fluxes below the threshold from being displayed. If no value is given, the model tolerance is used (default None).

  • float_format (str, optional) – Format string for floats (default ‘.4G’).

  • column_width (int, optional) – The maximum column width for each row (default 79).

Returns

The summary formatted as a pretty string.

Return type

str

abstract to_html(names: bool = False, threshold: Optional[float] = None, float_format: str = '.4G') str[source]

Return a rich HTML representation of the metabolite summary.

Parameters
  • names (bool, optional) – Whether or not elements should be displayed by their common names (default False).

  • threshold (float, optional) – Hide fluxes below the threshold from being displayed. If no value is given, the model tolerance is used (default None).

  • float_format (str, optional) – Format string for floats (default ‘.4G’).

Returns

The summary formatted as HTML.

Return type

str

to_frame() pandas.DataFrame[source]

Return the a data frame representation of the summary.