5.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.

5.1.1.1.7.1. Module Contents

5.1.1.1.7.1.1. Classes

DataModel

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

5.1.1.1.7.1.2. Functions

summary(model: cobra.Model, original: DataModel, filename: pathlib.Path = None)

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

class cobramod.core.summary.DataModel(lists: Dict[str, list])

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.

classmethod from_model(cls, model: cobra.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(self, 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(self, path, model: cobra.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(self, path, model: cobra.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 (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(self, path, model: cobra.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: cobra.Model, original: DataModel, filename: pathlib.Path = None)

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.