7.1.1.1.1.7. cobramod.core.summary

Summary

This module is responsible for the short summary in the command line and for other summaries in different formats.

7.1.1.1.1.7.1. Attributes

7.1.1.1.1.7.2. Classes

DataModel

A class that can create a snapshot of a model and generates the summary

7.1.1.1.1.7.3. Functions

summary(model, original, filename)

Produces the short summary and another one in the defined format.

7.1.1.1.1.7.4. Module Contents

cobramod.core.summary.debug_log
class cobramod.core.summary.DataModel(lists)

A class that can create a snapshot of a model and generates the summary based on those snapshots. Contains methods to identify differences and save them in multiple formats.

Parameters:

lists (dict[str, list])

classmethod from_model(model)

Method to create a DataModel object based on a model object.

Parameters:

model (Model) – Model based on which a DataModel object is to be created.

diff(other)

Creates a new DataModel object consisting of the differences between the original and the passed DataModel object.

Parameters:

other (DataModel) – DataModel to be compared with this one.

to_excl(path, model=None, additions=None, deletions=None)

Method to save a DataModel as an Excel file. Can also be used to save the changes between two points in time, in an Excel file format. For other formats see cobramod.summary.DataModel.to_csv() or cobramod.summary.DataModel.to_txt().

Parameters:
  • path (Path) – Location where the file is to be saved.

  • model (Model) – Model for the extraction of model id and name.

  • additions (DataModel) – DataModel that contains the new entities in the model.

  • deletions (DataModel) – DataModel that contains the remote entities in the model.

to_csv(path, model=None, additions=None, deletions=None)

Method to save a DataModel as a CSV file. Can also be used to save the changes between two points in time, as a CSV. For other formats see cobramod.summary.DataModel.to_excl() or cobramod.summary.DataModel.to_txt().

Parameters:
  • path (Path) – Location where the file is to be saved.

  • model (cobra.Model)

model (Model): Model for the extraction of model id and name. additions (DataModel): DataModel that contains the new entities in

the model.

deletions (DataModel): DataModel that contains the remote entities

in the model.

to_txt(path, model=None, additions=None, deletions=None)

Method to save a DataModel as a txt file. Can also be used to save the changes between two points in time, as a txt. For other formats see cobramod.summary.DataModel.to_excl() or cobramod.summary.DataModel.to_csv().

Parameters:
  • path (Path) – Location where the file is to be saved.

  • model (Model) – Model for the extraction of model id and name.

  • additions (DataModel) – DataModel that contains the new entities

  • model. (in the)

  • deletions (DataModel) – DataModel that contains the remote entities

  • model.

cobramod.core.summary.summary(model, original, filename)

Produces the short summary and another one in the defined format.

Parameters:
  • model (Model) – model with recent changes.

  • original (DataModel) – Object with data from the previous model. Use method cobramod.summary.DataModel().

  • filename (Path) – Location where the summary should be stored. The file format is determined by the suffix of the filename. Thus, ‘.txt’, ‘.csv’ or ‘.xlsx’ can be used.